JUnit support

cargo-nextest can produce output in the JUnit/XUnit XML format. This format is widely understood by test analysis tools and libraries.

To enable JUnit support, add this to your configuration:

  1. [profile.ci.junit] # this can be some other profile, too
  2. path = "junit.xml"

If --profile ci is selected on the command line, a JUnit report will be written out to target/nextest/ci/junit.xml within the workspace root.

Some notes about the JUnit support:

  • There are several slightly different formats all called “JUnit” or “XUnit”. cargo-nextest adheres to the Jenkins XML format.
  • Every test binary forms a single <testsuite>. Every test forms a single <testcase>.
  • Standard output and standard error are included for failed and retried tests. (However, invalid XML characters are stripped out.)

Post-processing

Some tools that read JUnit files don’t follow the Jenkins standard. You can post-process the JUnit file in such cases. Here’s some recommendations for post-processing tools written by community members:

Example

Here’s an example JUnit file generated by cargo-nextest.

  1. {{#include ../../../fixtures/nextest-tests-junit.xml}}