Forum Discussion

MR102889's avatar
MR102889
Regular Visitor
3 years ago

How to create an Contains Assertion which validates a specific portion of an XML (Use of wildcards)

Hi there,

 

I have been trying to create a Contains Assertion, and need to validate a specific portion of an XML. For example, say I want to validate:

<data>ThisiswhatIneedtovalidate</data>.

 

The only thing I want to validate is the word "validate". Is there any way to use wildcards to only validate a specific portion of the resulting XML?

 

I was able to figure out how to use wildcards when using XPath Match Assertion (inputting an '*', and then enabling Allow Wildcards), but haven't been able to figure it out for Contains Assertions (tried using an '*', '%', and '.*<input text here>.*'), but nothing worked.

 

Any help would be appreciated.

 

Thanks,

MR102889

1 Reply

  • richie's avatar
    richie
    Community Hero
    Hey MR102889,

    Im on my phone so cant double check, but if memory serves, the 'Contains' assertion uses regex.

    So you just need to use regex to verify the content is correct.

    Cheers,

    Rich