stega
13 years agoContributor
SoapUI Groovy TestStep
Hi All,
I have a problem with the groovy scripts in SoapUI TestSteps.
I tried to write a script which returns with the number of the elements in the response.
The script works fine in the request assertion, but returns with an error running it in a TestSuit TestStep(groovy script).
I want to count the elements, insert a new element with a request and than run again the script and compare the results.
The groovy script i've tried is this:
import groovy.json.JsonSlurper
def response = messageExchange.response.responseContent
def slurper = new JsonSlurper()
def json = slurper.parseText response
println json.size()
And i got the following error:
groovy.lang.MissingPropertyException: No such property: messageExchange for class: Script20 error at line: 3
I have a problem with the groovy scripts in SoapUI TestSteps.
I tried to write a script which returns with the number of the elements in the response.
The script works fine in the request assertion, but returns with an error running it in a TestSuit TestStep(groovy script).
I want to count the elements, insert a new element with a request and than run again the script and compare the results.
The groovy script i've tried is this:
import groovy.json.JsonSlurper
def response = messageExchange.response.responseContent
def slurper = new JsonSlurper()
def json = slurper.parseText response
println json.size()
And i got the following error:
groovy.lang.MissingPropertyException: No such property: messageExchange for class: Script20 error at line: 3