Edit

Share via


dotnet test

This article applies to: ✔️ .NET 6 SDK and later versions

Name

dotnet test - .NET test driver used to execute unit tests.

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.

Choosing a test runner

To enable Microsoft.Testing.Platform, you need to specify the test runner in the global.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

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. 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