Unit Testing XML for Java and .NET

XMLUnit for Java 2.9.1 released on 2023-01-10 and XMLUnit.NET 2.9.2 released on 2023-03-16

About XMLUnit

When testing XML your application creates, simple string comparisons don't cut it as there are many different ways the same XML content is serialized to a string. It doesn't even stop with serialization as sometimes you don't care for the order of XML elements and sometimes you do.

XMLUnit provides you with the tools to verify the XML you emit is the one you want to create. It provides helpers to validate against an XML Schema, assert the values of XPath queries or compare XML documents against expected outcomes.

The most important part is a diff-engine that provides you with full control over what kind of difference is important to you and which part of the generated document to compare with which part of your reference document.

About XMLUnit 2.x

XMLUnit 2.x is developed for Java and .NET.

XMLUnit 2.x is a complete rewrite and is based on the experience of XMLUnit for Java 1.x. It's main goals are:

The code has been split into separate git repositories for Java and .NET, but both share quite a bit of history. The user's guide is available as a github wiki.

XMLUnit for Java 2.9.1 has been released on 2023-01-10 and XMLUnit.NET 2.9.2 has been released on 2023-03-16.

XMLUnit for Java 2.x

XMLUnit for Java also contains a legacy module that provides an API compatible to XMLUnit 1.x on top of the new API. The legacy component is distributed using the same three-clause BSD license XMLUnit 1.x used.

XMLUnit.NET 2.x

XMLUnit.NET doesn't share anything with the old 0.x releases. Snapshot assemblies and nuget packages are available from our AppVeyour builds.

XMLUnit 1.x

XMLUnit for Java 1.x is no longer maintained, the old home has been sourceforge. If you want to report bugs, please use the github issue tracker but most likely things will only get fixed in the legacy mdule of XMLUnit 2.x. Any feature request should go against the 2.x version here.


We need your help!

Some ideas are outlined here. Contributions of tests, documentation and code are more than welcome. Please see our contributing page for details. In short, we like pull requests, please use github's infrastructure for XMLUnit 2.x.

The future of XMLUnit is discussed on the xmlunit-general mailing list hosted at Sourceforge