Skip to content

Commit 1d4e0e6

Browse files
Give more context about dotnet test with mtp (#44618)
* Give more context about dotnet test with mtp * Update docs/core/testing/unit-testing-platform-integration-dotnet-test.md --------- Co-authored-by: Bill Wagner <[email protected]>
1 parent b200601 commit 1d4e0e6

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

docs/core/testing/unit-testing-platform-integration-dotnet-test.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This layer runs test through VSTest and integrates with it on VSTest Test Framew
3030

3131
### `dotnet test` - Microsoft.Testing.Platform mode
3232

33-
By default, VSTest is used to run `Microsoft.Testing.Platform` tests. You can enable a full `Microsoft.Testing.Platform` by specifying the `<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>` setting in your project file. This setting disables VSTest and, thanks to the transitive dependency to the [Microsoft.Testing.Platform.MSBuild](https://nuget.org/packages/Microsoft.Testing.Platform.MSBuild) NuGet package, directly runs all `Microsoft.Testing.Platform` empowered test projects in your solution. It works seamlessly if you pass a direct `Microsoft.Testing.Platform` test project.
33+
By default, `dotnet test` is using VSTest behavior to run tests. You can enable support for `Microsoft.Testing.Platform` in `dotnet test` by specifying the `<TestingPlatformDotnetTestSupport>true</TestingPlatformDotnetTestSupport>` setting in your project file.
3434

3535
```xml
3636
<Project Sdk="Microsoft.NET.Sdk">
@@ -56,7 +56,33 @@ By default, VSTest is used to run `Microsoft.Testing.Platform` tests. You can en
5656
</Project>
5757
```
5858

59-
In this mode, you can supply extra parameters that are used to call the testing application in one of the following ways:
59+
> [!NOTE]
60+
> It's highly recommended that you set the `TestingPlatformDotnetTestSupport` property in `Directory.Build.props`. That way, you don't have to add it to every test project file, and you don't risk introducing a new project that doesn't set this property and end up with a solution where some projects are VSTest while others are Microsoft.Testing.Platform, which may not work correctly and is unsupported scenario.
61+
62+
> [!IMPORTANT]
63+
> Despite `TestingPlatformDotnetTestSupport` being set to `true`, most of the command line options defined in [dotnet test](../tools/dotnet-test.md) remain VSTest oriented and don't impact `Microsoft.Testing.Platform` based tests. To supply arguments to `Microsoft.Testing.Platform`, you need to use one of the methods described in [Microsoft.Testing.Platform command line arguments with dotnet test](#microsofttestingplatform-command-line-arguments-with-dotnet-test).
64+
65+
The list below described all `dotnet test` command line options that are supported by `Microsoft.Testing.Platform`:
66+
67+
- `-a|--arch <ARCHITECTURE>`
68+
- `--artifacts-path <ARTIFACTS_DIR>`
69+
- `-c|--configuration <CONFIGURATION>`
70+
- `-f|--framework <FRAMEWORK>`
71+
- `-e|--environment <NAME="VALUE">`
72+
- `--interactive`
73+
- `--no-build`
74+
- `--nologo`
75+
- `--no-restore`
76+
- `-o|--output <OUTPUT_DIRECTORY>`
77+
- `--os <OS>`
78+
- `-r|--runtime <RUNTIME_IDENTIFIER>`
79+
- `-v|--verbosity <LEVEL>`
80+
81+
These arguments are supported because they are linked to the build step and are independent of the testing platform used.
82+
83+
### `Microsoft.Testing.Platform` command line arguments with `dotnet test`
84+
85+
You can supply arguments that are used to call the testing application in one of the following ways:
6086

6187
- Beginning with `Microsoft.Testing.Platform` version 1.4 (included with MSTest version 3.6), you can add options after the double dash `--` on the command line:
6288

0 commit comments

Comments
 (0)