Search code examples
c#.net-5dotnet-cli

How to log dotnet test output in junit format


dotnet test uses trx output by default. I am using trx2junit to convert it to junit, but this complicates CI setup.

Is it possible to output test report in junit format directly from dotnet test?


Solution

    1. Install the NuGet package to your test project:

      <PackageReference Include="JunitXml.TestLogger" Version="3.0.110" />
      
    2. Run the following command to output the test results in JUnit XML format:

      dotnet test --logger:junit
      

    More info here: