You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/core/testing/index.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,9 +39,11 @@ When running tests in .NET, there are two components involved: the test platform
39
39
40
40
### Test platforms
41
41
42
-
The test platform is the engine that runs the tests and acts as a communication channel with IDEs. For example, Visual Studio can send a discovery request to the test platform so that it can display the available tests in Test Explorer. The test platform responds back to the IDE with the tests it found. Similar communication happens for test execution.
42
+
The test platform is the engine that runs the tests and acts as a communication channel with IDEs and CLI. For example, Visual Studio can send a discovery request to the test platform so that it can display the available tests in Test Explorer. The test platform responds back to the IDE with the tests it found. Similar communication happens for test execution.
43
43
44
-
VSTest has been used for many years in .NET and was the only test platform in the ecosystem. Early in 2024, the first stable version of a new test platform, called [Microsoft.Testing.Platform (MTP)](./microsoft-testing-platform-intro.md), was released.
44
+
VSTest has been used for many years in .NET and was the only test platform in the ecosystem. Early in 2024, the first stable version of a new test platform, called [Microsoft.Testing.Platform (MTP)](./microsoft-testing-platform-intro.md), was released. For more information about migrating from VSTest to Microsoft.Testing.Platform, see [Migration guide from VSTest to Microsoft.Testing.Platform](./migrating-vstest-microsoft-testing-platform.md).
45
+
46
+
The test platform also provides extensibility APIs so that additional features can be implemented and made available for all test frameworks. There are usually built-in features built on top of the extensibility APIs, such as TRX reporting and hang and crash dumps. The community can also build custom extensions that work for all test frameworks.
title: Migrating from Microsoft.Testing.Platform v1 to v2
3
+
description: Learn how to migrate to Microsoft.Testing.Platform v2 and understand the key changes.
4
+
author: Youssef1313
5
+
ms.author: ygerges
6
+
ms.date: 10/08/2025
7
+
---
8
+
9
+
# Mirate from Microsoft.Testing.Platform v1 to v2
10
+
11
+
The stable version Microsoft.Testing.Platform v2 is now available. This migration guide explores what's changed in Microsoft.Testing.Platform v2 and how you can migrate to this version.
12
+
13
+
## Source breaking changes
14
+
15
+
These are breaking changes that might cause build errors after migration.
16
+
17
+
### Dropped unsupported target frameworks
18
+
19
+
Support for target frameworks from .NET Core 3.1 to .NET 7 is dropped. The minimum supported .NET version is .NET 8.
20
+
This change doesn't affect .NET Framework. .NET Framework 4.6.2 continues to be the minimum supported .NET Framework target.
21
+
22
+
### Removed obsolete types
23
+
24
+
The following types were marked obsolete in MTP v1. In MTP v2, they are removed completely:
25
+
26
+
-`ITestApplicationLifecycleCallbacks`: use `ITestHostApplicationLifetime` instead.
27
+
-`TestNodeFileArtifact`: use `FileArtifactProperty` instead.
28
+
-`KeyValuePairStringProperty`: use `TestMetadataProperty` instead.
29
+
-`TestSessionContext.Client`: use `IClientInfo` instead.
30
+
31
+
This breaking change doesn't affect typical users of test frameworks. It only affects test framework authors and extension authors.
32
+
33
+
### API signature changes
34
+
35
+
- A `CancellationToken` parameter was added to <xref:Microsoft.Testing.Platform.OutputDevice.IOutputDevice.DisplayAsync(Microsoft.Testing.Platform.Extensions.OutputDevice.IOutputDeviceDataProducer,Microsoft.Testing.Platform.OutputDevice.IOutputDeviceData)?displayProperty=nameWithType>.
36
+
- Methods in <xref:Microsoft.Testing.Platform.Extensions.TestHost.ITestSessionLifetimeHandler> interface are changed to have an `ITestSessionContext` parameter instead of both <xref:Microsoft.Testing.Platform.TestHost.SessionUid> and <xref:System.Threading.CancellationToken> parameters.
37
+
-`IDataConsumer` is moved from `Microsoft.Testing.Platform.Extensions.TestHost` namespace to `Microsoft.Testing.Platform.Extensions`.
38
+
39
+
This breaking change doesn't affect typical users of test frameworks. It only affects test framework authors and extension authors.
40
+
41
+
## Behavior breaking changes
42
+
43
+
These are breaking changes that might affect the behavior at run time.
44
+
45
+
### Compatibility with VSTest-based `dotnet test`
46
+
47
+
The `dotnet test` command has two implementations:
48
+
49
+
- VSTest-based implementation: this was the only implementation up to .NET 9 SDK.
50
+
- MTP-based implementation: this was added starting in .NET 10 SDK.
51
+
52
+
Running MTP test projects with .NET 10 SDK now requires opting-in to the MTP-based `dotnet test` and can no longer be run with the VSTest-based implementation, which was previously enabled by `TestingPlatformDotnetTestSupport` MSBuild property in MTP v1.
53
+
54
+
To opt-in the MTP-based implementation, create global.json in repository or solution root (or update existing global.json if you have one already), to have test runner set as Microsoft.Testing.Platform, as shown in the following example:
55
+
56
+
```json
57
+
{
58
+
"test": {
59
+
"runner": "Microsoft.Testing.Platform"
60
+
}
61
+
}
62
+
```
63
+
64
+
Attempting to run the VSTest-based `dotnet test` with MTP v2 will produce the following error:
65
+
66
+
> Testing with VSTest target is no longer supported by Microsoft.Testing.Platform on .NET 10 SDK and later. If you use dotnet test, you should opt-in to the new dotnet test experience. For more information, see <https://aka.ms/dotnet-test-mtp-error>
67
+
68
+
### Rename of command-line options
69
+
70
+
- The `--diagnostic-output-fileprefix` command-line option was renamed to `--diagnostic-file-prefix`.
71
+
- The `--diagnostic-filelogger-synchronouswrite` command-line option was renamed to `--diagnostic-synchronous-write`.
Copy file name to clipboardExpand all lines: docs/core/testing/microsoft-testing-platform-vs-vstest.md
+3-75Lines changed: 3 additions & 75 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,80 +53,8 @@ You can also go to Preview Features options in Visual Studio and deselect the "U
53
53
54
54
## Executables
55
55
56
-
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.
56
+
VSTest ships multiple executables, notably `vstest.console.exe`, `testhost.exe`, and `datacollector.exe`. However, Microsoft.Testing.Platform 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.
57
57
58
-
## Migrating from VSTest
58
+
## See also
59
59
60
-
In addition to the steps specific to your test framework, you need to update your test infrastructure to accommodate to `Microsoft.Testing.Platform`.
61
-
62
-
### `dotnet test`
63
-
64
-
Command line options of `dotnet test` are divided into 2 categories: build related arguments and test related ones.
65
-
66
-
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:
67
-
68
-
-`-a|--arch <ARCHITECTURE>`
69
-
-`--artifacts-path <ARTIFACTS_DIR>`
70
-
-`-c|--configuration <CONFIGURATION>`
71
-
-`-f|--framework <FRAMEWORK>`
72
-
-`-e|--environment <NAME="VALUE">`
73
-
-`--interactive`
74
-
-`--no-build`
75
-
-`--nologo`
76
-
-`--no-restore`
77
-
-`-o|--output <OUTPUT_DIRECTORY>`
78
-
-`--os <OS>`
79
-
-`-r|--runtime <RUNTIME_IDENTIFIER>`
80
-
-`-v|--verbosity <LEVEL>`
81
-
82
-
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:
83
-
84
-
| VSTest argument | New platform argument |
85
-
|-----------------|-----------------------|
86
-
|`--test-adapter-path <ADAPTER_PATH>`| Not supported |
|`-s\|--settings <SETTINGS_FILE>`| Depends upon the selected test framework |
100
-
|`-t\|--list-tests`|`--list-tests`|
101
-
|`-- <RunSettings arguments>`|`--test-parameter` (provided by [VSTestBridge](microsoft-testing-platform-extensions-vstest-bridge.md)) |
102
-
103
-
> [!IMPORTANT]
104
-
> Before specifying any `Microsoft.Testing.Platform` arguments, you need to add `--` to separate the `dotnet test` arguments from the new platform arguments. For example, `dotnet test --no-build -- --list-tests`.
105
-
106
-
### `vstest.console.exe`
107
-
108
-
If you are using `vstest.console.exe` directly, we recommend replacing it with the `dotnet test` command.
109
-
110
-
### Test Explorer
111
-
112
-
When using Visual Studio or Visual Studio Code Test Explorer, you might need to enable the support for the new test platform.
113
-
114
-
#### Visual Studio
115
-
116
-
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.
117
-
118
-
#### Visual Studio Code
119
-
120
-
Visual Studio Code with C# DevKit supports the new test platform.
121
-
122
-
### Azure DevOps
123
-
124
-
When using Azure DevOps tasks, you might need to update your pipeline to use the new test platform.
125
-
126
-
#### VSTest task
127
-
128
-
If you're using the [VSTest task](/azure/devops/pipelines/tasks/reference/vstest-v3) in Azure DevOps, you can replace it with the [.NET Core task](/azure/devops/pipelines/tasks/reference/dotnet-core-cli-v2).
129
-
130
-
#### .NET Core task
131
-
132
-
If you're using the [.NET Core task](/azure/devops/pipelines/tasks/reference/dotnet-core-cli-v2), no changes are needed.
60
+
-[Migration guide from VSTest to Microsoft.Testing.Platform](./migrating-vstest-microsoft-testing-platform.md)
0 commit comments