我想获取使用拆卸脚本在测试套件中运行的测试用例的状态。 我可以获取状态,但不能按测试用例的顺序来获取。
我正在以随机顺序获得结果。每次名字都是随机的。
for ( testCaseResult in runner.results )
{
log.info "$testCaseName"
}
答案 0 :(得分:0)
每当我这样做时,我都会以正确的顺序得到它们...
那么您可能想尝试以下方法:
// 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.
}
}
}