Forum Discussion
harryTemporary
12 years agoNew Contributor
Although soapui does have a property transfer form that you can fill out, I prefer to do this in groovy, as I'm usually dooing things with the properties as well as transfering them, and groovy is best for that sort of thing. Anyways, here's how I would do it.
Create a custom property called name at either the test step/case/suite level (depending on the scope of this property). Here, I put the property in at the test suite level. Next in the response, put ${#TestSuite#name} between the name tags.
Then, create a groovy script, and drop this code in.
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
def holder = groovyUtils.getXmlHolder( "YourRequestNameGoesHere#ResponseAsXml" );
def name = holder.getNodeValue(" //Response[1]/action[1]/name[1]/text()")
testRunner.testCase.testSuite.setPropertyValue("name",name)
That should be enough to do it. You just need to have the xpath (//Response[1]/action[1]/name[1]/text()) right, as it varies by response.
Create a custom property called name at either the test step/case/suite level (depending on the scope of this property). Here, I put the property in at the test suite level. Next in the response, put ${#TestSuite#name} between the name tags.
Then, create a groovy script, and drop this code in.
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );
def holder = groovyUtils.getXmlHolder( "YourRequestNameGoesHere#ResponseAsXml" );
def name = holder.getNodeValue(" //Response[1]/action[1]/name[1]/text()")
testRunner.testCase.testSuite.setPropertyValue("name",name)
That should be enough to do it. You just need to have the xpath (//Response[1]/action[1]/name[1]/text()) right, as it varies by response.
Related Content
Recent Discussions
- 3 days agoKLWallace