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.
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:
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
You can generate the reports in html format using the junit report ant task.
the below task will generate the two different views of the html reports in folders junit-frames
and junit-noframes
:
<junitreport todir="reports">
<fileset dir="reports">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="reports/junit-frames" />
<report format="noframes" todir="reports/junit-noframes" />
</junitreport>
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