Ask a Question

Test Complete XML Files comparison

ssv
Occasional Contributor

Test Complete XML Files comparison

I need to compare two XML Files. I cannot use the XML Checkpoint in my project for this comparison.

 

The testing goes like this:

 

I install the necessary software

Create the backup of the settings through an XML File and store it in a different location.

Then i perform the upgrade of the software which gives me an XML file.

Then i need to compare the two xml files and raise an error if there is a problem.

 

1) The problems i have is that, I cannot use the XMLCheckpoint, as the first file XML generated content may vary.

2) The DOM elements are shuffeled, say for example, in the xml before the upgrade, the "verbosity element" was in line10, while in the xml file generated after the upgrade had the "verbosity element" at line 50. How can i compare two XML file where the DOM elements are presented in the different spots.

 

Could someone point me out in the right direction?

1 REPLY 1
tristaanogre
Community Hero

Re: Test Complete XML Files comparison

Consider using the MSXML.DOMDocument object.  This will allow you to create objects that you can load your XML into and then write code to compare node to node.  It's not necessarily a trivial task to do this... it will take some script coding skills.  Start with https://msdn.microsoft.com/en-us/library/ms764730(v=vs.85).aspx to understand the object and what it entails.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: