Skip to content

wingify/testng-to-ctrf

Repository files navigation

Convert TestNG Results XML to CTRF JSON

License: MIT

Convert TestNG results XML to (CTRF reports)[https://ctrf.io/docs/intro]

This package is useful if there isn't a CTRF reporter available for your test framework.

Acknowledgments & Attribution

This project is a fork of junit-to-ctrf by Matthew Thomas. The TestNG adaptation was developed by Sahil Goyal while maintaining the same high standards and principles of the original project.

For a complete list of third-party libraries and their licenses used in this project, please see our Third Party Attributions file.

Usage

npx testng-to-ctrf path/to/testng-results.xml

Options

-o, --output : Output directory and filename for the CTRF report. If not provided, defaults to ctrf/ctrf-report.json.

-t, --tool : Tool name to include in the CTRF report.

-e, --env : Environment properties to include in the CTRF report. Accepts multiple properties in the format KEY=value.

Examples

Convert a TestNG XML report to the default CTRF report location (ctrf/ctrf-report.json):

npx testng-to-ctrf path/to/testng-results.xml

Specify Output File

Convert a Testng XML report to a specified output file:

npx testng-to-ctrf path/to/testng-results.xml -o path/to/output/ctrf-report.json

Include Tool Name

Convert a Testng XML report and include a tool name in the CTRF report:

npx testng-to-ctrf path/to/testng-results.xml -t ExampleTool

Include Environment Properties

Convert a Testng XML report and include environment properties in the CTRF report:

npx testng-to-ctrf path/to/testng-results.xml -e appName=MyApp buildName=MyBuild

See CTRF schema for possible environment properties

Full Command

Combine all options in a single command:

testng-to-ctrf path/to/testng-results.xml -o path/to/output/ctrf-report.json -t ExampleTool -e appName=MyApp buildName=MyBuild

What is CTRF?

CTRF is a universal JSON test report schema that addresses the lack of a standardized format for JSON test reports.

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.

Language and Framework Agnostic: It provides a universal reporting schema that works seamlessly with any programming language and testing framework.

Facilitates Better Analysis: With a standardized format, programatically analyzing test outcomes across multiple platforms becomes more straightforward.

Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

Development Setup

  1. Clone the repository
  2. Install dependencies: yarn install
  3. Build the project: yarn build

Changelog

v1.0.0

  • Initial release
  • Basic TestNG XML to CTRF JSON conversion
  • Command-line interface with output and environment options

Support

  • Create a GitHub Issue for bug reports and feature requests

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Convert TestNG Results XML to CTRF JSON

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published