Ask a Question

Contain assertion - how can I 'blank out' a part of element text which changes with every response

SOLVED
tester213243
New Contributor

Contain assertion - how can I 'blank out' a part of element text which changes with every response

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. 

For example: 

       <ns1:RandomNumber>234</ns1:RandomNumber>  

Is there I way I can validate if the response contains something like: 
       <ns1:RandomNumber>XXX</ns1:RandomNumber>  

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?

Kind regards

11 REPLIES 11
sonya_m
SmartBear Alumni (Retired)

Thanks everyone for suggestions. 

@tester213243 any updates?


Sonya Mihaljova
Community and Education Specialist

@tester213243 

There is an example in the documentation for the same

https://www.soapui.org/docs/functional-testing/point-and-click-testing/point-and-click-with-xpath.ht...

 

In your case, use xpath assertion with

XPath expression as

matches(//*:RandomNumber, '\d{3}')

And Exprected Result as

true

 

NOTE: ignore namespace from the image below and use your name spaces by clicking on declare.

Selection_113.png



Regards,
Rao.
cancel
Showing results for 
Search instead for 
Did you mean: