Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/javiertuya/dotnet-test-split

Splits dotnet test trx files into separate junit xml files like those generated by maven surefire report plugin. The trx files can be generated from MSTest, NUnit or Xunit.
https://github.com/javiertuya/dotnet-test-split

junit mstest nunit reporting split surefire xunit

Last synced: about 4 hours ago
JSON representation

Splits dotnet test trx files into separate junit xml files like those generated by maven surefire report plugin. The trx files can be generated from MSTest, NUnit or Xunit.

Awesome Lists containing this project

README

        

![Status](https://github.com/javiertuya/dotnet-test-split/actions/workflows/test.yml/badge.svg)
[![Nuget](https://img.shields.io/nuget/v/DotnetTestSplit)](https://www.nuget.org/packages/DotnetTestSplit/)

# dotnet-test-split

Splits `dotnet test` trx files into separate junit xml files like those generated by maven surefire report plugin.
The trx files can be generated from MSTest, NUnit or Xunit.

Can be used to generate html reports using some tools like `junitreport` ant task to provide a browsable report of the testcases results
to be exported from your CI environment.

## Usage

From the solution folder, run your tests specifying a trx logger, e.g. given the project MyProject a trx report is generated at the reports folder:

```
dotnet test MyProject/MyProject.csproj --logger "trx;LogFileName=../../reports/mstest-report.trx"
```

Install as a [.Net Core tool](https://docs.microsoft.com/es-es/dotnet/core/tools/dotnet-tool-install):
```
dotnet tool install --global DotnetTestSplit
```

Run the `DotnetTestSplit` tool, passing the trx file as parameter.
The below example will place each junit xml report file at the report folder, one file per test class

```
DotnetTestSplit reports/mstest-report.trx reports
```

## Generating html reports

You can generate the reports in html format using the [junit report ant task](https://ant.apache.org/manual/Tasks/junitreport.html).
the below task will generate the two different views of the html reports in folders `junit-frames` and `junit-noframes`:

```





```

## Publishing html reports from CI

These html reports can be managed by you CI environment:

To publish the html report (with frames) to Jenkins you can include the following statement in your Jenkinsfile:

```
publishHTML([allowMissing: true, alwaysLinkToLastBuild: true, keepAll: false,
reportDir: "reports/junit-frames", reportFiles: 'index.html',
reportName: 'JUnit report with frames'])
```

To create an artifact including the html reports using GitHub Actions, you can include the following step in your workflow:

```
- name: Publish test report files
if: always()
uses: actions/upload-artifact@v2
with:
name: Html test reports
path: |
reports/junit-frames
reports/junit-noframes
```