【发布时间】:2020-12-15 14:33:18
【问题描述】:
我有以下代码:
*** Settings ***
Library OperatingSystem
Library Process
Library String
*** Variables ***
@{MyList}= item items items2
${LogStr1} *HTML*
*** Test Cases ***
#Start Test#
[xxxxx] My tests
FOR ${item} IN @{MyList}
General test.out testProfile ${item}
[Template] Run Test
[Tags] TestTags
END
*** Keywords ***
Run Test
[Documentation] Run the test
[Arguments] ${type} ${profile} ${file} ${test}
When suite config is updated
And updated the config in directory ${test}
Then publish test status
suite config is updated
[Documentation] Get the variables list
Log to Console "Updating get suite config file"
updated the config in directory ${test}
[Documentation] Get the variables list
Run keyword if "${test}" == "items" Stop Test "This is stop called"
publish test status
[Documentation] Create and check if any issue found
${LogStr}= Catenate Test Passed : Log created: <a href="Hello.txt">Hello</a>
Log to Console ${LogStr}
${LogStr1}= Catenate ${LogStr1} ${LogStr}\n
Set Test Variable ${LogStr1}
Set Test Message ${LogStr1}
Stop Test
[Documentation] Stop Execution
[Arguments] ${FIALUREMSG}
Log To Console ${FIALUREMSG}
${LogStr1}= Catenate ${LogStr1} ${FIALUREMSG}
Fail ${LogStr1}
根据代码,可以务实地使测试在第一次或第三次运行时失败。所以当我有这样的代码时:
Run keyword if "${test}" == "item" Stop Test "This is stop called"
在提到的关键字中,有 2 个测试用例通过了一个套件但报告状态:
现在,如果我让第二个测试用例失败,我会得到以下测试消息日志:
Run keyword if "${test}" == "items" Stop Test "This is stop called"
在提到的关键字中,有 2 个测试用例通过了一个套件但报告状态:
如果
Run keyword if "${test}" == "items2" Stop Test "This is stop called"
等等 - 因此,当测试用例标记为失败时,报告消息中似乎忽略了“设置测试消息”日志值。请注意,以下是我运行代码以将第一个测试用例标记为失败时的 log.html 内容:
Run keyword if "${test}" == "item" Stop Test "This is stop called"
因此,我的所有问题是,如果我希望 report.html 文件显示所有失败和通过测试用例的日志,我该如何实现?
【问题讨论】:
-
@{MyList}的内容是否确定了runtime? -
@BenceKaulics 不是上面代码中的静态值集
标签: robotframework