Skip to content

Commit e78ef00

Browse files
Add first level info for migration off of VSTest (#44620)
* Add first level info for migration off of VSTest * Apply suggestions from code review --------- Co-authored-by: Bill Wagner <[email protected]>
1 parent 1d4e0e6 commit e78ef00

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed

docs/core/testing/unit-testing-platform-vs-vstest.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,79 @@ To disable the use of the new protocol in Test Explorer, you can edit your proje
5252
## Executables
5353

5454
VSTest ships multiple executables, notably `vstest.console.exe`, `testhost.exe`, and `datacollector.exe`. However, MSTest is embedded directly into your test project and doesn't ship any other executables. The executable your test project compiles to is used to host all the testing tools and carry out all the tasks needed to run tests.
55+
56+
## Migrating from VSTest
57+
58+
In addition to the steps specific to your test framework, you need to update your test infrastructure to accommodate to `Microsoft.Testing.Platform`.
59+
60+
### `dotnet test`
61+
62+
Command line options of `dotnet test` are divided into 2 categories: build related arguments and test related ones.
63+
64+
The build related arguments are passed to the `dotnet build` command and as such don't need to be updated for the new platform. Build related arguments are listed below:
65+
66+
- `-a|--arch <ARCHITECTURE>`
67+
- `--artifacts-path <ARTIFACTS_DIR>`
68+
- `-c|--configuration <CONFIGURATION>`
69+
- `-f|--framework <FRAMEWORK>`
70+
- `-e|--environment <NAME="VALUE">`
71+
- `--interactive`
72+
- `--no-build`
73+
- `--nologo`
74+
- `--no-restore`
75+
- `-o|--output <OUTPUT_DIRECTORY>`
76+
- `--os <OS>`
77+
- `-r|--runtime <RUNTIME_IDENTIFIER>`
78+
- `-v|--verbosity <LEVEL>`
79+
80+
The test related arguments are VSTest specific and so need to be transformed to match the new platform. The following table shows the mapping between the VSTest arguments and the new platform:
81+
82+
| VSTest argument | New platform argument |
83+
|-----------------|-----------------------|
84+
| `--test-adapter-path <ADAPTER_PATH>` | Not supported |
85+
| `--blame` | Not supported |
86+
| `--blame-crash` | `--crashdump` requires [Crash dump extension](./unit-testing-platform-extensions-diagnostics.md#crash-dump) |
87+
| `--blame-crash-dump-type <DUMP_TYPE>` | `--crashdump-type` requires [Crash dump extension](./unit-testing-platform-extensions-diagnostics.md#crash-dump) |
88+
| `--blame-crash-collect-always` | Not supported |
89+
| `--blame-hang` | `--hangdump` requires [Hang dump extension](./unit-testing-platform-extensions-diagnostics.md#hang-dump) |
90+
| `--blame-hang-dump-type <DUMP_TYPE>` | `--hangdump-type` requires [Hang dump extension](./unit-testing-platform-extensions-diagnostics.md#hang-dump) |
91+
| `--blame-hang-timeout <TIMESPAN>` | `--hangdump-timeout` requires [Hang dump extension](./unit-testing-platform-extensions-diagnostics.md#hang-dump) |
92+
| `--collect <DATA_COLLECTOR_NAME>` | Depends on the data collector |
93+
| `-d\|--diag <LOG_FILE>` | `--diagnostic` |
94+
| `--filter <EXPRESSION>` | Depends upon the selected test framework |
95+
| `-l\|--logger <LOGGER>` | Depends on the logger |
96+
| `--results-directory <RESULTS_DIR>` | `--results-directory <RESULTS_DIR>` |
97+
| `-s\|--settings <SETTINGS_FILE>` | Depends upon the selected test framework |
98+
| `-t\|--list-tests` | `--list-tests` |
99+
| `-- <RunSettings arguments>` | Not supported |
100+
101+
> [!IMPORTANT]
102+
> Before specifying any `Microsoft.Testing.Platform`, you need to add `--` to separate the `dotnet test` arguments from the new platform arguments.
103+
104+
### `vstest.console.exe`
105+
106+
If you are using `vstest.console.exe` directly, we recommend replacing it with the `dotnet test` command.
107+
108+
### Test Explorer
109+
110+
When using Visual Studio or Visual Studio Code Test Explorer, you might need to enable the support for the new test platform.
111+
112+
#### Visual Studio
113+
114+
Visual Studio Test Explorer supports the new test platform starting with version 17.14. If you are using an earlier version, you might need to update your Visual Studio to the latest version.
115+
116+
#### Visual Studio Code
117+
118+
Visual Studio Code Test Explorer supports the new test platform starting with version X.
119+
120+
### Azure DevOps
121+
122+
When using Azure DevOps tasks, you might need to update your pipeline to use the new test platform.
123+
124+
#### VSTest task
125+
126+
If you are using the [VSTest task](https://learn.microsoft.com/azure/devops/pipelines/tasks/reference/vstest-v3) in Azure DevOps, you can replace it with the [.NET Core task](https://learn.microsoft.com/azure/devops/pipelines/tasks/reference/dotnet-core-cli-v2).
127+
128+
#### .NET Core task
129+
130+
If you are using the [.NET Core task](https://learn.microsoft.com/azure/devops/pipelines/tasks/reference/dotnet-core-cli-v2), no changes are needed.

0 commit comments

Comments
 (0)