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.

Ignore differences options in diff tool

Parasofttoudaya
Parasofttoudaya Posts: 232 ✭✭

Hi Team,

There is a situation where diff source will not have an element and my target has. I ignored the xpath of the additional text in target.

I am still getting error on that source with parent node of the additional Text. Any suggestion would be appreciable

Note:Also i would like to understand the options of insert/modify, there is no change in selecting those options.

Tagged:

Comments

  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭

    I would generally avoid trying to manually construct ignored XPaths. It is way too easy to make a mistake or a typo. Have you tried letting SOAtest add the ignored difference automatically? I recently described how to do this: Ignore namespaces in diff

  • Parasofttoudaya
    Parasofttoudaya Posts: 232 ✭✭

    I have configured the left hand side is my source and right hand side is target. In my target Additional text is coming up and because of that all other source is failing.

    is that delete represents that additional text will removed for comparison.

  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭

    I have configured the left hand side is my source and right hand side is target.

    Concerning left vs right, when you double click a difference shown under quality tasks, SOAtest happens to show the "Expected Content" on the left and the "Actual Content" on the right. However, left vs right is really arbitrary. To clarify, the expected XML is the document configured in the Diff tool under Regression Control and the actual XML is the document under test that is passed as input to the Diff tool.

    Additional text is coming up and because of that all other source is failing.

    It is difficult to say what you might have misconfigured without having more detail. However, as a guess, if you are saying element "/Response/key" has text inserted then you would use "/Response/key" as your XPath and select the boxes for "Text Content" and "Insert". However, I don't recommend setting that up manually. If you right-click the error message in the Quality Tasks view and select Ignore XPath then SOAtest will set this up automatically.

    is that delete represents that additional text will removed for comparison.

    Adding an ignored difference does not remove text or otherwise alter the actual document before being compared against the expected document. When the two documents are compared, a list of differences is generated. Next, each difference in that list is compared against the list of Ignored Differences. Only those differences that do not match any of the Ignored Differences are reported to the Quality Tasks view. For example, if nothing else changes, adding a new ignored difference does not modify any of the other differences or cause new ones to show up.

  • Parasofttoudaya
    Parasofttoudaya Posts: 232 ✭✭
    edited January 2019

    Thanks Ben, now i am able to understand the options that you explained.

    But here i get another problem, my left hand side and right side of json having the same content. On creating order, order updatedtime for each order varies.

    I wanted to ignore orderID in all the orders. Whereas, json comparision is expected to add for each array 0,1,2,3.

    Note: There is an option to add manually without specifying array but that doesn't works.

    is there any way to over come this?

    Regards
    Udaya

  • jakubiak
    jakubiak Posts: 795 admin

    You are running into a limitation in the JSON diff engine. The easiest way to get around this is to use the XML Converter Tool to convert the JSON to XML. Add a Diff Tool to the XML Converter Tool, setting the regression control to the XML converted from JSON. Then when using XML Diff, you will have the ability to ignore orderID in all items at once.

  • Parasofttoudaya
    Parasofttoudaya Posts: 232 ✭✭

    Thanks @jakubiak
    Instead of [0].orderId there was an option to select only the element "orderId", we thought selecting element alone witout array index works for all the array item.

    We have already taken the work around of this xml conversion option.

  • Parasofttoudaya
    Parasofttoudaya Posts: 232 ✭✭

    Adding an info:
    root/item[].element wont work, rather we are supposed to use root/item/element