|
| 1 | +# Convert JUnit XML to CTRF JSON |
| 2 | + |
| 3 | +> Convert JUnit reports to CTRF reports |
| 4 | +
|
| 5 | +⭐ **If you find this project useful, consider giving it a GitHub star** ⭐ |
| 6 | + |
| 7 | +It means a lot to us and helps us grow this open source library. |
| 8 | + |
| 9 | +## We need your help |
| 10 | + |
| 11 | +We believe CTRF can save **a lot** of time for engineers, a single data serialisation report, well structured, community driven and works with any framework. For over 30 years software engineers have used a de facto data serialisation report, you know the one! But we feel it’s time to modernise. |
| 12 | + |
| 13 | +The only way we can grow CTRF is with your help and the support of the software engineering community. |
| 14 | + |
| 15 | +## How can you help? |
| 16 | + |
| 17 | +- Join and build with us! We are looking for [contributors](https://github.com/ctrf-io), get involved in this early stage project. All contributions are welcome. |
| 18 | +- Give this repository a star ⭐⭐⭐⭐⭐⭐ |
| 19 | +- Follow the CTRF [GitHub organisation](https://github.com/ctrf-io) |
| 20 | +- Clap for our [Medium articles](https://medium.com/@ma11hewthomas) (30 times each) 👏 |
| 21 | +- Share, share share! Discord, Reddit, Twitter, LinkedIn, Slack, Teams, whereever! - please share our [libraries](https://github.com/orgs/ctrf-io/repositories), our [homepage](https://www.ctrf.io/), our [Medium articles](https://medium.com/@ma11hewthomas) |
| 22 | +- Maybe even write a blog about us! |
| 23 | +- Try our [tools](https://github.com/orgs/ctrf-io/repositories) |
| 24 | + |
| 25 | +**Thank you so much!!** |
| 26 | + |
| 27 | +## Usage |
| 28 | + |
| 29 | +```sh |
| 30 | +npx junit-to-ctrf /path/to/junit.xml |
| 31 | +``` |
| 32 | + |
| 33 | +## Options |
| 34 | + |
| 35 | +`-o`, `--output` <output>: Output directory and filename for the CTRF report. If not provided, defaults to ctrf/ctrf-report.json. |
| 36 | + |
| 37 | +`-t`, `--tool` <toolName>: Tool name to include in the CTRF report. |
| 38 | + |
| 39 | +`-e`, `--env` <envProperties>: Environment properties to include in the CTRF report. Accepts multiple properties in the format KEY=value. |
| 40 | + |
| 41 | +## Examples |
| 42 | + |
| 43 | +Convert a JUnit XML report to the default CTRF report location (ctrf/ctrf-report.json): |
| 44 | + |
| 45 | +```sh |
| 46 | +npx junit-to-ctrf /path/to/junit.xml |
| 47 | +``` |
| 48 | + |
| 49 | +### Specify Output File |
| 50 | + |
| 51 | +Convert a JUnit XML report to a specified output file: |
| 52 | + |
| 53 | +```sh |
| 54 | +npx junit-to-ctrf /path/to/junit.xml -o /path/to/output/ctrf-report.json |
| 55 | +``` |
| 56 | + |
| 57 | +### Include Tool Name |
| 58 | + |
| 59 | +Convert a JUnit XML report and include a tool name in the CTRF report: |
| 60 | + |
| 61 | +```sh |
| 62 | +npx junit-to-ctrf /path/to/junit.xml -t ExampleTool |
| 63 | +``` |
| 64 | + |
| 65 | +### Include Environment Properties |
| 66 | + |
| 67 | +Convert a JUnit XML report and include environment properties in the CTRF report: |
| 68 | + |
| 69 | +```sh |
| 70 | +npx junit-to-ctrf /path/to/junit.xml -e appName=MyApp buildName=MyBuild |
| 71 | +``` |
| 72 | + |
| 73 | +See [](https://www.ctrf.io/docs/schema/environment) |
| 74 | + |
| 75 | +### Full Command |
| 76 | + |
| 77 | +Combine all options in a single command: |
| 78 | + |
| 79 | +```sh |
| 80 | +npx junit-to-ctrf /path/to/junit.xml -o /path/to/output/ctrf-report.json -t ExampleTool -e appName=MyApp buildName=MyBuild |
| 81 | +``` |
| 82 | + |
| 83 | +## What is CTRF? |
| 84 | + |
| 85 | +CTRF is a universal JSON test report schema that addresses the lack of a standardized format for JSON test reports. |
| 86 | + |
| 87 | +**Consistency Across Tools:** Different testing tools and frameworks often produce reports in varied formats. CTRF ensures a uniform structure, making it easier to understand and compare reports, regardless of the testing tool used. |
| 88 | + |
| 89 | +**Language and Framework Agnostic:** It provides a universal reporting schema that works seamlessly with any programming language and testing framework. |
| 90 | + |
| 91 | +**Facilitates Better Analysis:** With a standardized format, programatically analyzing test outcomes across multiple platforms becomes more straightforward. |
| 92 | + |
| 93 | +## Support Us |
| 94 | + |
| 95 | +If you find this project useful, consider giving it a GitHub star ⭐ It means a lot to us. |
0 commit comments