-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Document MTP v1 to v2 migration #48673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
58a2acf
Document MTP v1 to v2 migration
Youssef1313 5aaae20
markdownlint
Youssef1313 cd91c3e
Apply suggestions from code review
Youssef1313 d5dcdfc
Consistency
Youssef1313 dd6a7fc
xref
Youssef1313 76caf61
More xrefs
Youssef1313 12e524e
Clarify
Youssef1313 a15c665
Cleanup
Youssef1313 eba327f
Fix markdownlint
Youssef1313 f31b704
Update docs/core/testing/microsoft-testing-platform-migration-from-v1…
Youssef1313 0c04fd4
Apply suggestions from code review
Youssef1313 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
docs/core/testing/microsoft-testing-platform-migration-from-v1-to-v2.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| --- | ||
| title: Migrating from Microsoft.Testing.Platform v1 to v2 | ||
| description: Learn how to migrate to Microsoft.Testing.Platform v2 and understand the key changes. | ||
| author: Youssef1313 | ||
| ms.author: ygerges | ||
| ms.date: 10/08/2025 | ||
| --- | ||
|
|
||
| # Mirate from Microsoft.Testing.Platform v1 to v2 | ||
|
|
||
| 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. | ||
|
|
||
| ## Source breaking changes | ||
|
|
||
| These are breaking changes that might cause build errors after migration. | ||
|
|
||
| ### Dropped unsupported target frameworks | ||
|
|
||
| Support for target frameworks from .NET Core 3.1 to .NET 7 is dropped. The minimum supported .NET version is .NET 8. | ||
| This change doesn't affect .NET Framework. .NET Framework 4.6.2 continues to be the minimum supported .NET Framework target. | ||
|
|
||
| ### Removed obsolete types | ||
|
|
||
| The following types were marked obsolete in MTP v1. In MTP v2, they are removed completely: | ||
|
|
||
| - `ITestApplicationLifecycleCallbacks`: use `ITestHostApplicationLifetime` instead. | ||
| - `TestNodeFileArtifact`: use `FileArtifactProperty` instead. | ||
| - `KeyValuePairStringProperty`: use `TestMetadataProperty` instead. | ||
| - `TestSessionContext.Client`: use `IClientInfo` instead. | ||
gewarren marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| This breaking change doesn't affect typical users of test frameworks. It only affects test framework authors and extension authors. | ||
|
|
||
| ### API signature changes | ||
|
|
||
| - 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>. | ||
Youssef1313 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - 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. | ||
| - `IDataConsumer` is moved from `Microsoft.Testing.Platform.Extensions.TestHost` namespace to `Microsoft.Testing.Platform.Extensions`. | ||
|
|
||
| This breaking change doesn't affect typical users of test frameworks. It only affects test framework authors and extension authors. | ||
|
|
||
| ## Behavior breaking changes | ||
|
|
||
| These are breaking changes that might affect the behavior at run time. | ||
|
|
||
| ### Compatibility with VSTest-based `dotnet test` | ||
|
|
||
| The `dotnet test` command has two implementations: | ||
|
|
||
| - VSTest-based implementation: this was the only implementation up to .NET 9 SDK. | ||
| - MTP-based implementation: this was added starting in .NET 10 SDK. | ||
|
|
||
| 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. | ||
Youssef1313 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| 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: | ||
Youssef1313 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ```json | ||
| { | ||
| "test": { | ||
| "runner": "Microsoft.Testing.Platform" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Attempting to run the VSTest-based `dotnet test` with MTP v2 will produce the following error: | ||
|
|
||
| > 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> | ||
|
|
||
| ### Rename of command-line options | ||
|
|
||
| - The `--diagnostic-output-fileprefix` command-line option was renamed to `--diagnostic-file-prefix`. | ||
| - The `--diagnostic-filelogger-synchronouswrite` command-line option was renamed to `--diagnostic-synchronous-write`. | ||
gewarren marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Youssef1313
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#49537, thanks!