Add .Net example to Junit test reports
Hello,
I would like to suggest an addition to the Junit reports examples. I had been looking for a way to get test reports from .Net into gitlab and ended up creating a new logger package that integrates directly with vstest based on one that already existed for the Nunit format. I saw a couple other options for accomplishing the same thing by modifying trx reports, but think this is probably a better long term option. Microsoft's docs concerning this are here.
I saw #28798 and think perhaps this can save the effort of adding trx parsing to GitLab.
I have run a few dozen pipelines on a private gitlab instance (CE 11.11.8) across several projects and everything looks good at this point. That said, this is brand new, so I could throw together an public example project or something to show that it works.
Let me know what you think, or if you need clarification on the proposed change.
Proposed addition:
.Net Test
The JunitXML.TestLogger nuget package can generate test reports for .Net Framework and .Net Core applications. The following example expects a solution in the root folder of the repository, with one or more project files in sub-folders. One result file is produced per test project, and each are placed in a new artifacts folder. This example includes optional formatting arguments, which improve the readability of test data in the test widget.
## Source code and documentation are here: https://github.com/spekt/junit.testlogger/
Test:
stage: Test
script:
- 'dotnet test --test-adapter-path:. --logger:"junit;LogFilePath=..\artifacts\{assembly}-test-result.xml;MethodFormat=Class;FailureBodyFormat=Verbose"'
artifacts:
when: always
paths:
- .\artifacts\*test-result.xml
reports:
junit:
- .\artifacts\*test-result.xml