| Crates.io | junit-parser |
| lib.rs | junit-parser |
| version | 1.5.0 |
| created_at | 2020-11-08 21:38:17.382433+00 |
| updated_at | 2025-09-28 13:13:40.737062+00 |
| description | Rust library to parse JUnit XML files |
| homepage | |
| repository | https://github.com/borisfaure/junit-parser |
| max_upload_size | |
| id | 310090 |
| size | 176,168 |
Rust library to parse JUnit XML files
Create a
TestSuites structure from a JUnit XML data read from reader:
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());
serde — Enables derive(serde::{Serialize,Deserialize}) on the Test* structures.
properties_as_hashmap (enabled by default) — Parse the properties element as a hashmap
properties_as_vector (enabled by default) — Parse the properties element as a vector
This project is available under the terms of either the BSD-2-Clause license.