Validating responses when order of individual elements changes

SkepticalmeSkepticalme Posts: 1

We need to validate few value in the response for two different id’s.
I have created test which uses XML data bank and extract the values which I want to compare.
I have created another test which uses XML assertor to validate the permission value that was extracted in the first test matches with the value in the second test.

The issue I see here is, the order of these values are not constant. They keep changing for every call made. Is there a way to validate this by ignoring the order?

Answers

  • jakubiakjakubiak Posts: 332 ✭✭✭

    Yes - you can attach an XML Sort tool first, and then attach your XML Data Bank or XML Assertor to the XML Sort tool.

  • benken_parasoftbenken_parasoft Posts: 488 ✭✭✭
    edited July 3

    Also consider using XPaths that are not sensitive to order, not selecting based on index but instead on some other criteria. I recently provided an example in your other post: assertor option when the response tree is changing

    If you are trying to validate everything or nearly everything, please also consider just using the Diff tool which has an option to ignore element order. That is often simpler to use than XML Sort tool plus XML Assertor.

Sign In or Register to comment.