This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can trysigning in orchanging directories.
Access to this page requires authorization. You can trychanging directories.
This article applies to: ✔️ .NET 6 SDK and later versions
dotnet test - .NET test driver used to execute unit tests.
Thedotnet 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.
Note
Test runner selection is available starting with .NET 10 SDK. In earlier versions of .NET, tests are always executed with VSTest.
To enable Microsoft.Testing.Platform, you need to specify the test runner in theglobal.json file:
{ "test": { "runner": "Microsoft.Testing.Platform" }}Note
VSTest is a valid value for test runner. It is the current default and can be omitted.
Important
Thedotnet test experience for MTP is only supported inMicrosoft.Testing.Platform version 1.7 and later.
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 aboutdotnet test, seeTesting with dotnet test.
Was this page helpful?
Need help with this topic?
Want to try using Ask Learn to clarify or guide you through this topic?
Was this page helpful?
Want to try using Ask Learn to clarify or guide you through this topic?