Forum Discussion

HaroldR's avatar
HaroldR
Contributor
8 years ago

Weird behavior of contains assertion using XPATH

Hello everyone,
New to SoapUI, currently I use the demo version[5.3.0] but I have the same issue on Ready API.
First a bit of context, I need to test the evolution of a web service. My test should be OK if any differency is raised from the response of the differents back-end.

To realize it, I have added both wsdl description to my SoapUI project. Both descriptions point respectively to the correct endpoint url I should test. I have created a test suite with two test requests to attack both endpoints with the same request.

The second resquest is retrieved from a get data request of the first one. I must verify if the same request which is adressed to both endpoints returns exactly the same response.

To do so, I have added a contains assertion on the second request test, which should verify if the response is the same from the other one. In the contains field, when I put in parameters :
1) the recovery of a get data response from the first request as ${Operation - Request 1[8.2]#Response                                  


OR

2)brute datas by doing a copy paste of the response of the first one in the contains of the second one
It works well, the contains is valid so the Test is OK

But the issue is when I add an xpath from the get data to compare a particular sequence : ${Operation - Request 1[8.2]#Response#<Some XPATH Present in Response of the other request>
At first the assertion is Valid but even If I modify the XPATH to not match the response from the first request, the contains assertion does not return an INVALID message, it still remains valid whereas It should not be.

Does anyone find this problem weird? Someone had maybe the same issue before?

Could someone resume me how the contains assertion work and to which property it is compared please. Did I miss something up?

Thanks you for all who will give interest to this problem or to give knowledge to my poor background.

    • HaroldR's avatar
      HaroldR
      Contributor

      Hey sanj, thanks you for answering to my question. 
      It's a good way to verify if the xpath expression passed in the get data function works, and it seems that the expression Xpath does not work.

      Do you have any idea of what should I passed in parameters to the get data to match the response of both version?
      The contains expression that I passed is : ${SaveProvidentPolicy - Request 1[8.2]#Response#<some XML code in the response>} What should I passed in the XPATH parameters to verify if "some XML code in the response" is present inside both responses of the backend?


      Harold

      • sanj's avatar
        sanj
        Super Contributor

        HaroldR Ok I can give you a screenshot of how you can use outline view of the response this will add the xpath assertion for you!

        then you can see what may be wrong.

        do Add assertions then select for content.

        This should give you the xpath.