0

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"
}
Jitesh Prajapati
  • 2,533
  • 4
  • 29
  • 51
  • Vishesh, welcome. Please refer to the help center on [how](https://stackoverflow.com/help/how-to-ask) to ask a question. – tryman Mar 26 '19 at 12:28

1 Answers1

0

Whenever I do that, I do get them in the correct order...

You may want to try something like this then:

// 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.
        }
    }
}
Steen
  • 853
  • 5
  • 12