Solved
Forum Discussion
Oct21
7 years agoOccasional Contributor
The script provided earlier was also used as a groovy test step, and the script am using now is also as a groovy test step.
You can check the screenshot i sent.
nmrao
7 years agoCommunity Hero
If you read the post again, it clearly says Scipt Assertion (for the same step where you get the response). No additional step. Please correct it and try again.
- Oct217 years agoOccasional Contributor
I tried to use the script as script assertion to the request where i am getting the response. But i am getting the same error.
Not sure what has changed, it is parsing the values but not able to pick the one which is described.
And the past script i used as a groovy script and worked perfectly.
Could please check and help me again. Check the screenshot.
Thanks again.
Regards,
Oct21
- nmrao7 years agoCommunity Hero
Oct21 ,
Here is the new script assertion for the attached xml
assert context.response def getData = { data, element -> new XmlSlurper().parseText(data).'**'.find {it.name() == element} } def receiptId = getData(context.response, 'ReceiptId') log.info receiptId context.testCase.setPropertyValue('ID', receiptId.toString())