jjaspe
8 years agoNew Contributor
JsonPath RegEx Match
I'm trying to assert that an JSON HttpResponse has the following string in it :
"TotalNumberOfResults": 1
but the one could be any number except 0.
I tried using JsonPath RegEx Match but when I type in the Regex it doesn't get saved, so it always passes.
I also tried doing a regular Contains assertion, with this Regex
"TotalNumberOfResults": [1-9]\d*
and that didn't work either. I know the expression is right because i tried it on RegExr.com with the exact output of the HTTP response and it gets a match.
I also tried doing a JsonPath Match assertion with $['TotalNumberOfResults']>0 in the expression and "true" in the expected result, didn't work either.
Any help would be appreciated. Thanks in advance.