{"id":18417331,"url":"https://github.com/gfoidl/trx2junit","last_synced_at":"2025-04-07T12:32:21.107Z","repository":{"id":26742151,"uuid":"109673889","full_name":"gfoidl/trx2junit","owner":"gfoidl","description":"Transforms XML from trx-Testresults to JUnit-Testresults / trx to JUnit XML and the other way round","archived":false,"fork":false,"pushed_at":"2024-02-20T11:30:46.000Z","size":404,"stargazers_count":70,"open_issues_count":2,"forks_count":19,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-22T18:41:14.566Z","etag":null,"topics":["ci-scenarios","dotnet-global-tool","junit","junit-xml","junit2trx","trx","trx-testresults","trx2junit","unit-testing","xml"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gfoidl.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["gfoidl"]}},"created_at":"2017-11-06T09:26:53.000Z","updated_at":"2025-03-11T22:58:20.000Z","dependencies_parsed_at":"2024-02-20T12:44:59.760Z","dependency_job_id":null,"html_url":"https://github.com/gfoidl/trx2junit","commit_stats":{"total_commits":107,"total_committers":6,"mean_commits":"17.833333333333332","dds":"0.10280373831775702","last_synced_commit":"401b96578b7f4c008f5decb7b065530ba60e2b3f"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gfoidl%2Ftrx2junit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gfoidl%2Ftrx2junit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gfoidl%2Ftrx2junit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gfoidl%2Ftrx2junit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gfoidl","download_url":"https://codeload.github.com/gfoidl/trx2junit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247653210,"owners_count":20973783,"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":["ci-scenarios","dotnet-global-tool","junit","junit-xml","junit2trx","trx","trx-testresults","trx2junit","unit-testing","xml"],"created_at":"2024-11-06T04:08:58.444Z","updated_at":"2025-04-07T12:32:16.089Z","avatar_url":"https://github.com/gfoidl.png","language":"C#","funding_links":["https://github.com/sponsors/gfoidl"],"categories":[],"sub_categories":[],"readme":"| CI | NuGet |\n| -- | -- |\n| [![Build Status](https://dev.azure.com/gh-gfoidl/github-Projects/_apis/build/status/.NET/trx2junit?branchName=master)](https://dev.azure.com/gh-gfoidl/github-Projects/_build/latest?definitionId=35\u0026branchName=master) | [![NuGet](https://img.shields.io/nuget/v/trx2junit.svg?style=flat-square)](https://www.nuget.org/packages/trx2junit/) |\n\n# trx2junit (.NET Core global tool)\n\nHelper for converting trx-Testresults (`dotnet test --logger \"trx\"`) to a JUnit-based XML file.\n\nCan be used for CI-scenarios, like [CircleCi](https://circleci.com/) or [GitLab](https://docs.gitlab.com/ee/ci/junit_test_reports.html), where as test results JUnit is expected.\n\n## Usage\n\n### trx to junit\n\nWhen installed as [.NET Core Global Tool](https://natemcmaster.com/blog/2018/05/12/dotnet-global-tools/):\n`trx2junit {trxFile}` where _trxFile_ is the path to the trx-file.\n\nYou can pass more than one trx file, each will create it's own junit xml file.\n\n```console\n# handle two files\n$ trx2junit a.trx b.trx\nConverting 2 trx file(s) to JUnit-xml...\nConverting 'a.trx' to 'a.xml'\nConverting 'b.trx' to 'b.xml'\ndone in 0.1234567 seconds. bye.\n\n# for shells that handle wildcard expansion:\n$ trx2junit results/*.trx\nConverting 1 trx file(s) to JUnit-xml...\nConverting 'example.trx' to 'example.xml'\ndone in 0.1234567 seconds. bye.\n```\nIf the shell won't handle wildcard expansion, `trx2junit` handles the expansion of files in the same directory.\n\nA different location for the JUnit-output can be specified:\n\n```console\n# specify different output location\n$ trx2junit a.trx --output ../results\n\n# or\n$ trx2junit --output results a.trx ../tests/b.trx\n```\n\n#### Jenkins JUnit\n\nFor Jenkins JUnit on the testcase the status-attribute is set. By default `1` is set for success, and `0` for failure.\nThis can be configured via environment varialbes (note: if omitted, the default values will be used):\n\n| Status  | Variable                                    | default value |\n|---------|---------------------------------------------|---------------|\n| success | `TRX2JUNIT_JENKINS_TESTCASE_STATUS_SUCCESS` | `1`           |\n| failure | `TRX2JUNIT_JENKINS_TESTCASE_STATUS_FAILURE` | `0`           |\n| skipped | `TRX2JUNIT_JENKINS_TESTCASE_STATUS_SKIPPED` | not set       |\n\nWith environment variable `TRX2JUNIT_JUNIT_ERROR_MESSAGE_IN_CDATA` set, the error message from a failing test will be repeated in the _CDATA_-content of the `\u003cfailure\u003e` element.\nSee [this comment](https://github.com/gfoidl/trx2junit/issues/104#issuecomment-1178852241) for further info.\n\n### junit to trx\n\nWith option `--junit2trx` a conversion from _junit_ to _trx_ can be performed.\n\nIf a given _xml_-file is not a junit-file, a message will be logged to _stderr_ and the exit-code is set to `1`.\nA junit-file is considered valid if it either conforms to [junit.xsd](./schemas/junit.xsd) or [jenkins-junit.xsd](./schemas/jenkins-junit.xsd).\n\n## Installation\n\n```sh\ndotnet tool install -g trx2junit\n```\n\nFor CI-scenarios execute before usage:\n```sh\nexport PATH=\"$PATH:/root/.dotnet/tools\"\n```\nCheck also the documentation of your CI-system on how to persist the `PATH` between steps, etc.\nE.g. in CircleCI you need to run\n```sh\necho 'export PATH=\"$PATH:/root/.dotnet/tools\"' \u003e\u003e \"$BASH_ENV\"\n```\n\n### Prequisites / Supported SDKs\n\nIn order to install this tool a [.NET SDK](https://dotnet.microsoft.com/download/dotnet) must be present. Supported SDKs are:\n* .NET 8.0\n* .NET 7.0\n* .NET 6.0\n\n# Core functionality as standalone package trx2junit.Core\n\nStarting with v2.0.0 it's possible to use the core functionality as standalone package `trx2junit.Core`.  \nThe tool (see above) itself is a consumer of that package.\n\nAfter adding a reference to `trx2junit.Core` one can use it in \"commandline-mode\" like\n```c#\nWorker worker         = new();\nWorkerOptions options = WorkerOptions.Parse(args);\nawait worker.RunAsync(options);\n```\nor create the `WorkerOptions` via the constructor, and pass that instance into `RunAsync` of the worker.\n\n## Development channel\n\nTo get packages from the development channel use a `nuget.config` similar to this one:\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cconfiguration\u003e\n    \u003cpackageSources\u003e\n        \u003cadd key=\"gfoidl-public\" value=\"https://pkgs.dev.azure.com/gh-gfoidl/github-Projects/_packaging/gfoidl-public/nuget/v3/index.json\" /\u003e\n    \u003c/packageSources\u003e\n\u003c/configuration\u003e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgfoidl%2Ftrx2junit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgfoidl%2Ftrx2junit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgfoidl%2Ftrx2junit/lists"}