kirankumar_sk
10 years agoOccasional Visitor
How to extract value from response, compare it, write result as pass/fail to csv with Groovy script?
Hi I am using SOAP UI 4.6.0 - I have a webservice (currency converter from webservicex.net) - I have a TestStep with request XML and a Groovy script. - The input values to the Request XML are passed...
- 10 years ago
Coming to the issue, you can do it in multiple ways using assertion.
You can select the type of assertion that you are comfortable with.
Here are the possibles in this case.
- Contains Assertion: You can provide the current expected value in the expected place holder like ${#TestCase#EXP_PROP} (use appropriate variable that you were setting in the ReadNextLine step
- Script Assertion: You can use this if you are comfortable with groovy scripting. Here you will be able to read the response value using
def holder = new XmlHolder( messageExchange.responseContentAsXml ) //use xpath according to your response, and expected property name assert holder["//ns1:RequestId"] == context.testCase.getPropertyValue('EXP_PROP')
- Xpath Assertion: You can this as well using xpath and expected value as
context.testCase.getPropertyValue('EXP_PROP')