Ask a Question

Using wildcards in Contains Assertion

New Contributor

Using wildcards in Contains Assertion

Hi all


I am brand new to SoapUI and am trying to start with some basic coverage.  The problem I am currently having is I am trying to assert the contents of an XML response but it contains data that varies.  I had hoped I could use a wildcard to ignore the relevant section of the response but I can't see how I can do this.


Here is an example of the content I am trying to assert:

<option id="1" bid="1" rv="2" desc="Standard cover" monthly="£10.00" annual="£120.00">No</option>

<option id="2" bid="1" rv="2" desc="Better cover" monthly="£20.00" annual="£240.00">Yes</option>


The premium is what varies, I need to assert what comes before and after it in a single assert (I need to tie the Yes/No together with the option ID).  Can this be done?


Any help you can provide would be much appreciated.





Super Contributor

Why dont you use regular expressions

You need to check the regular expressions 


Here is another link that has some info



Thanks sanj


It looks like this will be exactly what I need!  


Apologies if this was a bit of a dumb question, I've only worked on automation in C# using selenium up until yesterday which is a bit different.

You can also try XPath Match Assertion with wildcards


e.g. XPath expression //option[@id='1']

expected result with wildcards <option id="1" bid="1" rv="2" desc="Standard cover" monthly="*" annual="*">No</option>


Thanks Paul


This also looks like a good solution.  


I think looking at the way these work that using the Xpath should be simplest way forward as the missing variables are not what I am testing.  Reading up on the RegEx use, it looks like that would be particularly useful if I need to verify the data type that would be in the variable.


So thank you both, you have been a great help.



Showing results for 
Search instead for 
Did you mean: