JUnit-style XML file spec

I found it quite frustrating to find accurate/up-to-date info on the JUnit XML file format. JUnit-style XML files have become the de facto standard format to exchange test results between tools. Almost any automation framework can generate (or convert to) this format. And pretty much any CI service or test management tool that can display/report automation results expects test results in this format.

So it’s quite useful to have a good understanding of this format, especially when generating result files. There are a couple of (outdated) XSD files to describe the format here and there, as well as some (very old) docs. To improve this, I’ve tried to collect & document all the info I know and could find about this format, including all common/typical extensions/uses in modern testing frameworks and tools. I’ve also built some example XML files with different levels of detail.

I hope some here find this useful, especially if you are looking into building a tool that produces or reads test result files:


Very useful reference, I’m interested in modifying our report generator, at the moment it consumes a pytest/nosetest xml output, but it’s supposed to support others in case we do ever move things. I remember having to draft a tool to merge 2 test result files years ago, and finding the guess work frustrating.

We consume/read JUnit XML files ourselves with our Testmo CLI tool. We found that JUnit-style XML files are so universal that they work with pretty much any automation tool and framework, so it’s quite useful even if you move to other platforms or tools in the future.

Very nice!
Once in a while we create our own test tools / automation which run on Jenkins.
To get results consumed by Jenkins its always a bit of hassle to create your own JUnit file.
This are my main sources when I develop such an export:

Jenkins does not read all fields …