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.

Validate REST in XML response format with DB Values

Options
AnuSuresh
AnuSuresh Posts: 5

I have used the XML Assertor to validate the XML response and DB Values. I have used JSON assertor to validate the JSON and DB Values.
For few of the fields in DB has null values and JSON response has empty. For which i have edited the element in configuration with replace(/root/item/element_name/text(),"null","").
But in XML response, for the fields that has null values in DB, the node is not present in XML.
The values are always dynamic. How to achieve this to validate between XML response and DB values?

Comments

  • AnuSuresh
    AnuSuresh Posts: 5
    Options

    Any help is appreciated

  • benken_parasoft
    benken_parasoft Posts: 1,235 ✭✭✭
    edited June 2022
    Options

    I would consider transforming the DB tool's XML output and/or the XML response into a common structure. If both XML documents are structured the same then they can be more easily compared. You can modify documents using a script in an Extension tool or with an XSL in an XSLT tool, for example. In this particular case, it sounds like you either want to strip out the null values from the DB tool output or inject absent values into the XML response.