dotnet-test - Man Page
.NET test driver used to execute unit tests.
Examples (TL;DR)
- Execute tests for a .NET project/solution in the current directory:
dotnet test - Execute tests for a .NET project/solution in a specific location:
dotnet test path/to/project_or_solution - Execute tests matching the given filter expression:
dotnet test --filter Name~TestMethod1
dotnet test
This article applies to: ✔️ .NET 6 SDK and later versions
Description
The dotnet test command builds the solution and runs the tests with either VSTest or Microsoft Testing Platform (MTP). The test runner you use determines the available command-line options and behavior.
Test runner selection is available starting with .NET 10 SDK. In earlier versions of .NET, tests are always executed with VSTest.
Choosing a test runner
To enable Microsoft.Testing.Platform (MTP), you need to specify the test runner in the global.json file:
{
"test": {
"runner": "Microsoft.Testing.Platform"
}
}VSTest is a valid value for test runner. It is the current default and can be omitted.
The dotnet test experience for MTP is only supported in Microsoft.Testing.Platform version 1.7 and later.
Test runner documentation
The available command-line options, behavior, and capabilities differ depending on which test runner you use:
- dotnet test with VSTest - The traditional test platform, available in .NET 6 SDK and later. This is the default and only test runner in versions earlier than .NET 10 SDK. Provides comprehensive test discovery, filtering, and result reporting capabilities.
dotnet test with MTP - The modern testing platform, available in .NET 10 SDK and later. Offers faster test execution and more flexible test module selection.
[!TIP] For conceptual documentation about
dotnet test, see Testing with dotnet test.
See Also
- Testing with dotnet test
- dotnet test with VSTest
- dotnet test with MTP
- Frameworks and Targets
- .NET Runtime Identifier (RID) catalog