trx2junit 2.1.0
dotnet tool install --global trx2junit --version 2.1.0
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local trx2junit --version 2.1.0
#tool dotnet:?package=trx2junit&version=2.1.0
nuke :add-package trx2junit --version 2.1.0
CI | NuGet |
---|---|
trx2junit (.NET Core global tool)
Helper for converting trx-Testresults (dotnet test --logger "trx"
) to a JUnit-based XML file.
Can be used for CI-scenarios, like CircleCi or GitLab, where as test results JUnit is expected.
Usage
trx to junit
When installed as .NET Core Global Tool:
trx2junit {trxFile}
where trxFile is the path to the trx-file.
You can pass more than one trx file, each will create it's own junit xml file.
# handle two files
$ trx2junit a.trx b.trx
Converting 2 trx file(s) to JUnit-xml...
Converting 'a.trx' to 'a.xml'
Converting 'b.trx' to 'b.xml'
done in 0.1234567 seconds. bye.
# for shells that handle wildcard expansion:
$ trx2junit results/*.trx
Converting 1 trx file(s) to JUnit-xml...
Converting 'example.trx' to 'example.xml'
done in 0.1234567 seconds. bye.
If the shell won't handle wildcard expansion, trx2junit
handles the expansion of files in the same directory.
A different location for the JUnit-output can be specified:
# specify different output location
$ trx2junit a.trx --output ../results
# or
$ trx2junit --output results a.trx ../tests/b.trx
Jenkins JUnit
For Jenkins JUnit on the testcase the status-attribute is set. By default 1
is set for success, and 0
for failure.
This can be configured via environment varialbes (note: if omitted, the default values will be used):
Status | Variable | default value |
---|---|---|
success | TRX2JUNIT_JENKINS_TESTCASE_STATUS_SUCCESS |
1 |
failure | TRX2JUNIT_JENKINS_TESTCASE_STATUS_FAILURE |
0 |
skipped | TRX2JUNIT_JENKINS_TESTCASE_STATUS_SKIPPED |
not set |
With 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 <failure>
element.
See this comment for further info.
junit to trx
With option --junit2trx
a conversion from junit to trx can be performed.
If a given xml-file is not a junit-file, a message will be logged to stderr and the exit-code is set to 1
.
A junit-file is considered valid if it either conforms to junit.xsd or jenkins-junit.xsd.
Installation
dotnet tool install -g trx2junit
For CI-scenarios execute before usage:
export PATH="$PATH:/root/.dotnet/tools"
Check also the documentation of your CI-system on how to persist the PATH
between steps, etc.
E.g. in CircleCI you need to run
echo 'export PATH="$PATH:/root/.dotnet/tools"' >> "$BASH_ENV"
Prequisites / Supported SDKs
In order to install this tool a .NET SDK must be present. Supported SDKs are:
- .NET 8.0
- .NET 7.0
- .NET 6.0
Core functionality as standalone package trx2junit.Core
Starting with v2.0.0 it's possible to use the core functionality as standalone package trx2junit.Core
.
The tool (see above) itself is a consumer of that package.
After adding a reference to trx2junit.Core
one can use it in "commandline-mode" like
Worker worker = new();
WorkerOptions options = WorkerOptions.Parse(args);
await worker.RunAsync(options);
or create the WorkerOptions
via the constructor, and pass that instance into RunAsync
of the worker.
Development channel
To get packages from the development channel use a nuget.config
similar to this one:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="gfoidl-public" value="https://pkgs.dev.azure.com/gh-gfoidl/github-Projects/_packaging/gfoidl-public/nuget/v3/index.json" />
</packageSources>
</configuration>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
This package has no dependencies.
Version | Downloads | Last updated |
---|---|---|
2.1.0 | 1,842,596 | 2/20/2024 |
2.0.4 | 2,401,059 | 8/26/2022 |
2.0.3 | 141,533 | 7/9/2022 |
2.0.2 | 2,292 | 7/8/2022 |
2.0.1 | 41,236 | 6/28/2022 |
2.0.0 | 1,733,317 | 12/1/2021 |
1.6.0 | 91,923 | 11/15/2021 |
1.5.0 | 690,409 | 2/28/2021 |
1.4.1 | 57,658 | 2/1/2021 |
1.4.0 | 150,565 | 11/11/2020 |
1.3.2 | 193,438 | 7/16/2020 |
1.3.1 | 155,465 | 6/14/2020 |
1.3.0 | 256,012 | 11/15/2019 |
1.2.6 | 78,259 | 8/26/2019 |
1.2.5 | 51,009 | 6/13/2019 |
1.2.4 | 23,691 | 4/19/2019 |
1.2.3 | 28,158 | 2/20/2019 |
1.2.2 | 12,678 | 12/16/2018 |
1.2.1 | 4,943 | 11/13/2018 |
1.2.0 | 8,529 | 9/14/2018 |
1.1.0 | 1,330 | 9/12/2018 |
1.0.2 | 3,708 | 7/10/2018 |
1.0.1 | 1,689 | 6/1/2018 |
1.0.0 | 1,397 | 5/23/2018 |