Expand description
Library to parse JUnit XML files
§Example
Parsing a JUnit content
use std::io::Cursor;
let xml = r#"
<testsuite tests="3" failures="1">
<testcase classname="foo1" name="ASuccessfulTest"/>
<testcase classname="foo2" name="AnotherSuccessfulTest"/>
<testcase classname="foo3" name="AFailingTest">
<failure type="NotEnoughFoo"> details about failure </failure>
</testcase>
</testsuite>
"#;
let cursor = Cursor::new(xml);
let r = junit_parser::from_reader(cursor);
assert!(r.is_ok());
let t = r.unwrap();
assert_eq!(t.suites.len(), 1);
let ts = &t.suites[0];
assert_eq!(ts.tests, 3);
assert_eq!(ts.failures, 1);
assert_eq!(ts.cases.len(), 3);
assert!(ts.cases[0].status.is_success());
assert!(ts.cases[2].status.is_failure());
§Features
serde
— Enablesderive(serde::{Serialize,Deserialize})
on the Test* structures.properties_as_hashmap
(enabled by default) — Parse theproperties
element as a hashmapproperties_as_vector
(enabled by default) — Parse theproperties
element as a vector
Structs§
- Properties
- Properties associated to a
TestSuite
or aTestCase
- Rerun
OrFlaky - Value from a
<flakyFailure />
,<rerunFailure />
,<flakyError />
,<rerunError />
tag - Test
Case - A test case
- Test
Error - Value from an
<error />
tag - Test
Failure - Value from a
<failure />
tag - Test
Skipped - Value from a
<skipped />
tag - Test
Suite - A test suite, containing test cases
TestCase
- Test
Suites - Struct representing a JUnit report, containing test suites
TestSuite
Enums§
- Error
- Error enumerates all possible errors returned by this library.
- Rerun
OrFlaky Kind - The kind of rerun or flaky test result
- Test
Status - Status of a test case
Functions§
- from_
reader - Creates a
TestSuites
structure from a JUnit XML data read fromreader