xUnit.net ships with many NuGet packages. This guide helps you understand which NuGet packages you should use in your projects.
If you don't know where to start, try starting with a reference to xunit.
📎Packages for writing tests | |
---|---|
xunit |
This is the package that will most typically be used by unit test authors. It brings in references to xunit.core (which contains the unit testing framework), xunit.analyzers (which contains source code analyzers), and xunit.assert (which contains the class you use to write assertions).
Introduced: 1.7.0
|
xunit.assert |
This package contains the xUnit.net assertion library (i.e., the This is a separate NuGet package, because some developers wish to use the xUnit.net framework and test runners, but with a different assertion library.
If you want to extend the
Introduced: 2.0.0
|
xunit.analyzers |
This package contains the xUnit.net source code analyzers. This library provides code analysis and code fixers for common issues that are encountered both by test authors and extensibility authors. It's based on the .NET Compiler Platform ("Roslyn") analyzers which can provide real-time source code analysis inside IDEs (including Visual Studio and Visual Studio Code), as well as compile-time source code analysis.
Introduced: 2.3.0
|
xunit.core |
This package contains the core types for the test framework (f.e.,
Referencing this package includes
If you wish to use
Introduced: 2.0.0
|
📎Packages for running tests | |
xunit.runner.console |
This package contains the console test runner. This runner is capable of running .NET Framework projects from xUnit.net v1 and v2.
To run .NET Core projects from the command line (with
Introduced: 2.0.0
|
xunit.runner.msbuild |
This package contains the MSBuild test runner. This runner is capable
of running .NET Framework projects from xUnit.net v1 and v2. When
added, it automatically references the
Introduced: 2.0.0
|
xunit.runner.visualstudio |
This package contains the VSTest runner. This runner is capable of running .NET Framework projects from xUnit.net v1 and v2, and .NET Core and UWP projects projects from xUnit.net v2. The VSTest framework is used by several 3rd party runner UIs, including:
Introduced: 2.0.0
|
📎Packages for developers extending xUnit.net | |
xunit.abstractions |
This package is an internal dependency of the test framework,
the platform specific execution DLLs ( You usually won't need to directly reference this package.
Introduced: 2.0.0
|
xunit.assert.source |
This package contains the xUnit.net assertion library (i.e., the When you have multiple unit test libraries in your project, it is common practice to import this package into a "test utility" library where you write all your custom assertions, and then reference that "test utility" library from your unit test projects.
Introduced: 2.0.0
|
xunit.extensibility.core |
This package contains
This package is used by xunit.core. It differs in that it does
not include or copy the platform specific execution DLLs (
Introduced: 2.0.0
|
xunit.extensibility.execution |
This package contains the execution libraries for all Supports
( It differs from the xunit.core package in that it adds a reference to the platform specific execution DLL, rather than simply copying to the project's output folder.
Introduced: 2.0.0
|
xunit.runner.utility |
This package contains the runner utility libraries for all Supports
( The libraries contained here are both backward and forward compatible for all v1 and v2 xUnit.net tests.
Introduced: 2.0.0
|
📎Retired Packages | |
dotnet-xunit |
This package was retired as of 2.4 Beta 2. .NET Core users should use |
xunit.execution | This package was renamed to xunit.extensibility.execution as of 2.0 RC1. |
xunit.extensions |
This package was part of xUnit.net v1, and is no longer shipped as part of xUnit.net. Some of the features of this package were integrated into the xUnit.net core platform, and others were moved to the xUnit.net samples project. For more information, see upgrading xunit.extensions. |
xunit.runner.aspnet | This package was retired as of 2.1 Beta 2. |
xunit.runner.devices | This package was retired as of 2.5.25. |
xunit.runner.dnx | This package was retired as of 2.3. |
xunit.runner.visualstudio.win8 |
This functionality was rolled into xunit.runner.visualstudio. |
xunit.runner.visualstudio.wpa81 |
This functionality was rolled into xunit.runner.visualstudio. |
xunit.runners |
This package was part of xUnit.net v1, and is no longer shipped as part of xUnit.net. It has been replaced with two new packages: xunit.runner.console and xunit.runner.msbuild. |