-
Notifications
You must be signed in to change notification settings - Fork 8
Comparing XML
The DifferenceEngine is part of the low level API that offers access to all features provided by the library.
With the NodeMatcher you can define which nodes should be compared which each other. Even if the test and control nodes are not in the same order.
For Java see NodeMatcher.
With the DifferenceEvaluator you can re-evaluate the difference of two nodes.
If you want ignore some nodes of you XML or evaluate some nodes with your own
compare methods, a custom DifferenceEvaluator is the right place for it.
For Java see DifferenceEvaluator.
The default ComparisionController will let the DifferenceEngine evaluate all differences between test and control xml.
If the evaluation should stop after the first found difference you must use the ComparisonControllers.StopWhenDifferent instead.
See DiffBuilder.withComparisonController()
For the DifferenceEngine you must register a ComparisonListener to handle differences.
To format a Comparison object to a human readable string you can use the DefaultComparisonFormatter.
For Java see ComparisonFormatter.
The DiffBuilder is part of the fluent builder API built on top of the DifferenceEngine, which may cut short some
of the features in order to be more convenient to use.
The DiffBuilder provides fluent API style way to generate a Diff-Object.
A Diff-Object contains the the control- and test-Source and all discovered Differences.
see DiffBuilder.
The CompareMatcher is part of the high-level API of XmlUnit built on top of the DiffBuilder that strive to
simplify writing unit tests:
assertThat(test, CompareMatcher.isSimilarTo(control));see CompareMatcher.
- Overview
- General Concepts
- Comparing XML
- Validating XML
- Utilities
- Migrating from XMLUnit 1.x to 2.x
- Known Issues