Hello fellow soap users,
I am building a regression test. And the easiest way is ofcourse to make one contain-assertion of the complete response. However, there are elements that change everytime I execute.
Is there I way I can validate if the response contains something like:
With the XXX that 'blank out' that part of the validation. So it only checks the presence of the positions, and not what it actually says there?
Solved! Go to Solution.
There is an example in the documentation for the same
In your case, use xpath assertion with
XPath expression as
And Exprected Result as
NOTE: ignore namespace from the image below and use your name spaces by clicking on declare.
Thanks for the quick reply, appreciate your time.
But how would that work in my example if i want to use the regular expressions?
For example, apparently a dot should match any character or \d should match any digit. But if i do the following it doesn't work:
Can you try <ns1:RandomNumber>[1-9][1-9][1-9]</ns1:RandomNumber> . hope it works
No unfortunately that doesnt work either.
There are many numbers in my response but if i just create a contain-assertion with [1-9] it fails.
Also if i check the box 'Use token as regular expression'.
Instead of contains, use XPath assertion and provide the node, then use regular expression. If you are expecting 3 digits, try like
you can use regular expression .* to check if field is not null
instead of contains assertion use Script assertion it will check the particular node value.
User jsonSlurper to get the node value and assert like below
assert nodeValue != ""
and if you know the random value then assert like
assert nodeValue == expectedValue
@tester213243 : Have you got the chance to test the solutions provided. If solved then please mark as solve as it will help other help seekers