{"id":21958944,"url":"https://github.com/bitcoder/junit-processor","last_synced_at":"2025-04-14T03:42:01.520Z","repository":{"id":57156582,"uuid":"447957178","full_name":"bitcoder/junit-processor","owner":"bitcoder","description":"A JUnit XML post-processor","archived":false,"fork":false,"pushed_at":"2023-11-16T16:23:41.000Z","size":556,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T18:18:13.305Z","etag":null,"topics":["junit"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bitcoder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-14T12:17:55.000Z","updated_at":"2024-11-15T07:43:21.000Z","dependencies_parsed_at":"2023-11-16T17:41:40.558Z","dependency_job_id":null,"html_url":"https://github.com/bitcoder/junit-processor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitcoder%2Fjunit-processor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitcoder%2Fjunit-processor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitcoder%2Fjunit-processor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitcoder%2Fjunit-processor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitcoder","download_url":"https://codeload.github.com/bitcoder/junit-processor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248818717,"owners_count":21166468,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["junit"],"created_at":"2024-11-29T09:17:57.699Z","updated_at":"2025-04-14T03:42:01.498Z","avatar_url":"https://github.com/bitcoder.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# junit-processor\n\n[![build workflow](https://github.com//bitcoder/junit-processor/actions/workflows/build.yml/badge.svg)](https://github.com/X/bitcoder/junit-processor/actions/workflows/build.yml)\n[![NPM version](https://img.shields.io/npm/v/junit-processor.svg)](https://www.npmjs.com/package/junit-processor) [![License](https://img.shields.io/github/license/bitcoder/junit-processor.svg)](https://github.com/bitcoder/junit-processor/blob/main/LICENSE)\n[![NPM downloads](https://img.shields.io/npm/dw/junit-processor.svg)](https://www.npmjs.com/package/junit-processor)\n\n\nA JUnit XML post processing utility, for cleaning up, modifying some data on these reports, or even do some other operations on these reports.\nPlease consider this highly experimental :)\n\n\n## Features\n\n- remove `testcase` elements that are marked as skipped, or that have failures or errors\n- updates test counters on parent `testsuite` element, and on root `testsuites` element if present\n- applies patches, to fix/change the JUnit produced by some tools\n- validate JUnit XML report against known schemas (e.g., jenkins, ant)\n\n## Nice-2-have\n\n- update `testcase` elements that match a certain criteria\n\n### Installation\n\n    npm install -g junit-processor\n\nOr just download the repository and include it in your `node_modules` directly.\n\n### Usage\n\n```bash\nUsage: junit-processor [options] \u003cinputJunitXMLfile\u003e\n\nOptions:\n  -V, --version              output the version number\n  -s, --removeSkipped        remove skipped testcases\n  -e, --removeErrors         remove testcases with errors\n  -f, --removeFailures       remove testcases with failures\n  -x, --schema               validate against known schemas\n  -p, --patches \u003clistOfIds\u003e  patches to apply, by their id, delimited by comma; see https://github.com/bitcoder/junit-processor#readme\n  -o, --out \u003coutputfile\u003e     file to output to (default: \"./junit-new.xml\")\n  -d, --debug                print debug information\n  -h, --help                 display help for command\n```\n\n## Patches\n\nAhead please find a list of patches that you can apply. Each patch is identified by an id, which is a number.\n\nExample for applying patch 1 on a JUnit XML file:\n\n    junit-processor -p 1 some_junit_report.xml\n\nExample for applying patch 1 and 3, in that order, on a JUnit XML file:\n\n    junit-processor -p 1,3 some_junit_report.xml\n\n### Patch 1\n\nThis patch fixes the `name` attribute of `testcase` elements of JUnit XML reports produced by Karate DSL, in order to remove the line numbers which may change with time.\nThe purpose of this patch is to make `testcase` elements uniquely identifiable, based on their `name` and `classname` attributes.\n\nFor example,\n\n`\u003ctestcase name=\"[1:9] create and retrieve a cat\" classname=\"[demo/cats/cats] cats end-point\" time=\"0.248\"/\u003e`\n\nbecomes...\n\n`\u003ctestcase name=\"create and retrieve a cat\" classname=\"[demo/cats/cats] cats end-point\" time=\"0.248\"/\u003e`\n\n### Patch 2\n\nThis patch enforces the `classname` attribute of `testcase` elements of JUnit XML reports to be `junit-processor`, even if doesn't exist.\n\nFor example,\n\n`\u003ctestcase name=\"xx\" time=\"0.248\"/\u003e`\n\nbecomes...\n\n`\u003ctestcase name=\"xx\" classname=\"junit-processor\" time=\"0.248\"/\u003e`\n\n\n### Patch 3\n\nThis patch creates one single `failure` element, in case `testcase` elements of JUnit XML contain more than one (such as the ones produced by TestComplete). The `failure` element will have one default `message` and the inner contents correspond to the concatenation of the original `failure` elements.\n\nFor example,\n\n```xml\n    \u003ctestcase name=\"Invoice\" time=\"18\" classname=\"FleetApp\"\u003e\n      \u003cfailure message=\"The property checkpoint failed, because Text does not equal (case-sensitive) \u0026quot;150.0\u0026quot;. See Details for additional information.\"\u003ex1\u003c/failure\u003e\n      \u003cfailure message=\"The test run has stopped because the test item is configured to stop on errors.\"\u003e\u003c/failure\u003e\n    \u003c/testcase\u003e\n```\n\nbecomes...\n\n```xml\n    \u003ctestcase name=\"Invoice\" time=\"18\" classname=\"FleetApp\"\u003e\n      \u003cfailure message=\"multiple failures\"\u003e\n      The property checkpoint failed, because Text does not equal (case-sensitive) \u0026quot;150.0\u0026quot;. See Details for additional information.\n      x1\n      The test run has stopped because the test item is configured to stop on errors\n      \u003c/failure\u003e\n    \u003c/testcase\u003e\n```\n\n### Patch 4\n\nThis patch removes all `testcase` elements, except the ones that have a `property` with `name` \"requirements\" or \"test_key\". These properties are usually provided by the xray-junit-extensions project to provide more info on the tests that Xray Test Management will consume.\n\nFor example, the first `testcase` will be included while the second one won't.\n\n```xml\n    \u003ctestcase name=\"Test login page @CALC-1\" classname=\"specs/tags.spec.mjs:3:1 › Test login page @CALC-1\" time=\"3.767\"\u003e\n        \u003cproperties\u003e\n            \u003cproperty name=\"test_key\" value=\"CALC-2\"\u003e\n            \u003c/property\u003e\n            \u003cproperty name=\"requirements\" value=\"CALC-5\"\u003e\n            \u003c/property\u003e\n        \u003c/properties\u003e\n        \u003csystem-out\u003e\n            \u003c![CDATA[\n        [[ATTACHMENT|test-results/specs-tags-Test-login-page-CALC-1/tmp_screenshot.png]]\n        ]]\u003e\n        \u003c/system-out\u003e\n    \u003c/testcase\u003e\n\n    \u003ctestcase name=\"Invoice\" time=\"18\" classname=\"FleetApp\"\u003e\n    \u003c/testcase\u003e\n```\n\nAfter the patch, it becomes...\n\n```xml\n    \u003ctestcase name=\"Test login page @CALC-1\" classname=\"specs/tags.spec.mjs:3:1 › Test login page @CALC-1\" time=\"3.767\"\u003e\n        \u003cproperties\u003e\n            \u003cproperty name=\"test_key\" value=\"CALC-2\"\u003e\n            \u003c/property\u003e\n            \u003cproperty name=\"requirements\" value=\"CALC-5\"\u003e\n            \u003c/property\u003e\n        \u003c/properties\u003e\n        \u003csystem-out\u003e\n            \u003c![CDATA[\n        [[ATTACHMENT|test-results/specs-tags-Test-login-page-CALC-1/tmp_screenshot.png]]\n        ]]\u003e\n        \u003c/system-out\u003e\n    \u003c/testcase\u003e\n```\n\n## Contributing\n\nFeel free to submit issues and/or PRs! In lieu of a formal style guide,  please follow existing styles.\nPlease check the following commands that may be useful while developing and testing.\n\nLinting/checking for JS syntax:\n\n    npm run lint\n\nRunning tests:\n\n    npm test\n\nChecking code coverage:\n\n    npm run coverage\n\n## Contact\n\nYou can find me on [Twitter](https://twitter.com/darktelecom).\n\n## Acknowledgments\n\nThis work was highly based on previous work from [junit-merge](https://github.com/drazisil/junit-merge)\n\n## LICENSE\n\n[Apache 2.0](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitcoder%2Fjunit-processor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitcoder%2Fjunit-processor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitcoder%2Fjunit-processor/lists"}