#cargo-test #junit #testing-cargo #json #xml #convert #output

app cargo2junit

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

14 releases

0.1.13 Apr 2, 2023
0.1.12 Jun 14, 2022
0.1.10 Jan 26, 2022
0.1.9 Oct 8, 2021
0.1.2 Feb 25, 2019

#69 in Testing

Download history 1219/week @ 2023-11-20 1962/week @ 2023-11-27 1321/week @ 2023-12-04 1448/week @ 2023-12-11 1307/week @ 2023-12-18 796/week @ 2023-12-25 1147/week @ 2024-01-01 1387/week @ 2024-01-08 1632/week @ 2024-01-15 1642/week @ 2024-01-22 1801/week @ 2024-01-29 1931/week @ 2024-02-05 1933/week @ 2024-02-12 1882/week @ 2024-02-19 1699/week @ 2024-02-26 1801/week @ 2024-03-04

7,429 downloads per month

MIT license

75KB
510 lines

Build Status

cargo2junit

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

To use, first install:

cargo install cargo2junit

Then, run cargo test and convert:

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

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

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.7MB
~56K SLoC