xUnit.net v3 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.v3.
Because xUnit.net v3 injects code into your test projects to make them executable, you cannot use
a transitive reference to the xunit.v3
(or xunit.v3.core
) package. Every unit
test project must contain a direct package reference to ensure the MSBuild tasks are triggered to
inject the entry point. Similarly, non-unit test projects must not reference xunit.v3
(or xunit.v3.core
) and should instead reference xunit.v3.extensibility.core
to be able to provide extensions to xUnit.net v3.
📎Packages for writing tests | |
---|---|
Packages used by developers who are writing unit tests. | |
xunit.v3 |
This is the package that will most typically be used by unit test authors. It brings in references to xunit.v3.core (which contains the unit testing framework), xunit.analyzers (which contains source code analyzers), and xunit.v3.assert (which contains the class you use to write assertions).
Supports: .NET Framework 4.7.2+, .NET 6+
|
xunit.v3.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
Supports: .NET Standard 2.0+, .NET 6+
|
xunit.v3.core |
This package contains the core types for the test framework (f.e., Referencing this package provides the required infrastructure to be able to write unit tests, including the injection of the entry point that is required to make all v3 test projects stand-alone executables. This package should only be used by unit test authors. If you wish to extend xUnit.net, then you should reference xunit.v3.extensibility.core instead.
Supports: .NET Framework 4.7.2+, .NET 6+
|
xunit.v3.templates |
This package provides templates for
To install this package, run:
Supports: .NET SDK 6+
|
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.
Supports: Roslyn 3.11+ (Visual Studio 2019 16.11+)
|
📎Packages for running tests | |
Packages used by developers who are running unit tests. | |
xunit.v3.runner.console |
This package contains the console test runner. This runner is capable of running .NET Framework and .NET projects from xUnit.net v3, as well as .NET Framework projects from xUnit.net v1 and v2. It can run multiple test projects in parallel. Note: we ship runners targeting multiple versions of .NET Framework, because xUnit.net v1 and v2 projects are loaded into runner process, so the version of .NET Framework that the runner is built against determines the version of .NET Framework that the tests will run against (and more importantly, the features available). We also ship AnyCPU versions as well as versions which are built for 32-bit x86. Since xUnit.net v3 projects are stand-alone executables, they will run with whatever version (and bitness) of .NET or .NET Framework that they were built against regardless of the runner's version.
Supports: .NET Framework 4.7.2+ (v1/v2/v3), .NET 6+ (v3)
|
xunit.v3.runner.msbuild |
This package contains the MSBuild test runner. This runner is capable of running .NET Framework and .NET projects from xUnit.net v3, as well as .NET Framework projects from xUnit.net v1 and v2. It can run multiple test projects in parallel.
For xUnit.net v3 projects, this runner can be used from both
Supports: .NET Framework 4.7.2+ (v1/v2/v3), .NET 6+ (v3)
|
xunit.runner.visualstudio |
This package contains the VSTest test runner. This runner is capable of running .NET Framework and .NET projects from xUnit.net v2/v3, as well as .NET Framework projects from xUnit.net v1. The VSTest framework is used by several 3rd party runner UIs, including:
Supports: .NET Framework 4.7.2+ (v1/v2/v3), .NET 6.0+ (v2/v3)
|
📎Packages for developers extending xUnit.net | |
Packages used by developers who are extending xUnit.net and/or creating unit test runners. | |
xunit.v3.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. For more information on consuming this source-based library, please check the assertion project README.
Supports: .NET Standard 1.1+, C# 6+
|
xunit.v3.extensibility.core |
This package contains This package is referenced by xunit.v3.core. It differs in that it does not include the MSBuild steps required to make the project an executable test project.
Supports: .NET Standard 2.0+
|
xunit.v3.runner.inproc.console |
This package contains the code that provides the command line UI for running xUnit.net v3 projects as stand-alone executables. This includes both the native xUnit.net command line UX as well as the Microsoft Testing Platform command line UX.
Supports: .NET Framework 4.7.2+, .NET 6+
|
xunit.v3.runner.utility |
This package contains The libraries contained here are both backward and forward compatible for all v1, v2, and v3 xUnit.net tests.
Supports: .NET Framework 4.7.2+ (v1/v2/v3), .NET 6+ (v2/v3)
|
📎Packages for shared code | |
Packages that contain types that are shared among packages in other categories. Not typically directly referenced. | |
xunit.v3.common |
This package contains types that are shared between xunit.v3.core and xunit.v3.runner.common.
Supports: .NET Standard 2.0+
|
xunit.v3.runner.common |
This package contains types that are shared between xunit.v3.runner.inproc.console and xunit.v3.runner.utility.
Supports: .NET Standard 2.0+
|
xunit.abstractions |
This package contains common interfaces used by various parts of xUnit.net v2. It is used by xunit.v3.runner.utility to be able to run xUnit.net v2 test projects.
Supports: .NET Framework 3.5+, .NET Standard 1.0+
|