#cargo-test #junit #cargo #xml-format #test-output #format-json

app cargo2junit

Converts cargo's json output (from stdin) to JUnit XML (to stdout)

15 releases

0.1.14 Nov 21, 2024
0.1.13 Apr 2, 2023
0.1.12 Jun 14, 2022
0.1.10 Jan 26, 2022
0.1.2 Feb 25, 2019

#54 in Testing

Download history 16673/week @ 2024-08-23 10738/week @ 2024-08-30 12793/week @ 2024-09-06 5603/week @ 2024-09-13 3717/week @ 2024-09-20 15178/week @ 2024-09-27 4061/week @ 2024-10-04 2392/week @ 2024-10-11 2899/week @ 2024-10-18 6334/week @ 2024-10-25 9247/week @ 2024-11-01 3360/week @ 2024-11-08 10720/week @ 2024-11-15 7316/week @ 2024-11-22 7159/week @ 2024-11-29 3477/week @ 2024-12-06

29,100 downloads per month

MIT license

75KB
487 lines

CI

cargo2junit

Converts cargo's json output (from stdin) to JUnit XML (to stdout).

To use, first install:

cargo install cargo2junit

Then, run cargo test either with RUSTC_BOOTSTRAP=1 or with +beta and convert:

RUSTC_BOOTSTRAP=1 cargo test -- -Z unstable-options --format json --report-time | cargo2junit > results.xml

Or, use tee for streaming output to console as the tests run:

RUSTC_BOOTSTRAP=1 cargo test -- -Z unstable-options --format json --report-time | tee results.json
cat results.json | cargo2junit > results.xml

Once you have your XML, publish it (e.g. for Azure Pipelines):

  - task: PublishTestResults@2
    inputs: 
      testResultsFormat: 'JUnit'
      testResultsFiles: 'test_results.xml'
    condition: succeededOrFailed()

Dependencies

~1.8–2.8MB
~57K SLoC