I have published a GitHub project:
Problem to solve
Web testers often want to compare 2 text files. The files could be in various format: CSV, JSON, XML, etc.
As minimum requirement, they want to know if 2 texts are completely identical or not.
Additionally they want to see the differences, if any, in human-readable format, such as Markdown.
Testers usually do not require Patching features which many “diff utilities” provides.
I want to perform texts-diff and reporting in Katalon Studio.
Utilize java-diff-utils in Katalon Studio.
How to run the demo
- Download the zip of this project from the Releases page, unzip it, open it with your Katalon Studio.
- In the
<projectDir>/Driversdirectory, you will find
Test Cases/TC1and run it.
- the script will compare 2 xml files
- it will create a diff report in Markdown format, save it into a file
How the report looks like
<projectDir>/out.md will be formated in Markdown like this:
- original: `/Users/username/projectdir/Include/fixtures/doc1.xml` - revised : `/Users/username/projectdir/Include/fixtures/doc2.xml` **DIFFERENT** - inserted rows: 0 - deleted rows : 0 - changed rows : 3 - equal rows: : 5 |line#|original|revised| |-----|--------|-------| |1|<doc>|<doc>| |2|<body>|<body>| |3|*<section>*|**<section id="main">**| |4|<p>Hello, *John!<*/p>|<p>Hello, **Paul!<**/p>| |5||**<p>Have a break!</p>**| |6|</section>|</section>| |7|</body>|</body>| |8|</doc>|</doc>|
I copy & past it here:
- revised :
- inserted rows: 0
- deleted rows : 0
- changed rows : 3
- equal rows: : 5
|4||<p>Hello, John!</p>||<p>Hello, Paul!</p>|
|5||<p>Have a break!</p>|
I think it is readable enough. Of course you can change the Test Case code so that it outputs in any format you like.