jomy10
2 years agoOccasional Contributor
Getting test steps in the correct order
I have a javascript which boils down to the following:
var testSteps = testRunner.testCase.testSteps.values().toArray();
for (var i = 0; i < testSteps.length; i++) {
log.info(testSteps[i].getName());
}
When I run this, it will print out the test steps in the current test case. However, this does not print them out in the order they appear in the UI.
For Example, I have the following testCase:
When I run the script in this testCase, I get the following output:
Tue Aug 08 12:02:16 CEST 2023:INFO:> Groovy Script
Tue Aug 08 12:02:16 CEST 2023:INFO:> Another step
Tue Aug 08 12:02:16 CEST 2023:INFO:> GenerateReport
How can I get these testSteps in the correct order (so first GenerateReport, then Groovy Script and then Another step)
SoapUI version: 5.2.1
I figured it out, so for anyone who stumbles upon this post:
replace
var testSteps = testRunner.testCase.testSteps.values().toArray();
with
var testSteps = testRunner.testCase.getTestStepList().toArray();