From cffa1a4e0b2ccf1420c4277a251f6f50f23c61d0 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Mon, 15 Sep 2025 19:12:01 +0200 Subject: [PATCH 1/6] Testing docs improvements --- docs/core/testing/index.md | 6 +- .../microsoft-testing-platform-vs-vstest.md | 76 +------ ...ating-vstest-microsoft-testing-platform.md | 203 ++++++++++++++++++ docs/navigate/devops-testing/toc.yml | 2 + 4 files changed, 211 insertions(+), 76 deletions(-) create mode 100644 docs/core/testing/migrating-vstest-microsoft-testing-platform.md diff --git a/docs/core/testing/index.md b/docs/core/testing/index.md index ebe3166710c1a..be62534da35f4 100644 --- a/docs/core/testing/index.md +++ b/docs/core/testing/index.md @@ -39,9 +39,11 @@ When running tests in .NET, there are two components involved: the test platform ### Test platforms -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. +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. -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. +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). + +The test platform also provides extensibility APIs so that additional features can be implemented and get them working 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 their own extensions that end up working for all test frameworks. ### Test frameworks diff --git a/docs/core/testing/microsoft-testing-platform-vs-vstest.md b/docs/core/testing/microsoft-testing-platform-vs-vstest.md index 8ce80848f29a3..8f0b062e0e698 100644 --- a/docs/core/testing/microsoft-testing-platform-vs-vstest.md +++ b/docs/core/testing/microsoft-testing-platform-vs-vstest.md @@ -55,78 +55,6 @@ You can also go to Preview Features options in Visual Studio and deselect the "U 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. -## Migrating from VSTest +## See also -In addition to the steps specific to your test framework, you need to update your test infrastructure to accommodate to `Microsoft.Testing.Platform`. - -### `dotnet test` - -Command line options of `dotnet test` are divided into 2 categories: build related arguments and test related ones. - -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: - -- `-a|--arch ` -- `--artifacts-path ` -- `-c|--configuration ` -- `-f|--framework ` -- `-e|--environment ` -- `--interactive` -- `--no-build` -- `--nologo` -- `--no-restore` -- `-o|--output ` -- `--os ` -- `-r|--runtime ` -- `-v|--verbosity ` - -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: - -| VSTest argument | New platform argument | -|-----------------|-----------------------| -| `--test-adapter-path ` | Not supported | -| `--blame` | Not supported | -| `--blame-crash` | `--crashdump` requires [Crash dump extension](./microsoft-testing-platform-extensions-diagnostics.md#crash-dump) | -| `--blame-crash-dump-type ` | `--crashdump-type` requires [Crash dump extension](./microsoft-testing-platform-extensions-diagnostics.md#crash-dump) | -| `--blame-crash-collect-always` | Not supported | -| `--blame-hang` | `--hangdump` requires [Hang dump extension](./microsoft-testing-platform-extensions-diagnostics.md#hang-dump) | -| `--blame-hang-dump-type ` | `--hangdump-type` requires [Hang dump extension](./microsoft-testing-platform-extensions-diagnostics.md#hang-dump) | -| `--blame-hang-timeout ` | `--hangdump-timeout` requires [Hang dump extension](./microsoft-testing-platform-extensions-diagnostics.md#hang-dump) | -| `--collect ` | Depends on the data collector | -| `-d\|--diag ` | `--diagnostic` | -| `--filter ` | Depends upon the selected test framework | -| `-l\|--logger ` | Depends on the logger | -| `--results-directory ` | `--results-directory ` | -| `-s\|--settings ` | Depends upon the selected test framework | -| `-t\|--list-tests` | `--list-tests` | -| `-- ` | `--test-parameter` (provided by [VSTestBridge](microsoft-testing-platform-extensions-vstest-bridge.md)) | - -> [!IMPORTANT] -> 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`. - -### `vstest.console.exe` - -If you are using `vstest.console.exe` directly, we recommend replacing it with the `dotnet test` command. - -### Test Explorer - -When using Visual Studio or Visual Studio Code Test Explorer, you might need to enable the support for the new test platform. - -#### Visual Studio - -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. - -#### Visual Studio Code - -Visual Studio Code with C# DevKit supports the new test platform. - -### Azure DevOps - -When using Azure DevOps tasks, you might need to update your pipeline to use the new test platform. - -#### VSTest task - -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). - -#### .NET Core task - -If you're using the [.NET Core task](/azure/devops/pipelines/tasks/reference/dotnet-core-cli-v2), no changes are needed. +- [Migration guide from VSTest to Microsoft.Testing.Platform](./migrating-vstest-microsoft-testing-platform.md) \ No newline at end of file diff --git a/docs/core/testing/migrating-vstest-microsoft-testing-platform.md b/docs/core/testing/migrating-vstest-microsoft-testing-platform.md new file mode 100644 index 0000000000000..beb4c61e48b1c --- /dev/null +++ b/docs/core/testing/migrating-vstest-microsoft-testing-platform.md @@ -0,0 +1,203 @@ +--- +title: Migration guide from VSTest to Microsoft.Testing.Platform +description: Learn how to migrate from VSTest to Microsoft.Testing.Platform +author: Youssef1313 +ms.author: ygerges +ms.date: 09/15/2025 +--- + +# Migration guide from VSTest to Microsoft.Testing.Platform + +In this article, you'll learn how to migrate from VSTest to Microsoft.Testing.Platform. + +## Opt-in to use Microsoft.Testing.Platform + +The first step in the migration is to opt-in to using Microsoft.Testing.Platform. + +For all test frameworks, add `Exe` to all test projects in the solution. After that, follow the framework-specific guidance. + +### MSTest + +Microsoft.Testing.Platform is supported by MSTest starting with 3.2.0. However, we recommend updating to the latest available MSTest version. + +To opt-in, add `true` under a `PropertyGroup` in [`Directory.Build.props`](/visualstudio/msbuild/customize-by-directory) file. + +> [!NOTE] +> When using MSTest.Sdk, Microsoft.Testing.Platform is used by default, unless `true` is specified. + +### NUnit + +Microsoft.Testing.Platform is supported by NUnit3TestAdapter starting with 5.0.0. + +To opt-in, add `true` under a `PropertyGroup` in [`Directory.Build.props`](/visualstudio/msbuild/customize-by-directory) file. + +### xUnit.net + +Microsoft.Testing.Platform is supported starting with xunit.v3. + +To opt-in, add `true` under a `PropertyGroup` in [`Directory.Build.props`](/visualstudio/msbuild/customize-by-directory) file. + +## `dotnet test` + +### Opt-in for .NET 9 SDK and earlier + +In .NET 9 SDK and earlier, there is no *native* support for Microsoft.Testing.Platform for `dotnet test`. However, we provide support that is built on top of VSTest infrastructure. To use that, add `true` under a `PropertyGroup` in [`Directory.Build.props`](/visualstudio/msbuild/customize-by-directory) file. + +> [!IMPORTANT] +> When running Microsoft.Testing.Platform support in this mode, you need to add `--` to separate the `dotnet test` arguments from the new platform arguments. For example, `dotnet test --no-build -- --list-tests`. + +### Opt-in for .NET 10 SDK and later + +Starting with .NET 10 SDK, there is *native* support for Microsoft.Testing.Platform. To use it, you must specify the test runner as `Microsoft.Testing.Platform` in *global.json*: + +```json +{ + "test": { + "runner": "Microsoft.Testing.Platform" + } +} +``` + +> [!IMPORTANT] +> In this mode, the extra `--` is no longer used. + +### Update `dotnet test` invocations + +Command line options of `dotnet test` are divided into 2 categories: build related arguments and test related ones. + +The build related arguments are irrelevant to the test platform and as such don't need to be updated for the new platform. Build related arguments are listed below: + +- `-a|--arch ` +- `--artifacts-path ` +- `-c|--configuration ` +- `-f|--framework ` +- `-e|--environment ` +- `--interactive` +- `--no-build` +- `--nologo` +- `--no-restore` +- `-o|--output ` +- `--os ` +- `-r|--runtime ` +- `-v|--verbosity ` + +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: + +| VSTest argument | New platform argument | +|-----------------|-----------------------| +| `--test-adapter-path ` | Not relevant for Microsoft.Testing.Platform | +| `--blame` | Not relevant for Microsoft.Testing.Platform | +| `--blame-crash` | `--crashdump` (requires [Crash dump extension](./microsoft-testing-platform-extensions-diagnostics.md#crash-dump)) | +| `--blame-crash-dump-type ` | `--crashdump-type` (requires [Crash dump extension](./microsoft-testing-platform-extensions-diagnostics.md#crash-dump)) | +| `--blame-crash-collect-always` | Not supported | +| `--blame-hang` | `--hangdump` (requires [Hang dump extension](./microsoft-testing-platform-extensions-diagnostics.md#hang-dump)) | +| `--blame-hang-dump-type ` | `--hangdump-type` (requires [Hang dump extension](./microsoft-testing-platform-extensions-diagnostics.md#hang-dump)) | +| `--blame-hang-timeout ` | `--hangdump-timeout` (requires [Hang dump extension](./microsoft-testing-platform-extensions-diagnostics.md#hang-dump)) | +| `--collect ` | Depends on the data collector | +| `-d\|--diag ` | `--diagnostic` | +| `--filter ` | Depends upon the selected test framework | +| `-l\|--logger ` | Depends on the logger | +| `--results-directory ` | `--results-directory ` | +| `-s\|--settings ` | Depends upon the selected test framework | +| `-t\|--list-tests` | `--list-tests` | +| `-- ` | `--test-parameter` (provided by [VSTestBridge](microsoft-testing-platform-extensions-vstest-bridge.md)) | + +#### `--collect` + +`--collect` is a general extensibility point in VSTest for any data collector. The extensibility model of Microsoft.Testing.Platform is different and there is no such centralized argument to be used by all data collectors. With Microsoft.Testing.Platform, each data collector can add its own command-line option. For example, running Microsoft CodeCoverage through VSTest can be similar to the following: + +```dotnetcli +dotnet test --collect "Code Coverage;Format=cobertura" +``` + +With Microsoft.Testing.Platform, this becomes: + +```dotnetcli +dotnet test --coverage --coverage-output-format cobertura +``` + +> [!IMPORTANT] +> As explained earlier, when using Microsoft.Testing.Platform with the VSTest-based `dotnet test`, extra `--` is needed before the arguments intended to be passed to the platform. +> So, this becomes `dotnet test -- --coverage --coverage-output-format cobertura`. + +#### `--filter` + +`--filter` is the VSTest-based filter. This is supported by MSTest and NUnit even when running with Microsoft.Testing.Platform. However, for xUnit.net, this is no longer supported when running with Microsoft.Testing.Platform. You must migrate from the VSTest-based filter to the new filter support in xunit.v3 which is provided using the following command-line options: + +- `--filter-class` +- `--filter-not-class` +- `--filter-method` +- `--filter-not-method` +- `--filter-namespace` +- `--filter-not-namespace` +- `--filter-trait` +- `--filter-not-trait` +- `--filter-query` + +For more information, see [Microsoft.Testing.Platform documentation for xUnit.net](https://xunit.net/docs/getting-started/v3/microsoft-testing-platform) and [Query Filter Language for xUnit.net](https://xunit.net/docs/query-filter-language). + +#### `--logger` + +What was usually referred to as "logger" in VSTest is referred to as "reporter" in Microsoft.Testing.Platform. In Microsoft.Testing.Platform, logging is explicitly for diagnosing purposes only. + +Similar to `--collect`, `--logger` is a general extensibility point in VSTest for any logger (what we call reporter in the context of Microsoft.Testing.Platform). Each Microsoft.Testing.Platform reporter is free to add its own command-line option, and as such there is no centralized command-line option similar to VSTest's `--logger`. + +One of the very commonly used VSTest loggers is the TRX logger. This was usually called as follows: + +```dotnetcli +dotnet test --logger trx +``` + +With Microsoft.Testing.Platform, this becomes: + +```dotnetcli +dotnet test --report-trx +``` + +> [!IMPORTANT] +> In order to use `--report-trx`, you must have `Microsoft.Testing.Extensions.TrxReport` NuGet package. +> +> [!IMPORTANT] +> As explained earlier, when using Microsoft.Testing.Platform with the VSTest-based `dotnet test`, extra `--` is needed before the arguments intended to be passed to the platform. +> So, this becomes `dotnet test -- --report-trx`. + +#### `--settings` + +VSTest's `--settings` is used to specify a RunSettings file for the test run. RunSettings isn't supported by the core Microsoft.Testing.Platform and was replaced by a more modern [`testconfig.json`](./microsoft-testing-platform-config.md) configuration file. However, MSTest and NUnit still support the old RunSettings when running Microsoft.Testing.Platform and `--settings` is still supported. + +## `vstest.console.exe` + +If you are using `vstest.console.exe` directly, we recommend replacing it with the `dotnet test` command. + +## Test Explorer + +When using Visual Studio or Visual Studio Code Test Explorer, you might need to enable the support for Microsoft.Testing.Platform. + +### Visual Studio + +Visual Studio Test Explorer supports Microsoft.Testing.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. + +### Visual Studio Code + +Visual Studio Code with C# DevKit supports Microsoft.Testing.Platform. + +## Azure DevOps + +When using Azure DevOps tasks, you might need to update your pipeline to use Microsoft.Testing.Platform, depending on which task you use. + +### VSTest task + +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). + +### .NET Core CLI task + +1. If you have custom `arguments` passed to the task, this needs to follow the same guidance as the `dotnet test` migration guidance. +1. If you're using the [DotNetCoreCLI](/azure/devops/pipelines/tasks/reference/dotnet-core-cli-v2) task without opting-in the native Microsoft.Testing.Platform experience for .NET 10 SDK and later via `global.json` file, you need to set the task `arguments` to correctly point to the results directory it used to point to, as well as requested TRX report. For example: + + ```yml + - task: DotNetCoreCLI@2 + displayName: Run unit tests + inputs: + command: 'test' + arguments: '-- --report-trx --results-directory $(Agent.TempDirectory) + ``` diff --git a/docs/navigate/devops-testing/toc.yml b/docs/navigate/devops-testing/toc.yml index 57a6ce1b45d6c..eb1dca6a1945b 100644 --- a/docs/navigate/devops-testing/toc.yml +++ b/docs/navigate/devops-testing/toc.yml @@ -237,6 +237,8 @@ items: href: ../../core/testing/microsoft-testing-platform-faq.md - name: Comparison with VSTest href: ../../core/testing/microsoft-testing-platform-vs-vstest.md + - name: Migration guide from VSTest to Microsoft.Testing.Platform + href: ../../core/testing/migrating-vstest-microsoft-testing-platform.md - name: Configure the test platform href: ../../core/testing/microsoft-testing-platform-config.md - name: Extensions From bd82ab0e484f37f189919cf3c3b8fd522ba38bb2 Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Tue, 16 Sep 2025 15:48:27 +0200 Subject: [PATCH 2/6] markdownlint --- docs/core/testing/microsoft-testing-platform-vs-vstest.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/testing/microsoft-testing-platform-vs-vstest.md b/docs/core/testing/microsoft-testing-platform-vs-vstest.md index 8f0b062e0e698..a6f5c53776fc6 100644 --- a/docs/core/testing/microsoft-testing-platform-vs-vstest.md +++ b/docs/core/testing/microsoft-testing-platform-vs-vstest.md @@ -57,4 +57,4 @@ VSTest ships multiple executables, notably `vstest.console.exe`, `testhost.exe`, ## See also -- [Migration guide from VSTest to Microsoft.Testing.Platform](./migrating-vstest-microsoft-testing-platform.md) \ No newline at end of file +- [Migration guide from VSTest to Microsoft.Testing.Platform](./migrating-vstest-microsoft-testing-platform.md) From cb7a178b37d0a153ba83127cc15bbc67eff985f2 Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Thu, 18 Sep 2025 15:09:57 +0200 Subject: [PATCH 3/6] Update docs/core/testing/microsoft-testing-platform-vs-vstest.md --- docs/core/testing/microsoft-testing-platform-vs-vstest.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/core/testing/microsoft-testing-platform-vs-vstest.md b/docs/core/testing/microsoft-testing-platform-vs-vstest.md index a6f5c53776fc6..ff449033332b5 100644 --- a/docs/core/testing/microsoft-testing-platform-vs-vstest.md +++ b/docs/core/testing/microsoft-testing-platform-vs-vstest.md @@ -53,7 +53,7 @@ You can also go to Preview Features options in Visual Studio and deselect the "U ## Executables -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. +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. ## See also From fc2ef0bd4c8d621bca2f11bce602f359e0da8cf1 Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Thu, 18 Sep 2025 15:13:12 +0200 Subject: [PATCH 4/6] Apply suggestions from code review Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- docs/core/testing/index.md | 2 +- ...ating-vstest-microsoft-testing-platform.md | 28 +++++++++---------- docs/navigate/devops-testing/toc.yml | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/core/testing/index.md b/docs/core/testing/index.md index be62534da35f4..27060a7c1ca5c 100644 --- a/docs/core/testing/index.md +++ b/docs/core/testing/index.md @@ -43,7 +43,7 @@ The test platform is the engine that runs the tests and acts as a communication 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). -The test platform also provides extensibility APIs so that additional features can be implemented and get them working 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 their own extensions that end up working for all test frameworks. +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. ### Test frameworks diff --git a/docs/core/testing/migrating-vstest-microsoft-testing-platform.md b/docs/core/testing/migrating-vstest-microsoft-testing-platform.md index beb4c61e48b1c..0faa654c66c64 100644 --- a/docs/core/testing/migrating-vstest-microsoft-testing-platform.md +++ b/docs/core/testing/migrating-vstest-microsoft-testing-platform.md @@ -6,9 +6,9 @@ ms.author: ygerges ms.date: 09/15/2025 --- -# Migration guide from VSTest to Microsoft.Testing.Platform +# Migrate from VSTest to Microsoft.Testing.Platform -In this article, you'll learn how to migrate from VSTest to Microsoft.Testing.Platform. +In this article, you learn how to migrate from VSTest to Microsoft.Testing.Platform. ## Opt-in to use Microsoft.Testing.Platform @@ -41,7 +41,7 @@ To opt-in, add `truetrue` under a `PropertyGroup` in [`Directory.Build.props`](/visualstudio/msbuild/customize-by-directory) file. +In .NET 9 SDK and earlier, there is no *native* support for Microsoft.Testing.Platform for `dotnet test`. Support is built on top of the VSTest infrastructure. To use that, add `true` under a `PropertyGroup` in [`Directory.Build.props`](/visualstudio/msbuild/customize-by-directory) file. > [!IMPORTANT] > When running Microsoft.Testing.Platform support in this mode, you need to add `--` to separate the `dotnet test` arguments from the new platform arguments. For example, `dotnet test --no-build -- --list-tests`. @@ -63,9 +63,9 @@ Starting with .NET 10 SDK, there is *native* support for Microsoft.Testing.Platf ### Update `dotnet test` invocations -Command line options of `dotnet test` are divided into 2 categories: build related arguments and test related ones. +Command line options of `dotnet test` are divided into two categories: build-related arguments and test-related ones. -The build related arguments are irrelevant to the test platform and as such don't need to be updated for the new platform. Build related arguments are listed below: +The build-related arguments are irrelevant to the test platform and as such don't need to be updated for the new platform. Build-related arguments are listed here: - `-a|--arch ` - `--artifacts-path ` @@ -81,7 +81,7 @@ The build related arguments are irrelevant to the test platform and as such don' - `-r|--runtime ` - `-v|--verbosity ` -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: +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: | VSTest argument | New platform argument | |-----------------|-----------------------| @@ -104,7 +104,7 @@ The test related arguments are VSTest specific and so need to be transformed to #### `--collect` -`--collect` is a general extensibility point in VSTest for any data collector. The extensibility model of Microsoft.Testing.Platform is different and there is no such centralized argument to be used by all data collectors. With Microsoft.Testing.Platform, each data collector can add its own command-line option. For example, running Microsoft CodeCoverage through VSTest can be similar to the following: +`--collect` is a general extensibility point in VSTest for any data collector. The extensibility model of Microsoft.Testing.Platform is different and there is no such centralized argument to be used by all data collectors. With Microsoft.Testing.Platform, each data collector can add its own command-line option. For example, running Microsoft CodeCoverage through VSTest might be similar to the following: ```dotnetcli dotnet test --collect "Code Coverage;Format=cobertura" @@ -122,7 +122,7 @@ dotnet test --coverage --coverage-output-format cobertura #### `--filter` -`--filter` is the VSTest-based filter. This is supported by MSTest and NUnit even when running with Microsoft.Testing.Platform. However, for xUnit.net, this is no longer supported when running with Microsoft.Testing.Platform. You must migrate from the VSTest-based filter to the new filter support in xunit.v3 which is provided using the following command-line options: +`--filter` is the VSTest-based filter. This is supported by MSTest and NUnit even when running with Microsoft.Testing.Platform. However, for xUnit.net, this is no longer supported when running with Microsoft.Testing.Platform. You must migrate from the VSTest-based filter to the new filter support in xunit.v3, which is provided using the following command-line options: - `--filter-class` - `--filter-not-class` @@ -140,22 +140,22 @@ For more information, see [Microsoft.Testing.Platform documentation for xUnit.ne What was usually referred to as "logger" in VSTest is referred to as "reporter" in Microsoft.Testing.Platform. In Microsoft.Testing.Platform, logging is explicitly for diagnosing purposes only. -Similar to `--collect`, `--logger` is a general extensibility point in VSTest for any logger (what we call reporter in the context of Microsoft.Testing.Platform). Each Microsoft.Testing.Platform reporter is free to add its own command-line option, and as such there is no centralized command-line option similar to VSTest's `--logger`. +Similar to `--collect`, `--logger` is a general extensibility point in VSTest for any logger (or, in the context of Microsoft.Testing.Platform, any *reporter*). Each Microsoft.Testing.Platform reporter is free to add its own command-line option, and as such there is no centralized command-line option like VSTest's `--logger`. -One of the very commonly used VSTest loggers is the TRX logger. This was usually called as follows: +One of the very commonly used VSTest loggers is the TRX logger. This logger is usually called as follows: ```dotnetcli dotnet test --logger trx ``` -With Microsoft.Testing.Platform, this becomes: +With Microsoft.Testing.Platform, the command becomes: ```dotnetcli dotnet test --report-trx ``` > [!IMPORTANT] -> In order to use `--report-trx`, you must have `Microsoft.Testing.Extensions.TrxReport` NuGet package. +> To use `--report-trx`, you must have the `Microsoft.Testing.Extensions.TrxReport` NuGet package installed. > > [!IMPORTANT] > As explained earlier, when using Microsoft.Testing.Platform with the VSTest-based `dotnet test`, extra `--` is needed before the arguments intended to be passed to the platform. @@ -191,8 +191,8 @@ If you're using the [VSTest task](/azure/devops/pipelines/tasks/reference/vstest ### .NET Core CLI task -1. If you have custom `arguments` passed to the task, this needs to follow the same guidance as the `dotnet test` migration guidance. -1. If you're using the [DotNetCoreCLI](/azure/devops/pipelines/tasks/reference/dotnet-core-cli-v2) task without opting-in the native Microsoft.Testing.Platform experience for .NET 10 SDK and later via `global.json` file, you need to set the task `arguments` to correctly point to the results directory it used to point to, as well as requested TRX report. For example: +- If you have custom `arguments` passed to the task, follow the same guidance for `dotnet test` migration. +- If you're using the [DotNetCoreCLI](/azure/devops/pipelines/tasks/reference/dotnet-core-cli-v2) task without opting-in to the native Microsoft.Testing.Platform experience for .NET 10 SDK and later via `global.json` file, you need to set the task `arguments` to correctly point to the results directory it used to point to, as well as the requested TRX report. For example: ```yml - task: DotNetCoreCLI@2 diff --git a/docs/navigate/devops-testing/toc.yml b/docs/navigate/devops-testing/toc.yml index eb1dca6a1945b..84ce4dbc525b5 100644 --- a/docs/navigate/devops-testing/toc.yml +++ b/docs/navigate/devops-testing/toc.yml @@ -237,7 +237,7 @@ items: href: ../../core/testing/microsoft-testing-platform-faq.md - name: Comparison with VSTest href: ../../core/testing/microsoft-testing-platform-vs-vstest.md - - name: Migration guide from VSTest to Microsoft.Testing.Platform + - name: Migrate from VSTest to Microsoft.Testing.Platform href: ../../core/testing/migrating-vstest-microsoft-testing-platform.md - name: Configure the test platform href: ../../core/testing/microsoft-testing-platform-config.md From 3d47218ac1a00530d05f5f710a0582eaeaa0eb74 Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Mon, 22 Sep 2025 14:30:30 +0200 Subject: [PATCH 5/6] Update docs/core/testing/migrating-vstest-microsoft-testing-platform.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jakub Jareš --- .../migrating-vstest-microsoft-testing-platform.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/core/testing/migrating-vstest-microsoft-testing-platform.md b/docs/core/testing/migrating-vstest-microsoft-testing-platform.md index 0faa654c66c64..c9f65b164dffb 100644 --- a/docs/core/testing/migrating-vstest-microsoft-testing-platform.md +++ b/docs/core/testing/migrating-vstest-microsoft-testing-platform.md @@ -122,7 +122,13 @@ dotnet test --coverage --coverage-output-format cobertura #### `--filter` -`--filter` is the VSTest-based filter. This is supported by MSTest and NUnit even when running with Microsoft.Testing.Platform. However, for xUnit.net, this is no longer supported when running with Microsoft.Testing.Platform. You must migrate from the VSTest-based filter to the new filter support in xunit.v3, which is provided using the following command-line options: +`--filter` is the VSTest-based filter. + +MSTest and NUnit support the same filter format even when running with Microsoft.Testing.Platform. + +xUnit.net, does not support the same filter format when running with Microsoft.Testing.Platform. You must migrate from the VSTest-based filter to the new filter support in xunit.v3, which is provided using the following command-line options. + +xUnit.net specific options: - `--filter-class` - `--filter-not-class` From 4e4958c936e3431464ae0b74e3a0ef01210594d0 Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Tue, 23 Sep 2025 10:35:19 +0200 Subject: [PATCH 6/6] Fix lint --- .../testing/migrating-vstest-microsoft-testing-platform.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/core/testing/migrating-vstest-microsoft-testing-platform.md b/docs/core/testing/migrating-vstest-microsoft-testing-platform.md index c9f65b164dffb..55db1fadb84eb 100644 --- a/docs/core/testing/migrating-vstest-microsoft-testing-platform.md +++ b/docs/core/testing/migrating-vstest-microsoft-testing-platform.md @@ -122,9 +122,9 @@ dotnet test --coverage --coverage-output-format cobertura #### `--filter` -`--filter` is the VSTest-based filter. +`--filter` is the VSTest-based filter. -MSTest and NUnit support the same filter format even when running with Microsoft.Testing.Platform. +MSTest and NUnit support the same filter format even when running with Microsoft.Testing.Platform. xUnit.net, does not support the same filter format when running with Microsoft.Testing.Platform. You must migrate from the VSTest-based filter to the new filter support in xunit.v3, which is provided using the following command-line options.