I am writing some Soap UI tests and am trying to figure out if there is a way with regular expressions to check for a string that does not contain a specific number. In this one case I want to make sure that when I get a response that my recordCount field DOES NOT contain 0. I thought this might be easier but while I can see a way to check for a set of numbers the regular expression for not this doesn't seem to work. Probably only detects characters and not numbers.
My XML contains this:
What I want is something like
so I can make sure recordCount shows up in the response, but also check that at least the first number it finds is not a 0. Is there any way to do this?
<strong>Edit:</strong> Using SiKing's answer I just used the NotContains to look for recordCount>0 ; this covers the couple of cases where I don't look for specific data only how many records are returned and in those cases it just needs to be more than 0Answer1:
Why does it have to be regular expression?
You can use either of the following XPath assertions, for all of which the expected result is
//*:recordCount = 0 exists(//*:recordCount[text()='0'])Answer2:
Using regular expressions you could do something like that:
When using regular expressions in an assertion in SoapUI, you have to take whitespace and line breaks into account. In the example code
(?s).* works as a wildcard that includes all whitespace and line breaks.