1
votes

I'm currently trying to generate a report for my test suite in SoapUI.

My old working code was a line this, in the testSuite teardown script :

def testc = project.testSuites['TestSuite'].testCases['TestCase'].testSteps['xxxxx']

But it had to be duplicated for each new test step.

The code that I'm trying to use is this one :

for (service in project.testSuites) {
    for (testCase in service.testCases) {
        for (testStep in testCase.testSteps) {
            someFile.withWriterAppend{out ->out.println testStep.toString()}
        }
    }
}

Wich is giving me this error :

groovy?lang.MissingPropertyException: No such property: testCases for class: javaUtil.hashMap$Node

Since I'm using the same path to access every test step, I was surprised to not be able to do it with an iteration.

1
Benjamin, would you please take a look at below solution to see if that resolves the above mentioned issue? If that helps, you may mark it as answered - Rao

1 Answers

1
votes

project.testSuites gives you the map. Hence the error. Instead use project.testSuiteList which gives the list. So, that the above mentioned error goes away.

Similarly, other objects as well. See below changed code snippet.

for (suite in project.testSuiteList) {
    for (kase in suite.testCaseList) {
        for (step in kase.testStepList) {
            someFile.withWriterAppend{out ->out.println testStep.toString()}
        }
    }
}