Using XMLUnit2 to compare two xml files using groovy in soapui, it's comparing two files successfully.Would like to print all differences what it finds, but it just printing only first difference. XMLUnit1 supposes to print all differences, but would like to use XMLUnit2.
If any one have any idea, how to print please help me, It would be appreciated.
Code Using:
diff = DiffBuilder.compare(resxml1)
.withTest( resxml2)
.withNodeFilter(nodeFilter)
.withAttributeFilter(attributeFilter)
.ignoreComments()
.ignoreWhitespace()
.ignoreElementContentWhitespace()
.checkForSimilar()
.withNodeMatcher(new DefaultNodeMatcher(new ByNameAndTextRecSelector(), ElementSelectors.byName))
.build();
print diff
The
Diffobject you get as a result of the comparison contains all differences and you can access them withdiff.getDifferences(). ThetoStringmethod ofDiffthat you invoke when youprintit only prints the first difference.So if you want to print all differences you'd do something like
For more control over the output take a look at
ComparisonFomatterandDifference's one-argtoStringmethod.