
Sign up to save your podcasts
Or


The dotnet test command is part of the .NET CLI and is used to run tests in a given solution. It supports multiple test frameworks, including MSTest, xUnit, NUnit and TUnit. The command recognizes two main test platforms: VSTest and Microsoft.Testing.Platform (MTP). Any test framework built on top of either VSTest or MTP is automatically supported. The command builds the solution and executes the tests, providing detailed results and diagnostics.
In this blog post, we’ll explore the significant improvements to dotnet test in .NET 10 through Microsoft.Testing.Platform integration. We will cover:
Whether you’re looking to improve your testing workflow’s performance or access advanced features, this guide will help you leverage the full potential of the new dotnet test experience.
Microsoft.Testing.Platform (MTP) is a lightweight and portable alternative to VSTest for running tests in all contexts, including continuous integration (CI) pipelines, CLI, Visual Studio Test Explorer, and VS Code Text Explorer. The Microsoft.Testing.Platform is embedded directly in your test projects, and there’s no other app dependencies.
For the latest updates on Microsoft.Testing.Platform adoption, see our recent post.
To learn more about MTP vs VSTest, see Microsoft.Testing.Platform and VSTest comparison.
The integration of Microsoft.Testing.Platform with dotnet test has undergone significant improvements from .NET 9 to .NET 10. Understanding this evolution helps explain why the current approach delivers better performance and enhanced developer experience.
In .NET 9, Microsoft.Testing.Platform could be used with dotnet test through VSTest mode. This required:
While functional, this approach had several limitations that prompted improvements in .NET 10. For detailed information, see Use Microsoft.Testing.Platform in the VSTest mode of dotnet test.
.NET 10 introduces native integration with Microsoft.Testing.Platform. To enable it, create a dotnet.config file at your solution or repository root.
Configuration Scope
The dotnet.config file must be placed at the solution or repository level. Global configuration at the user or machine level is currently not supported.This configuration eliminates the need for complex command-line arguments and provides seamless integration with the .NET SDK.
Migration Path
The new approach simplifies test execution while providing better performance and diagnostics compared to the VSTest integration method.Here’s a breakdown of the key benefits of using the Microsoft.Testing.Platform (MTP) with dotnet test over the VSTest integration:
Unified Test Execution
MTP is designed to be the future of test execution in .NET. It integrates more tightly with the .NET SDK and dotnet test, offering a more consistent experience.
Better Performance
MTP is optimized for performance, especially in large test suites. It reduces start times and improves test discovery and execution speed.
Improved Diagnostics and Logging
MTP provides richer diagnostics, including better structured logs. This makes it easier to troubleshoot flaky tests or performance issues.
Parallel Test Execution
Execution of assemblies from different TFMs is supported with MTP, which is crucial for scaling test runs in CI pipelines.
Dynamic Arguments
The test-related arguments are no longer fixed, as they are tied to the registered extensions in the test project(s).
Globbing Filter
It allows for flexible and efficient test selection by using patterns to include or exclude specific test assemblies, simplifying configuration and improving usability.
Improved UI/UX
The output is nicely formatted with the usage of ANSI terminal.
To learn more about MTP and its foundational principles, see Microsoft.Testing.Platform.
Watch this demonstration of the enhanced dotnet test experience with Microsoft.Testing.Platform (MTP), showcasing how MTP’s native integration delivers performance gains, improved output formatting, and new command-line options in action:
All-or-Nothing Requirement
This means you need to migrate all test projects in your solution to MTP before enabling the dotnet.config setting. You cannot run a mixed environment where some projects use VSTest and others use MTP.
With native MTP integration in .NET 10, several MSBuild properties from the previous approach are no longer needed and can be safely removed from your test projects:
Clean Up Tip
With Microsoft.Testing.Platform integration, dotnet test provides enhanced flexibility in how you target and execute tests. The following sections cover the various options available to customize your testing workflow, from basic execution to advanced filtering and configuration.
To run the tests in the project or solution in the current directory
Breaking Change
With MTP integration, you must use specific options to target projects, solutions, or directories. This change provides more deterministic behavior and clearer command semantics.
To specify the path of the project file to run (folder name or full path). If not specified, it defaults to the current directory.
To specify the path of the solution file to run (folder name or full path). If not specified, it defaults to the current directory.
The --test-modules option provides powerful globbing pattern support for targeting specific test assemblies. This is particularly useful when you need to run tests from pre-built assemblies or when working with complex solution structures where you want precise control over which test modules execute.
To run tests for specific assemblies
To run tests for assemblies with a specific root directory
This approach is ideal for scenarios where you have already compiled test assemblies and want to execute them directly without going through the build process, providing the same flexibility locally that was previously only available through Azure DevOps task.
Mutually Exclusive Options
When using –test-modules, build options (like –configuration or –framework) are not available since they don’t apply to pre-built assemblies.
It specifies the maximum number of test modules that can run in parallel.
We use the ANSI terminal, so when running dotnet test, the progress will be displayed as follows
To disable outputting ANSI escape characters to screen.
To disable reporting progress to screen.
To specify the output verbosity when reporting tests. Valid values are Normal and Detailed. The default is Normal.
Those extra arguments are passed to the test application(s). Use a space to separate multiple arguments. For more information and examples on what to pass, see Microsoft.Testing.Platform overview and Microsoft.Testing.Platform extensions.
The following traditional dotnet test options remain available with the new version:
These options provide the same build and runtime control as before:
Incompatible Solution Options
MSBuild property support continues to work as before with MTP integration. You can pass one or more MSBuild properties using both short and long forms
The same applies for /property:property=value and its short form is /p.
The evolution of dotnet test with Microsoft.Testing.Platform represents a significant step forward in .NET testing capabilities. By moving from VSTest integration approach in .NET 9 to the MTP integration in .NET 10, developers now enjoy:
Get Started Today
For a detailed documentation on the new dotnet test, see dotnet test.
We encourage you to try out these new capabilities and share your experience with the community. Your feedback helps us continue improving the .NET testing ecosystem. Please share your thoughts, report issues, or start discussions on the .NET SDK repository.
The post Enhance your CLI testing workflow with the new dotnet test appeared first on .NET Blog.
By The dotnet test command is part of the .NET CLI and is used to run tests in a given solution. It supports multiple test frameworks, including MSTest, xUnit, NUnit and TUnit. The command recognizes two main test platforms: VSTest and Microsoft.Testing.Platform (MTP). Any test framework built on top of either VSTest or MTP is automatically supported. The command builds the solution and executes the tests, providing detailed results and diagnostics.
In this blog post, we’ll explore the significant improvements to dotnet test in .NET 10 through Microsoft.Testing.Platform integration. We will cover:
Whether you’re looking to improve your testing workflow’s performance or access advanced features, this guide will help you leverage the full potential of the new dotnet test experience.
Microsoft.Testing.Platform (MTP) is a lightweight and portable alternative to VSTest for running tests in all contexts, including continuous integration (CI) pipelines, CLI, Visual Studio Test Explorer, and VS Code Text Explorer. The Microsoft.Testing.Platform is embedded directly in your test projects, and there’s no other app dependencies.
For the latest updates on Microsoft.Testing.Platform adoption, see our recent post.
To learn more about MTP vs VSTest, see Microsoft.Testing.Platform and VSTest comparison.
The integration of Microsoft.Testing.Platform with dotnet test has undergone significant improvements from .NET 9 to .NET 10. Understanding this evolution helps explain why the current approach delivers better performance and enhanced developer experience.
In .NET 9, Microsoft.Testing.Platform could be used with dotnet test through VSTest mode. This required:
While functional, this approach had several limitations that prompted improvements in .NET 10. For detailed information, see Use Microsoft.Testing.Platform in the VSTest mode of dotnet test.
.NET 10 introduces native integration with Microsoft.Testing.Platform. To enable it, create a dotnet.config file at your solution or repository root.
Configuration Scope
The dotnet.config file must be placed at the solution or repository level. Global configuration at the user or machine level is currently not supported.This configuration eliminates the need for complex command-line arguments and provides seamless integration with the .NET SDK.
Migration Path
The new approach simplifies test execution while providing better performance and diagnostics compared to the VSTest integration method.Here’s a breakdown of the key benefits of using the Microsoft.Testing.Platform (MTP) with dotnet test over the VSTest integration:
Unified Test Execution
MTP is designed to be the future of test execution in .NET. It integrates more tightly with the .NET SDK and dotnet test, offering a more consistent experience.
Better Performance
MTP is optimized for performance, especially in large test suites. It reduces start times and improves test discovery and execution speed.
Improved Diagnostics and Logging
MTP provides richer diagnostics, including better structured logs. This makes it easier to troubleshoot flaky tests or performance issues.
Parallel Test Execution
Execution of assemblies from different TFMs is supported with MTP, which is crucial for scaling test runs in CI pipelines.
Dynamic Arguments
The test-related arguments are no longer fixed, as they are tied to the registered extensions in the test project(s).
Globbing Filter
It allows for flexible and efficient test selection by using patterns to include or exclude specific test assemblies, simplifying configuration and improving usability.
Improved UI/UX
The output is nicely formatted with the usage of ANSI terminal.
To learn more about MTP and its foundational principles, see Microsoft.Testing.Platform.
Watch this demonstration of the enhanced dotnet test experience with Microsoft.Testing.Platform (MTP), showcasing how MTP’s native integration delivers performance gains, improved output formatting, and new command-line options in action:
All-or-Nothing Requirement
This means you need to migrate all test projects in your solution to MTP before enabling the dotnet.config setting. You cannot run a mixed environment where some projects use VSTest and others use MTP.
With native MTP integration in .NET 10, several MSBuild properties from the previous approach are no longer needed and can be safely removed from your test projects:
Clean Up Tip
With Microsoft.Testing.Platform integration, dotnet test provides enhanced flexibility in how you target and execute tests. The following sections cover the various options available to customize your testing workflow, from basic execution to advanced filtering and configuration.
To run the tests in the project or solution in the current directory
Breaking Change
With MTP integration, you must use specific options to target projects, solutions, or directories. This change provides more deterministic behavior and clearer command semantics.
To specify the path of the project file to run (folder name or full path). If not specified, it defaults to the current directory.
To specify the path of the solution file to run (folder name or full path). If not specified, it defaults to the current directory.
The --test-modules option provides powerful globbing pattern support for targeting specific test assemblies. This is particularly useful when you need to run tests from pre-built assemblies or when working with complex solution structures where you want precise control over which test modules execute.
To run tests for specific assemblies
To run tests for assemblies with a specific root directory
This approach is ideal for scenarios where you have already compiled test assemblies and want to execute them directly without going through the build process, providing the same flexibility locally that was previously only available through Azure DevOps task.
Mutually Exclusive Options
When using –test-modules, build options (like –configuration or –framework) are not available since they don’t apply to pre-built assemblies.
It specifies the maximum number of test modules that can run in parallel.
We use the ANSI terminal, so when running dotnet test, the progress will be displayed as follows
To disable outputting ANSI escape characters to screen.
To disable reporting progress to screen.
To specify the output verbosity when reporting tests. Valid values are Normal and Detailed. The default is Normal.
Those extra arguments are passed to the test application(s). Use a space to separate multiple arguments. For more information and examples on what to pass, see Microsoft.Testing.Platform overview and Microsoft.Testing.Platform extensions.
The following traditional dotnet test options remain available with the new version:
These options provide the same build and runtime control as before:
Incompatible Solution Options
MSBuild property support continues to work as before with MTP integration. You can pass one or more MSBuild properties using both short and long forms
The same applies for /property:property=value and its short form is /p.
The evolution of dotnet test with Microsoft.Testing.Platform represents a significant step forward in .NET testing capabilities. By moving from VSTest integration approach in .NET 9 to the MTP integration in .NET 10, developers now enjoy:
Get Started Today
For a detailed documentation on the new dotnet test, see dotnet test.
We encourage you to try out these new capabilities and share your experience with the community. Your feedback helps us continue improving the .NET testing ecosystem. Please share your thoughts, report issues, or start discussions on the .NET SDK repository.
The post Enhance your CLI testing workflow with the new dotnet test appeared first on .NET Blog.