Skip to main content

Xml logger for xunit when test is running with "dotnet test" or "dotnet vstest".

Total Downloads
29.1M
29,142,760
Published
Oct 24, 2026
17d ago

Get Started

dotnet add package XunitXml.TestLogger --version 8.1.0

No framework information available.

README

Xunit Test Logger

Xunit logger extensions for MTP v2 and Visual Studio Test Platform. Please use v7.x for MTP v1 runners.

NuGet Downloads

Packages

Logger Stable Package Pre-release Package
Xunit NuGet MyGet Pre Release

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

Usage

Xunit logger can generate xml reports in the xunit v2 format (https://xunit.net/docs/format-xml-v2).

  1. Add a reference to the Xunit Logger nuget package in test project
  2. Use the following command line in tests
> dotnet test --logger:xunit
  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:"xunit;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-xunit --report-spekt-xunit-filename test_result.xml

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

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

Configuration

Available options
Option name Purpose Documentation
LogFileName* Customize test result file name with {assembly} or {framework} tokens See config-wiki
LogFilePath* Test result file full path See config-wiki
UseRelativeAttachmentPath* Use attachment paths relative to test result file. Boolean. Default: false See config-wiki

*All common options to the logger is documented in the wiki.

License

MIT

Downloads by Version

Depended On By

Find packages that declare this package as a dependency. NuGet does not provide a reverse-dependency endpoint, so candidates are checked on demand.

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

No target framework metadata is available. Confirm compatibility in a representative project before standardising on this package.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.