Expand description
Create JUnit compatible XML reports.
§Example
use junit_report::{datetime, Duration, ReportBuilder, TestCase, TestCaseBuilder, TestSuiteBuilder};
let timestamp = datetime!(1970-01-01 01:01 UTC);
let test_success = TestCase::success("good test", Duration::seconds(15));
let test_error = TestCase::error(
"error test",
Duration::seconds(5),
"git error",
"unable to fetch",
);
let test_failure = TestCaseBuilder::failure(
"failure test",
Duration::seconds(10),
"assert_eq",
"not equal",
).set_classname("classname").set_filepath("./foo.rs")
.build();
let ts1 = TestSuiteBuilder::new("ts1").set_timestamp(timestamp).build();
let ts2 = TestSuiteBuilder::new("ts2").set_timestamp(timestamp)
.add_testcase(test_success)
.add_testcase(test_error)
.add_testcase(test_failure)
.build();
let r = ReportBuilder::new()
.add_testsuite(ts1)
.add_testsuite(ts2)
.build();
let mut out: Vec<u8> = Vec::new();
r.write_xml(&mut out).unwrap();
Macros§
Structs§
- A span of time with nanosecond precision.
- A
PrimitiveDateTime
with aUtcOffset
. - Root element of a JUnit report
- Builder for JUnit
Report
objects - One single test case
- Builder for
TestCase
objects. - A
TestSuite
groups together severalTestCase
s. - Builder for
TestSuite
objects.
Enums§
- The error type used by this crate.
- Result of a test case