Skip to content

Commit 0b599c2

Browse files
authored
add unit testing to toc (#45595)
1 parent c730ff0 commit 0b599c2

File tree

3 files changed

+20
-17
lines changed

3 files changed

+20
-17
lines changed

.github/workflows/cleanrepo-redirect-hops.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
with:
3131
function: "RemoveRedirectHops"
3232
docfx_directory: "."
33-
target_directory: "docs"
33+
target_directory: "."
3434
url_base_path: "/dotnet"
3535

3636
# Create the PR for the work done by the "clean repo" tool

docs/core/testing/unit-testing-with-dotnet-test.md

+17-16
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
---
2-
title: Testing with dotnet test
3-
description: Learn more about how dotnet test works and its support for VSTest and Microsoft.Testing.Platform (MTP)
2+
title: Testing with 'dotnet test'
3+
description: Learn more about how 'dotnet test' works and its support for VSTest and Microsoft.Testing.Platform (MTP)
44
author: Youssef1313
55
ms.author: ygerges
66
ms.date: 03/26/2025
77
---
88

9-
# Testing with dotnet test
9+
# Testing with 'dotnet test'
1010

11-
This article will provide you with insights into the `dotnet test` CLI command, its history, and its compatibility with both VSTest and Microsoft.Testing.Platform (MTP).
11+
This article provides insights into the `dotnet test` CLI command, including its history compatibility with both VSTest and Microsoft.Testing.Platform (MTP).
1212

1313
The `dotnet test` command operates in two primary modes:
1414

15-
- VSTest mode: This is the default mode for `dotnet test` and was the only mode available before the .NET 10 SDK. It is primarily designed for VSTest but can also run Microsoft.Testing.Platform test via [Microsoft.Testing.Platform.MSBuild](https://www.nuget.org/packages/Microsoft.Testing.Platform.MSBuild/) NuGet package.
16-
- Microsoft.Testing.Platform mode: Introduced with the .NET 10 SDK, this mode exclusively supports test applications built with Microsoft.Testing.Platform.
15+
- *VSTest* mode: This is the default mode for `dotnet test` and was the only mode available before the .NET 10 SDK. It is primarily designed for VSTest but can also run Microsoft.Testing.Platform test via [Microsoft.Testing.Platform.MSBuild](https://www.nuget.org/packages/Microsoft.Testing.Platform.MSBuild/) NuGet package.
16+
- *Microsoft.Testing.Platform* mode: Introduced with the .NET 10 SDK, this mode exclusively supports test applications built with Microsoft.Testing.Platform.
1717

1818
> [!TIP]
1919
> For CLI reference, see [dotnet test](../tools/dotnet-test.md).
2020
2121
## VSTest mode of `dotnet test`
2222

23-
For an extended period, VSTest has been the only test platform in .NET. Consequently, dotnet test was exclusively designed for VSTest, with all command-line options tailored to VSTest.
23+
For a long time, VSTest was the only test platform in .NET. Consequently, `dotnet test` was exclusively designed for VSTest, with all command-line options tailored to VSTest.
2424

25-
The process involves invoking the `VSTest` MSBuild target, which triggers other internal targets to run and ultimately runs vstest.console. This translates all `dotnet test` command-line options to their equivalents in vstest.console.
25+
The process involves invoking the `VSTest` MSBuild target, which triggers other internal targets to run and ultimately runs vstest.console. All `dotnet test` command-line options are translated to their equivalents in vstest.console.
2626

27-
### Running MTP projects with VSTest mode
27+
### Run MTP projects with VSTest mode
2828

2929
`dotnet test` is typically designed to run VSTest projects in VSTest mode, as that was its original purpose. However, to run MTP projects in `dotnet test` VSTest mode, you can use the [Microsoft.Testing.Platform.MSBuild](https://www.nuget.org/packages/Microsoft.Testing.Platform.MSBuild). From the user's perspective, this support is enabled by setting the `TestingPlatformDotnetTestSupport` MSBuild property to true (it is false by default for backward compatibility reasons). In simple terms, setting this property to true will cause Microsoft.Testing.Platform.MSBuild to change the `VSTest` target behavior, redirecting it to call `InvokeTestingPlatform`. This is an MSBuild target included in Microsoft.Testing.Platform.MSBuild, responsible for correctly running MTP test applications as executables. This means that VSTest-specific command-line options are silently ignored in this mode, such as `--logger`. This implies that there should be a way to pass MTP-specific command-line options, such as `--report-trx`, which is equivalent to using `--logger trx` in VSTest. Given the current limitations of the `dotnet test` CLI, the only way to include MTP-specific arguments is by appending them after an additional `--`. For instance, `dotnet test -- --report-trx`.
3030

@@ -75,20 +75,21 @@ When running `dotnet test` in VSTest mode, it is recommended to avoid including
7575
7676
This scenario is not officially supported, and you should be aware of the following:
7777
78-
1. VSTest-specific command-line options will only apply to VSTest projects and not to MTP test applications.
79-
2. MTP-specific command-line options provided after `--` will be treated as RunSettings arguments for VSTest projects.
78+
- VSTest-specific command-line options will only apply to VSTest projects and not to MTP test applications.
79+
- MTP-specific command-line options provided after `--` will be treated as RunSettings arguments for VSTest projects.
8080
8181
#### Key takeaways
8282
83-
1. To run MTP test applications in `dotnet test` VSTest mode, you should use `Microsoft.Testing.Platform.MSBuild`, pass MTP-specific command-line options after the extra --, and set `TestingPlatformDotnetTestSupport` to true.
84-
2. VSTest-oriented command-line options are silently ignored.
85-
3. Due to these issues, we have introduced a new `dotnet test` mode specifically designed for MTP. We encourage MTP users to transition from the VSTest `dotnet test` mode to the new mode with the .NET 10 SDK.
83+
- To run MTP test applications in `dotnet test` VSTest mode, you should use `Microsoft.Testing.Platform.MSBuild`, pass MTP-specific command-line options after the extra `--`, and set `TestingPlatformDotnetTestSupport` to `true`.
84+
- VSTest-oriented command-line options are silently ignored.
85+
86+
Due to these issues, .NET has introduced a new `dotnet test` mode specifically designed for MTP. We encourage MTP users to transition from the VSTest `dotnet test` mode to the new mode with the .NET 10 SDK.
8687
8788
## Microsoft.Testing.Platform (MTP) mode of `dotnet test`
8889
89-
To address the issues encountered when running `dotnet test` with MTP in VSTest mode, we introduced a new mode in the .NET 10 SDK that is specifically designed for MTP.
90+
To address the issues encountered when running `dotnet test` with MTP in VSTest mode, .NET introduced a new mode in the .NET 10 SDK that's specifically designed for MTP.
9091
91-
To enable this mode, you should add a `dotnet.config` file to the root of the repository or solution.
92+
To enable this mode, add a `dotnet.config` file to the root of the repository or solution.
9293
9394
```ini
9495
[dotnet.test:runner]

docs/navigate/devops-testing/toc.yml

+2
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ items:
259259
href: ../../core/testing/microsoft-testing-platform-architecture-services.md
260260
- name: VSTest
261261
href: https://github.com/microsoft/vstest
262+
- name: Testing with 'dotnet test'
263+
href: ../../core/testing/unit-testing-with-dotnet-test.md
262264
- name: Run selective unit tests
263265
href: ../../core/testing/selective-unit-tests.md
264266
- name: Order unit tests

0 commit comments

Comments
 (0)