How to Verify XML Assertions in ReadAPI where response doesnt always come in Order
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to Verify XML Assertions in ReadAPI where response doesnt always come in Order
Hi,
I have a query regarding assertions. I have to assert some XML Response where my application Returns two error codes. However they always dont come in same order. For e.g. if you see below sometimes the first errror code is returned as 400.1109 or 400.1009.
If I use Assertion like below it Fails some times. How to resolve such assertions in easiest possible way. Do we have something like OR (||) in SoAPUI
declare namespace ns1='http://www.xxx-payments.com/schema/payment';
//ns1:multi-pm[1]/ns1:multi-pm-statuses[1]/ns1:status[1]/@code
<multi-statuses>
<status code="400.1109" description="xxxxxx Please check your input and try again." severity="error"/>
<status code="400.1009" description="yyyyy. Please check your input and try again." severity="error"/>
</multi-statuses>
<multi-statuses>
<status code="400.1009" description="yyyyy. Please check your input and try again." severity="error"/>
<status code="400.1109" description="xxxxxx Please check your input and try again." severity="error"/>
</multi-statuses>
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Add an Assertion TestStep together with grouping
https://www.soapui.org/functional-testing/assertion-teststep.html
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If the order is not significant then you could use the assertion to check the description based on the expected code/s.
The assertion will fail if the code is not found in response or the description is incorrect.
//ns1:status[@code ="400.1009"]/@description
Expected result
yyyyy. Please check your input and try again.
//ns1:status[@code ="400.1109"]/@description
Expected result
xxxxxx Please check your input and try again.
