Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Validating responses when order of individual elements changes

Skepticalme
Skepticalme 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

  • jakubiak
    jakubiak Posts: 795 admin

    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_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭
    edited July 2018

    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.