Forum Discussion
HimanshuTayal
Community Hero
mehdihs : You can write custom script assertion i think with pre-available features it is not possible.
mehdihs
5 years agoNew Contributor
if the regex can't match a string in a response, what does it actually do?
- richie5 years agoCommunity HeroHey mehdihs,
I think the contains assertion only works for xpath (xml), not jsonpath (json).
So the regex does work, but only for xml.
Im not sure but i think i remember trying this before and ending up having to use a script assertion instead.
Ta
Rich- appliedMagic4 years agoOccasional Contributor
Hi,
add the following JSONPath Expression:
$.data[?(@.ratu_desc=='Total Canada')].ratu_desc
and the Expected Result should be set to:
[Total Canada]
Then it does not matter where "Total Canada" is found, as long as the structure does not change.
You can read more about this here:
https://support.smartbear.com/readyapi/docs/testing/assertions/reference/property/json-match.html
Related Content
- 7 years ago
Recent Discussions
- 10 hours ago