#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

new 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

#136 in Testing

Download history 3882/week @ 2024-08-01 2496/week @ 2024-08-08 2322/week @ 2024-08-15 13445/week @ 2024-08-22 11358/week @ 2024-08-29 14285/week @ 2024-09-05 6773/week @ 2024-09-12 3627/week @ 2024-09-19 13758/week @ 2024-09-26 5482/week @ 2024-10-03 2396/week @ 2024-10-10 2865/week @ 2024-10-17 5670/week @ 2024-10-24 9260/week @ 2024-10-31 4060/week @ 2024-11-07 7511/week @ 2024-11-14

27,034 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

~3.5MB
~77K SLoC