首页 > 解决方案 > runner.results do not provide results in sequence of test run

问题描述

I want to get status of testcases run in a testsuite using teardown scripts. I am able to get the status but not in the sequence of the run of testcases.

I am getting results in random order. The names are in random order everytime.

for ( testCaseResult in runner.results )
{
   log.info "$testCaseName"
}

标签: groovysoapuiready-apiteardown

解决方案


每当我这样做时,我都会按照正确的顺序排列它们......

您可能想尝试这样的事情:

// 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.
        }
    }
}

推荐阅读