How to skip a node from JSON assertion

AnshuAnshu Posts: 1

Hi All,

I am having total 15 scenarios in my test and i am using value assertion to check for the correct values in the response but i am facing one problem suppose for first scenario i am having one element in the response and i have added that in my list of assertion bu for the 3rd scenario that element wont come in the response when i am running my test it is getting failed as it is not finding that node in the response traffic.

Is there a way so that i can skip a particular node from the JSON assertion for a particular scenario and for other one it can be ignored?

Comments

  • Thomas MooreThomas Moore Posts: 45 admin

    Hi Anshu,

    The best way I can think of to do this is by using a Conditional Assertion. In my case here, I have a conditional assertion that checks if an element appears in the response with an Occurrence Assertion, and if it does, it then makes the assertion on that value with a Value Assertion.

    I hope this helps!

  • benken_parasoftbenken_parasoft Posts: 348 ✭✭✭

    You may also consider using a Diff tool. This is the simplest way to assert on the entire document but also let you configure any specific differences to ignore.

Sign In or Register to comment.