13 releases

0.3.5 Oct 27, 2023
0.3.4 Oct 22, 2023
0.3.3 Jul 7, 2023
0.3.2 Nov 23, 2022
0.1.3 Jan 29, 2022

#61 in Encoding

Download history 10744/week @ 2023-10-27 9431/week @ 2023-11-03 9782/week @ 2023-11-10 8634/week @ 2023-11-17 8737/week @ 2023-11-24 11109/week @ 2023-12-01 9744/week @ 2023-12-08 8381/week @ 2023-12-15 5653/week @ 2023-12-22 8086/week @ 2023-12-29 9401/week @ 2024-01-05 14254/week @ 2024-01-12 14670/week @ 2024-01-19 12829/week @ 2024-01-26 16028/week @ 2024-02-02 9751/week @ 2024-02-09

56,996 downloads per month
Used in 10 crates (4 directly)

Apache-2.0 OR MIT

819 lines


quick-junit on crates.io Documentation (latest release) Documentation (main) Changelog License License

quick-junit is a JUnit/XUnit XML data model and serializer for Rust. This crate allows users to create a JUnit report as an XML file. JUnit XML files are widely supported by test tooling.

This crate is built to serve the needs of cargo-nextest.


The root element of a JUnit report is a Report. A Report consists of one or more TestSuite instances. A TestSuite instance consists of one or more TestCases.

The status (success, failure, error, or skipped) of a TestCase is represented by TestCaseStatus.


  • ✅ Serializing JUnit/XUnit to the Jenkins format.
  • ✅ Including test reruns using TestRerun
  • ✅ Including flaky tests
  • ✅ Including standard output and error
  • ✅ Automatically keeping track of success, failure and error counts
  • ✅ Arbitrary properties and extra attributes

This crate does not currently support deserializing JUnit XML. (PRs are welcome!)


use quick_junit::*;

let mut report = Report::new("my-test-run");
let mut test_suite = TestSuite::new("my-test-suite");
let success_case = TestCase::new("success-case", TestCaseStatus::success());
let failure_case = TestCase::new("failure-case", TestCaseStatus::non_success(NonSuccessKind::Failure));
test_suite.add_test_cases([success_case, failure_case]);

const EXPECTED_XML: &str = r#"<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="my-test-run" tests="2" failures="1" errors="0">
    <testsuite name="my-test-suite" tests="2" disabled="0" errors="0" failures="1">
        <testcase name="success-case">
        <testcase name="failure-case">

assert_eq!(report.to_string().unwrap(), EXPECTED_XML);

For a more comprehensive example, including reruns and flaky tests, see fixture_tests.rs.

Minimum supported Rust version (MSRV)

The minimum supported Rust version is Rust 1.70.

While this crate is a pre-release (0.x.x) it may have its MSRV bumped in a patch release. Once a crate has reached 1.x, any MSRV bump will be accompanied with a new minor version.


  • junit-report: Older, more mature project. Doesn't appear to support flaky tests or arbitrary properties as of version 0.7.0.


See the CONTRIBUTING file for how to help out.


This project is available under the terms of either the Apache 2.0 license or the MIT license.


~80K SLoC