It is based on quick-xml to parse efficiently the XML files.
It parses all the different JUnit files I encountered and I have added support for some optional attributes.
The API is very simple as can be seen in the example below:
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; assert_eq!(ts.tests, 3); assert_eq!(ts.failures, 1); assert_eq!(ts.cases.len(), 3); assert!(ts.cases.status.is_success()); assert!(ts.cases.status.is_failure());
Junit-Parser is licensed under the BSD 2-Clause license.
After few iterations over the years, I think it is time to release v1.0.0.
The 1.0.0 release brings a better support for JUnit files along with updated dependencies. I have also taken into account some commits from forks on github, like the optional
serde feature to help serialize / deserialize the public types used to represent a JUnit file.
You can find more about it on the following links:
I’ve added Dependabot and a small CI to help me keep it up-to-date.