quick-junit
is a JUnit/XUnit XML serializer for Rust. 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 TestCase
s.
The status (success, failure, error, or skipped) of a TestCase
is represented by TestCaseStatus
.
If a test was rerun, TestCaseStatus
can manage TestRerun
instances as well.
```rust use quick_junit::*;
let mut report = Report::new("my-test-run"); let mut testsuite = TestSuite::new("my-test-suite"); let successcase = TestCase::new("success-case", TestCaseStatus::success()); let failurecase = TestCase::new("failure-case", TestCaseStatus::nonsuccess(NonSuccessKind::Failure)); testsuite.addtestcases([successcase, failurecase]); report.addtestsuite(testsuite);
const EXPECTED_XML: &str = r#"
asserteq!(report.tostring().unwrap(), EXPECTED_XML); ```
For a more comprehensive example, see
fixture_tests.rs
.
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.