← Blog

Comparison and ignoring

How Figaf ignore expressions handle empty or missing elements and decimal precision, so automated tests only flag the differences that matter.

July 28, 2020 · 2 min read

One of the challenges in building a good automated testing tool is to be able to compare documents correctly and find the differences that matter. It is pretty simple to set an ignore expression, or as SAP PIT calls it, an exemption.

An ignore expression is an XPath in the case of XML documents. It will then ignore any differences between the two documents found here. You will then be able to focus on the errors that really matter.

For a client project we got some differences that looked like the following. I have just simplified the document.

Figaf expected and actual XML order side by side, highlighting a new empty item, a changed item and qty values with different decimals

As seen there is a new Item field in line no 1 of the document. Then on line 3 there is a difference in the number of decimals. And Line no 4 has a real difference in the quantity.

In many cases a missing element is the same as a blank element. Before, we had just ignored /order/line/item, but that could lead to some big problems as it would not see that item has been changed on line 2.

The number of decimals can sometimes be difficult to control, and they may not be important. So we also have an option to handle it. We can specify how many decimals we want to compare with.

We then end up with the following ignore expressions.

/order/line/qty{%.2f};
/order/line/item{empty-missing}

We then end up with the following differences, as expected. Here we can see that item 2 is different and there is a difference in line 4 qty. If we had used the old approach we would just have ignored the two differences and not seen it as a problem.

Same XML comparison with ignore rules applied: the empty item and the qty decimal difference are greyed out, real differences stay highlighted

This feature is available in the Figaf DevOps Suite.

It is something like this kind of rules that can make it easy or impossible to use an automated testing tool.

start a free trial of the Figaf DevOps Suite to try it out on your own system.

This post covers these products

Capabilities covered

  • Regression testingYou cannot tell what a change broke until someone downstream complains.

More from the blog

All posts →

See this working in your landscape

No credit card required.

Integration cost calculator →

Start your free trial

No credit card required

Try Figaf DevOps Suite free for 30 days. It takes less than an hour to get started, and we send everything you need by email.

Join our newsletter

Get the latest about Figaf, SAP and anything relevant to SAP integration, every week in Figaf Weekly.