2
votes

I currently have a test suite with 76 Soap test steps in which all have been run. however in the logs I am getting the test step name as expected but no the response.

Both the groovy script and the test steps are in the same test suite but different test cases. It has the following structure:

  • TestSuite

    • TestCaseResponse
      • TestSteps
    • TestCaseLog
      • Groovy Script

Groovy Script:

def testCases = context.testCase.testSuite.getTestCaseList()
testCases.each
{

    for(testSteps in it.testStepList)
    {
        log.info "~~~Test Step:" + testSteps.name
        def requestname = testSteps.name
        log.info context.expand('${'+requestname+'#Response}')
    }
}

Logs:

Tue Mar 21 11:50:04 GMT 2017:INFO:~~~Test Step:TestStep_0001
Tue Mar 21 11:50:04 GMT 2017:INFO:
Tue Mar 21 11:50:04 GMT 2017:INFO:~~~Test Step:TestStep_0002
Tue Mar 21 11:50:04 GMT 2017:INFO:
Tue Mar 21 11:50:04 GMT 2017:INFO:~~~Test Step:TestStep_0003
Tue Mar 21 11:50:04 GMT 2017:INFO:

Why am I not getting the data that is in the response for each test step?

1
Have you run the cases already? where is this groovy script located, in the same test case / test suite or Teardown Script? - Rao
if in a different test case but same test suite. and all the test steps have been run and have repsonses - Ross
So you just want to log the response? Nothing else? - Rao
yeah so it has the test step title (which I have) and then all the text in that test step's response - Ross
What type of test step are there? soap or rest or http or jdbc? - Rao

1 Answers

2
votes

Here is the Groovy Script, which does what you are looking for: Key is to use step.getPropertyValue('Response')

import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep
//Repeat thru test cases
context.testCase.testSuite.testCaseList.each { tc ->
    tc.testStepList.each { step ->
        log.info "~~~Test Step:" + step.name 
        if (step instanceof WsdlTestRequestStep) {
            log.info step.getPropertyValue('Response')  
        } else {
            log.info 'Ignoring step as it is not SOAP request type step'
        }
    }
}