Assertion to be added to check a value present in one of the two xpaths

api_testerapi_tester Posts: 22

Hi All,

If I want to add an assertion for a value but it can be present in one of the two xpaths of the response so I was thinking of adding OR assertion of the Compound assertion but it is getting failed.

eg : I want to fetch an amount and the value can be either in buyer tag or seller tag.So I have added value assertion for the xpath having buyer tag and then again another for seller tag then I have added OR assertor and grouped the above value assertion. But the thing is if the amount is present in the buyer tag it will get validated but as we have given OR assertor it will get failed because Seller does not have that amount. So I was thinking of IF ELSE assertor but it is not present. What can be alternative solution ??

NOTE: Both the buyer and seller tags are generated in the response but we need to check if one of the either tags has that amount value mentioned in the Datasource excel .

Comments

  • jakubiakjakubiak Posts: 691 admin

    I configured an assertor using an OR assertor with two value assertions, and it works for me. The assertor passes even if one of the elements has the wrong value or is not present at all. If you still cannot get it to work, perhaps you could contact Parasoft support for help.

  • api_testerapi_tester Posts: 22

    Thanks Jakubiak. I have again created a new .tst and followed the steps of adding assertion, now it is working . :)

Sign In or Register to comment.