Forum Discussion

smadji's avatar
smadji
Contributor
11 years ago

adding xpath to a not-contain assertion

I am trying to validate my pagination options. For that I need to assert that a unique ID from one page is NOT on the next page.
I have a request for page 1 and a request for page 2.
I am trying to assert that the second page does not contain a unique ID from the first page. But the not-contain assertion is looking for text within it and I am trying to use a dynamic operator (like xpath) where the unique number will change when I run the steps in sequence.
Any easy solution for that?

2 Replies

  • SiKing's avatar
    SiKing
    Community Expert
    Use XPath assertion, something like
    contains(//*:your/xpath[text()='${page 1#Response#//*:first/value/text()}'])
    should be false.
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    I suggest you save the unique ID from page one as a TestCase property. You can do this with a Groovy TestStep where you retrieve the unique ID from page one and set it as shown in this tip: http://www.soapui.org/Scripting-Properties/tips-a-tricks.html#1-1-get-and-set-properties
    Then add an XPath Match assertion to the request to your second page (see the attached screenshot), that uses the Testcase property for comparison.

    Edit:
    You can use contains as well as SiKing suggested.

    Regards,

    Giscard
    SmartBear Support