Forum Discussion
cbyndr
16 years agoContributor
It's easy enough to get at the AMF response from a Groovy script using the getXmlHolder method..
Simply use the responseAsXML property instead of the response property:
E.G.
def groovyUtils = new com.eviware.soapui.support.GroovyUtilsPro( context )
def response = groovyUtils.getXmlHolder( "amf-request-get-contacts#responseAsXML" )
def quota = response.getNodeValue("//object-array[1]/flex.messaging.io.amf.ASObject[1]/map[1]/string[8]")
What I like to do from there is save the property to a properties step:
def props = testRunner.testCase.getTestStepByName("properties")
def user_quota = props.setPropertyValue("quota", quota);
And then set up the AMF request's method argument to evaluate to the property:
${properties#quota}
If the AMF request needs an object for the method argument, you can grab responseAsXML contents via the AMF step's from the script editor.
Simply use the responseAsXML property instead of the response property:
E.G.
def groovyUtils = new com.eviware.soapui.support.GroovyUtilsPro( context )
def response = groovyUtils.getXmlHolder( "amf-request-get-contacts#responseAsXML" )
def quota = response.getNodeValue("//object-array[1]/flex.messaging.io.amf.ASObject[1]/map[1]/string[8]")
What I like to do from there is save the property to a properties step:
def props = testRunner.testCase.getTestStepByName("properties")
def user_quota = props.setPropertyValue("quota", quota);
And then set up the AMF request's method argument to evaluate to the property:
${properties#quota}
If the AMF request needs an object for the method argument, you can grab responseAsXML contents via the AMF step's from the script editor.