Here is how I would do it.

Assuming this in your test case. There is a step which invoke a soap request and gets the response. Add a Script Assertion and below is the script. And what this script does is that it will read the response, checks if it is not a soapfault and extract the required xpath value as you desired and saves it at test case level property, say VALUE_FROM_PREVIOUS_RESPONSE is property name.

Script:

import com.eviware..support.XmlHolder
//asserting if the response is soap fault
assert context.response.toLowerCase().contains('soapfault'), "Response is soap fault"
def holder = new XmlHolder(context.response)
//You need to replace the xpath in below statement
def sValue = holder.getNodeValue('/your/xpath')
//asserting if given xpath has any value
assert sValue, "Xpath does not have any value"
//saving the above value at test case level property VALUE_FROM_PREVIOUS_RESPONSE
context.testCase.setPropertyValue('VALUE_FROM_PREVIOUS_RESPONSE', sValue)

In the next test step request, use the above property where ever you need above response value of previous step. That is known as property expansion.

Say, <yourXmlElement>${#TestCase#VALUE_FROM_PREVIOUS_RESPONSE}</yourXmlElement>

Hope this helps.



Source link https://sqa.stackexchange.com/questions/20190/---in-soapui-

LEAVE A REPLY

Please enter your comment!
Please enter your name here