Dotnet Test and Jenkins

How to get dotnet test results collected by Jenkins?

  1. Make dotnet test create logs:

    dotnet test --logger trx

    In console output you should now see messages like:

    Results File: ...\TestResults\a_long_file_name.trx
  2. Make Jenkins collect the results:

    MSTest is the plugin that can consume trx files. Make sure it’s installed.

    Add this line to your Jenkinsfile below your tests execution:

    mstest testResultsFile:"**/*.trx", keepLongStdio: true

Notes ¶

You can run dotnet test on the whole solution. It generates a trx file per test project. The MSTest plugin collects all the files and creates an aggregated report accessible in Jenkins. This method is test-framework agnostic. I tested it with NUnit 3.