NUnit Test Logger

January 9, 2026 ยท View on GitHub

NUnit xml report extension for MTP v2 and Visual Studio Test Platform. Please use v7.x for MTP v1 runners.

NuGet Downloads

Packages

LoggerStable PackagePre-release Package
NUnitNuGetMyGet Pre Release

If you're looking for xunit or junit, please see https://github.com/spekt/testlogger.

Usage

NUnit logger can generate xml reports in the NUnit v3 format.

  1. Add a reference to the NUnit Logger NuGet package in test project
  2. Use the following command line in tests
> dotnet test --logger:nunit
  1. Test results are generated in the TestResults directory relative to the test.csproj

A path for the report file can be specified as follows:

> dotnet test --logger:"nunit;LogFilePath=test-result.xml"

test-result.xml will be generated in the same directory as test.csproj.

Note: the arguments to --logger should be in quotes since ; is treated as a command delimiter in shell.

Microsoft.Testing.Platform (MTP) Support

The logger also supports Microsoft.Testing.Platform (MTP) with the following command line options:

> dotnet test -- --report-spekt-nunit --report-spekt-nunit-filename test-result.xml

The --report-spekt-nunit option can also accept configuration arguments:

> dotnet test -- --report-spekt-nunit "key1=value1;key2=value2"

Configuration

Available options

Option namePurposeDocumentation
LogFileName*Customize test result file name with {assembly} or {framework} tokensSee config-wiki
LogFilePath*Test result file full pathSee config-wiki
UseRelativeAttachmentPath*Use attachment paths relative to test result file. Boolean. Default: falseSee config-wiki

*All common options to the logger is documented in the wiki. E.g. token expansion for {assembly} or {framework} in result file.

NUnit test framework settings

  • If your scenario requires test case properties like Description in the xml, please enable internal properties for the nunit adapter:

dotnet test --logger:nunit -- NUnit.ShowInternalProperties=true

  • NUnit test adapter also provides a mechanism to emit test result xml from the NUnit engine. You may use following commandline for the same:

dotnet test --logger:nunit -- NUnit.TestOutputXml=<foldername relative to test binary directory>

License

MIT