【问题标题】:runner.results do not provide results in sequence of test runrunner.results 不按测试运行顺序提供结果
【发布时间】:2019-03-26 11:58:47
【问题描述】:
我想使用拆解脚本获取在测试套件中运行的测试用例的状态。
我能够获得状态,但不能按测试用例的运行顺序获得。
我以随机顺序获得结果。名字每次都是随机排列的。
for ( testCaseResult in runner.results )
{
log.info "$testCaseName"
}
【问题讨论】:
-
Vishesh,欢迎您。请参阅how 的帮助中心提出问题。
标签:
groovy
soapui
ready-api
teardown
【解决方案1】:
每当我这样做时,我都会以正确的顺序得到它们......
你可能想尝试这样的事情:
// In this manner, I would expect you to get the testcases in correct order
for (def tc in runner.testSuite.testCaseList) {
// Now loop through the results in order to get the result for the current tc
for (def tcRunner in runner.results) {
def matchFound = false
if (tcRunner.testCase.name.equals(tc.name)) {
matchFound = true
// do your thing
}
if (!matchFound) {
// Do whatever you want to do, if the specific testresult was not found.
}
}
}