diff --git a/docs/core/testing/microsoft-testing-platform-architecture-extensions.md b/docs/core/testing/microsoft-testing-platform-architecture-extensions.md
index 4bcd1417fd33a..aa32c4872d13e 100644
--- a/docs/core/testing/microsoft-testing-platform-architecture-extensions.md
+++ b/docs/core/testing/microsoft-testing-platform-architecture-extensions.md
@@ -3,7 +3,7 @@ title: Build extensions for Microsoft.Testing.Platform (MTP)
description: Learn how to create in-process and out-of-process extensions for Microsoft.Testing.Platform (MTP).
author: MarcoRossignoli
ms.author: mrossignoli
-ms.date: 06/02/2026
+ms.date: 06/16/2026
ai-usage: ai-assisted
---
@@ -206,35 +206,38 @@ If your extension requires intensive initialization and you need to use the asyn
### The `ITestApplicationLifecycleCallbacks` extensions
-The `ITestApplicationLifecycleCallbacks` is an *in-process* extension that enables the execution of code before everything, it's like to have access to the first line of the hypothetical *main* of the *test host*.
+> [!IMPORTANT]
+> `ITestApplicationLifecycleCallbacks` was removed in MTP 2.0.0. Use `ITestHostApplicationLifetime` instead. For more information, see [Migrate from Microsoft.Testing.Platform (MTP) v1 to v2](microsoft-testing-platform-migration-from-v1-to-v2.md#removed-obsolete-types).
+
+The `ITestHostApplicationLifetime` interface lets an *in-process* extension run code at the start and end of the *test host*.
-To register a custom `ITestApplicationLifecycleCallbacks`, utilize the following api:
+To register a custom `ITestHostApplicationLifetime`, use the following API:
```csharp
var builder = await TestApplication.CreateBuilderAsync(args);
// ...
-builder.TestHost.AddTestApplicationLifecycleCallbacks(
+builder.TestHost.AddTestHostApplicationLifetime(
static serviceProvider
- => new CustomTestApplicationLifecycleCallbacks());
+ => new CustomTestHostApplicationLifetime());
```
-The factory utilizes the [IServiceProvider](./microsoft-testing-platform-architecture-services.md#the-imessagebus-service) to gain access to the suite of services offered by the testing platform.
+The factory uses the [IServiceProvider](./microsoft-testing-platform-architecture-services.md#the-imessagebus-service) to access the services offered by the testing platform.
> [!IMPORTANT]
> The sequence of registration is significant, as the APIs are called in the order they were registered.
-The `ITestApplicationLifecycleCallbacks` interface includes the following methods:
+The `ITestHostApplicationLifetime` interface includes the following methods:
```csharp
-public interface ITestApplicationLifecycleCallbacks : ITestHostExtension
+public interface ITestHostApplicationLifetime : ITestHostExtension
{
Task BeforeRunAsync(CancellationToken cancellationToken);
Task AfterRunAsync(
int exitCode,
- CancellationToken cancellation);
+ CancellationToken cancellationToken);
}
public interface ITestHostExtension : IExtension
@@ -242,7 +245,7 @@ public interface ITestHostExtension : IExtension
}
```
-The `ITestApplicationLifecycleCallbacks` is a type of `ITestHostExtension`, which serves as a base for all *test host* extensions. Like all other extension points, it also inherits from [IExtension](./microsoft-testing-platform-architecture-test-framework.md#the-iextension-interface). Therefore, like any other extension, you can choose to enable or disable it using the `IExtension.IsEnabledAsync` API.
+The `ITestHostApplicationLifetime` interface extends `ITestHostExtension`, which serves as a base for all *test host* extensions. Like all other extension points, it also inherits from [IExtension](./microsoft-testing-platform-architecture-test-framework.md#the-iextension-interface). Therefore, like any other extension, you can choose to enable or disable it using the `IExtension.IsEnabledAsync` API.
`BeforeRunAsync`: This method serves as the initial point of contact for the *test host* and is the first opportunity for an *in-process* extension to execute a feature. It's typically used to establish a connection with any corresponding *out-of-process* extensions if a feature is designed to operate across both environments.
@@ -492,7 +495,7 @@ Consider the following details for this API:
`OnTestHostProcessStartedAsync`: This method is invoked immediately after the test host starts. This method offers an object that implements the `ITestHostProcessInformation` interface, which provides key details about the test host process result.
> [!IMPORTANT]
-> The invocation of this method does not halt the test host's execution. If you need to pause it, you should register an [*in-process*](./microsoft-testing-platform-architecture.md#in-process-vs-out-of-process-extensions) extension such as [`ITestApplicationLifecycleCallbacks`](#the-itestapplicationlifecyclecallbacks-extensions) and synchronize it with the *out-of-process* extension.
+> The invocation of this method does not halt the test host's execution. If you need to pause it, you should register an [*in-process*](./microsoft-testing-platform-architecture.md#in-process-vs-out-of-process-extensions) extension such as [`ITestHostApplicationLifetime`](#the-itestapplicationlifecyclecallbacks-extensions) and synchronize it with the *out-of-process* extension.
`OnTestHostProcessExitedAsync`: This method is invoked when the test suite execution is complete. This method supplies an object that adheres to the `ITestHostProcessInformation` interface, which conveys crucial details about the outcome of the test host process.
@@ -595,18 +598,18 @@ The testing platform consists of a [testing framework](./microsoft-testing-platf
1. [ITestHostEnvironmentVariableProvider.UpdateAsync](#the-itesthostenvironmentvariableprovider-extensions) : Out-of-process
1. [ITestHostEnvironmentVariableProvider.ValidateTestHostEnvironmentVariablesAsync](#the-itesthostenvironmentvariableprovider-extensions) : Out-of-process
-1. [ITestHostProcessLifetimeHandler.BeforeTestHostProcessStartAsync](#the-itestsessionlifetimehandler-extensions) : Out-of-process
+1. [ITestHostProcessLifetimeHandler.BeforeTestHostProcessStartAsync](#the-itesthostprocesslifetimehandler-extensions) : Out-of-process
1. Test host process start
-1. [ITestHostProcessLifetimeHandler.OnTestHostProcessStartedAsync](#the-itestsessionlifetimehandler-extensions) : Out-of-process, this event can intertwine the actions of *in-process* extensions, depending on race conditions.
-1. [ITestApplicationLifecycleCallbacks.BeforeRunAsync](#the-itestsessionlifetimehandler-extensions): In-process
+1. [ITestHostProcessLifetimeHandler.OnTestHostProcessStartedAsync](#the-itesthostprocesslifetimehandler-extensions) : Out-of-process, this event can intertwine the actions of *in-process* extensions, depending on race conditions.
+1. [ITestHostApplicationLifetime.BeforeRunAsync](#the-itestapplicationlifecyclecallbacks-extensions): In-process
1. [ITestSessionLifetimeHandler.OnTestSessionStartingAsync](#the-itestsessionlifetimehandler-extensions): In-process
1. [ITestFramework.CreateTestSessionAsync](./microsoft-testing-platform-architecture-test-framework.md#test-framework-extension): In-process
1. [ITestFramework.ExecuteRequestAsync](./microsoft-testing-platform-architecture-test-framework.md#test-framework-extension): In-process, this method can be called one or more times. At this point, the testing framework will transmit information to the [IMessageBus](./microsoft-testing-platform-architecture-services.md#the-imessagebus-service) that can be utilized by the [IDataConsumer](#the-idataconsumer-extensions).
1. [ITestFramework.CloseTestSessionAsync](./microsoft-testing-platform-architecture-test-framework.md#test-framework-extension): In-process
1. [ITestSessionLifetimeHandler.OnTestSessionFinishingAsync](#the-itestsessionlifetimehandler-extensions): In-process
-1. [ITestApplicationLifecycleCallbacks.AfterRunAsync](#the-itestsessionlifetimehandler-extensions): In-process
+1. [ITestHostApplicationLifetime.AfterRunAsync](#the-itestapplicationlifecyclecallbacks-extensions): In-process
1. In-process cleanup, involves calling dispose and [IAsyncCleanableExtension](#asynchronous-initialization-and-cleanup-of-extensions) on all extension points.
-1. [ITestHostProcessLifetimeHandler.OnTestHostProcessExitedAsync](#the-itestsessionlifetimehandler-extensions) : Out-of-process
+1. [ITestHostProcessLifetimeHandler.OnTestHostProcessExitedAsync](#the-itesthostprocesslifetimehandler-extensions) : Out-of-process
1. Out-of-process cleanup, involves calling dispose and [IAsyncCleanableExtension](#asynchronous-initialization-and-cleanup-of-extensions) on all extension points.
## Extensions helpers
diff --git a/docs/core/testing/microsoft-testing-platform-cli-options.md b/docs/core/testing/microsoft-testing-platform-cli-options.md
index 0254db5dc9fe0..cb17fa96d23a6 100644
--- a/docs/core/testing/microsoft-testing-platform-cli-options.md
+++ b/docs/core/testing/microsoft-testing-platform-cli-options.md
@@ -3,7 +3,7 @@ title: Microsoft.Testing.Platform (MTP) CLI options reference
description: Find platform and extension command-line options for MTP in one place.
author: Evangelink
ms.author: amauryleve
-ms.date: 06/01/2026
+ms.date: 06/16/2026
ai-usage: ai-assisted
---
@@ -68,6 +68,9 @@ This article gives a central entry point for MTP command-line options.
Forces the built-in file logger to synchronously write logs. Useful for scenarios where you don't want to lose any log entries (if the process crashes). This slows down the test execution.
+ > [!NOTE]
+ > Available in MTP starting with version 2.0.0. It replaces the previous `--diagnostic-filelogger-synchronouswrite` option, which was removed in MTP 2.0.0.
+
- **`--diagnostic-output-directory`**
The output directory of the diagnostic logging, if not specified the file is generated in the default _TestResults_ directory.
@@ -76,6 +79,9 @@ This article gives a central entry point for MTP command-line options.
The prefix for the log file name. Defaults to `"log"`.
+ > [!NOTE]
+ > Available in MTP starting with version 2.0.0. It replaces the previous `--diagnostic-output-fileprefix` option, which was removed in MTP 2.0.0.
+
- **`--diagnostic-verbosity`**
Defines the verbosity level when the `--diagnostic` switch is used. The available values are `Trace`, `Debug`, `Information`, `Warning`, `Error`, or `Critical`.
diff --git a/docs/core/testing/microsoft-testing-platform-config.md b/docs/core/testing/microsoft-testing-platform-config.md
index 82d94a17eba9a..a83e147ffb9cb 100644
--- a/docs/core/testing/microsoft-testing-platform-config.md
+++ b/docs/core/testing/microsoft-testing-platform-config.md
@@ -3,7 +3,7 @@ title: Microsoft.Testing.Platform (MTP) config options
description: Learn how to configure MTP using testconfig.json configuration settings and environment variables.
author: Evangelink
ms.author: amauryleve
-ms.date: 06/01/2026
+ms.date: 06/16/2026
ai-usage: ai-assisted
---
@@ -78,9 +78,27 @@ Example:
}
```
-### Extension options are CLI-only
+### Environment variables in testconfig.json
-Extension features such as [crash dump](microsoft-testing-platform-crash-hang-dumps.md), [hang dump](microsoft-testing-platform-crash-hang-dumps.md), [retry](microsoft-testing-platform-retry.md), [TRX reports](microsoft-testing-platform-test-reports.md), and [code coverage](microsoft-testing-platform-code-coverage.md) are **not** configurable via *testconfig.json*. These features are configured exclusively through command-line arguments.
+> [!NOTE]
+> Available in MTP starting with version 2.3.0.
+
+The `environmentVariables` section sets environment variables for the test process before it starts. Use string values for each variable.
+
+```json
+{
+ "environmentVariables": {
+ "DOTNET_ENVIRONMENT": "Development",
+ "FEATURE_FLAG": "true"
+ }
+}
+```
+
+### CLI options in testconfig.json
+
+Before MTP 2.3.0, extension features such as [crash dump](microsoft-testing-platform-crash-hang-dumps.md), [hang dump](microsoft-testing-platform-crash-hang-dumps.md), [retry](microsoft-testing-platform-retry.md), [TRX reports](microsoft-testing-platform-test-reports.md), and [code coverage](microsoft-testing-platform-code-coverage.md) aren't configurable via *testconfig.json*. These features are configured exclusively through command-line arguments.
+
+Starting with MTP 2.3.0, MTP can read CLI options from *testconfig.json* through `IConfiguration`. This support includes extension options, so you can use JSON entries for options that you don't want to pass on the command line each run. Command-line arguments still take precedence.
For a complete reference of command-line options, see [MTP CLI options reference](microsoft-testing-platform-cli-options.md).
@@ -128,9 +146,9 @@ If you're migrating from a *.runsettings* file, the following table maps common
| `RunConfiguration/MaxCpuCount` | No equivalent | Process-level parallelism is controlled by `dotnet test --max-parallel-test-modules` or MSBuild `/m` option. |
| `MSTest/*` | `mstest.*` | See [Configure MSTest — testconfig.json](unit-testing-mstest-configure.md#testconfigjson). |
| `xUnit/*` | `xUnit.*` | See [xUnit.net testconfig.json](https://xunit.net/docs/config-testconfig-json). |
-| `LoggerRunSettings/Loggers` | CLI only | Use `--report-trx` or similar CLI options. |
-| `DataCollectionRunSettings` (blame) | CLI only | Use `--crashdump` and `--hangdump` CLI options. See [Crash and hang dumps](microsoft-testing-platform-crash-hang-dumps.md). |
-| `DataCollectionRunSettings` (coverage) | CLI only | Use `--coverage` CLI option. See [Code coverage](microsoft-testing-platform-code-coverage.md). |
+| `LoggerRunSettings/Loggers` | CLI options | Use `--report-trx` or similar CLI options. Starting with MTP 2.3.0, MTP can read CLI options from *testconfig.json*. |
+| `DataCollectionRunSettings` (blame) | CLI options | Use `--crashdump` and `--hangdump` CLI options. Starting with MTP 2.3.0, MTP can read CLI options from *testconfig.json*. See [Crash and hang dumps](microsoft-testing-platform-crash-hang-dumps.md). |
+| `DataCollectionRunSettings` (coverage) | CLI options | Use `--coverage` CLI option. Starting with MTP 2.3.0, MTP can read CLI options from *testconfig.json*. See [Code coverage](microsoft-testing-platform-code-coverage.md). |
| `TestRunParameters` | `--test-parameter` CLI | Use `--test-parameter key=value` on the command line. |
## Environment variables
@@ -186,6 +204,13 @@ A semicolon-separated list of exit codes to ignore. When an exit code is ignored
When set to `1` or `true`, suppresses the startup banner, the copyright message, and the telemetry banner. Equivalent to the `--no-banner` command-line option. The `DOTNET_NOLOGO` environment variable has the same effect.
+### `NO_COLOR` environment variable
+
+When set to any non-empty value, suppresses all ANSI color output. MTP honors the [`NO_COLOR`](https://no-color.org/) convention.
+
+> [!NOTE]
+> Available in MTP starting with version 2.3.0.
+
### `DOTNET_NOLOGO` environment variable
When set to `1` or `true`, suppresses the startup banner, the copyright message, and the telemetry banner. This is the standard .NET CLI environment variable and is honored by MTP. See also `TESTINGPLATFORM_NOBANNER`.
diff --git a/docs/core/testing/microsoft-testing-platform-open-telemetry.md b/docs/core/testing/microsoft-testing-platform-open-telemetry.md
index 21a04b336e5e1..97781093d81a9 100644
--- a/docs/core/testing/microsoft-testing-platform-open-telemetry.md
+++ b/docs/core/testing/microsoft-testing-platform-open-telemetry.md
@@ -3,7 +3,7 @@ title: Microsoft.Testing.Platform (MTP) OpenTelemetry
description: Learn how to use the OpenTelemetry extension to emit traces and metrics from MTP.
author: Evangelink
ms.author: amauryleve
-ms.date: 02/25/2026
+ms.date: 06/16/2026
ai-usage: ai-assisted
---
@@ -13,6 +13,9 @@ This feature requires the [Microsoft.Testing.Extensions.OpenTelemetry](https://n
This extension integrates [OpenTelemetry](https://opentelemetry.io/) with Microsoft.Testing.Platform (MTP), allowing test runs to emit traces and metrics through the standard OpenTelemetry SDK.
+> [!NOTE]
+> This extension is available in MTP starting with version 2.1.0.
+
> [!IMPORTANT]
> This extension is currently experimental. All public APIs are gated behind the `TPEXP` diagnostic ID.
diff --git a/docs/core/testing/microsoft-testing-platform-run-and-debug.md b/docs/core/testing/microsoft-testing-platform-run-and-debug.md
index c1ce9b5610594..5ad3bfd3f91a0 100644
--- a/docs/core/testing/microsoft-testing-platform-run-and-debug.md
+++ b/docs/core/testing/microsoft-testing-platform-run-and-debug.md
@@ -3,7 +3,7 @@ title: Run and debug tests with Microsoft.Testing.Platform (MTP)
description: Learn how to run and debug MTP test projects from CLI, Visual Studio, Visual Studio Code, and CI pipelines.
author: Evangelink
ms.author: amauryleve
-ms.date: 02/24/2026
+ms.date: 06/16/2026
ai-usage: ai-assisted
---
@@ -23,6 +23,11 @@ MTP test projects are built as executables that can be run (or debugged) directl
> [!IMPORTANT]
> By default, MTP collects telemetry. For more information and options on opting out, see [MTP telemetry](microsoft-testing-platform-telemetry.md).
+> [!NOTE]
+> Available in MTP starting with version 2.3.0.
+>
+> For a graceful stop, press Ctrl+C once to request cancellation. Running tests can finish teardown. To terminate immediately, press Ctrl+C again.
+
## [.NET CLI](#tab/dotnetcli)
Publishing the test project using `dotnet publish` and running the app directly is another way to run your tests. For example, executing the `./Contoso.MyTests.exe`. In some scenarios it's also viable to use `dotnet build` to produce the executable, but there can be edge cases to consider, such [Native AOT](../deploying/native-aot/index.md).
diff --git a/docs/core/testing/microsoft-testing-platform-terminal-output.md b/docs/core/testing/microsoft-testing-platform-terminal-output.md
index 83a78d95ab0f0..ae07042ab86c4 100644
--- a/docs/core/testing/microsoft-testing-platform-terminal-output.md
+++ b/docs/core/testing/microsoft-testing-platform-terminal-output.md
@@ -3,7 +3,7 @@ title: Microsoft.Testing.Platform (MTP) terminal output
description: Learn about the built-in terminal test reporter in MTP, including output modes, ANSI support, and progress indicators.
author: evangelink
ms.author: amauryleve
-ms.date: 06/01/2026
+ms.date: 06/16/2026
ai-usage: ai-assisted
---
@@ -45,9 +45,13 @@ The progress bar is written based on the selected mode:
| Option | Description |
|---|---|
-| `--no-progress` | Disables reporting progress to screen. |
+| `--no-progress` | Disables reporting progress to screen. Deprecated in MTP 2.3.0 in favor of `--progress off`. |
+| `--progress` | Controls whether progress is shown. Valid values are `auto` (default), `on` (also accepts `true`, `enable`, `1`), and `off` (also accepts `false`, `disable`, `0`). Available in MTP starting with version 2.3.0. |
| `--no-ansi` | Disables outputting ANSI escape characters to screen. |
| `--ansi` | Controls whether ANSI escape characters are emitted. Valid values are `auto` (default), `on` (also accepts `true`, `enable`, `1`), and `off` (also accepts `false`, `disable`, `0`). Available in MTP starting with version 2.3.0. |
| `--output` | Specifies the output verbosity when reporting tests. Valid values are `Normal` and `Detailed`. Default is `Normal`. |
| `--show-stdout` | Determines when to show captured standard output of a test. Valid values are `All`, `Failed`, and `None`. Default is `All`. Available in MTP starting with version 2.2.1. |
| `--show-stderr` | Determines when to show captured error output of a test. Valid values are `All`, `Failed`, and `None`. Default is `All`. Available in MTP starting with version 2.2.1. |
+
+> [!NOTE]
+> Starting with MTP 2.3.0, when MTP detects that it runs inside an LLM or AI tool environment, it suppresses the startup banner and changes the default of `--show-stdout` and `--show-stderr` from `All` to `Failed` to reduce noise.
diff --git a/docs/core/testing/microsoft-testing-platform-test-reports.md b/docs/core/testing/microsoft-testing-platform-test-reports.md
index 210d8263f4a14..a3ae65ed39d27 100644
--- a/docs/core/testing/microsoft-testing-platform-test-reports.md
+++ b/docs/core/testing/microsoft-testing-platform-test-reports.md
@@ -1,9 +1,9 @@
---
title: Microsoft.Testing.Platform (MTP) test reports
-description: Learn about the MTP extensions for generating test report files (TRX, Azure DevOps).
+description: Learn about the MTP extensions that create test report files (TRX, HTML, JUnit, CTRF, Azure DevOps).
author: evangelink
ms.author: amauryleve
-ms.date: 06/01/2026
+ms.date: 06/16/2026
ai-usage: ai-assisted
---
@@ -14,6 +14,26 @@ These features require installing additional NuGet packages, as described in eac
> [!TIP]
> When using [Microsoft.Testing.Platform.MSBuild](https://www.nuget.org/packages/Microsoft.Testing.Platform.MSBuild) (included transitively by MSTest, NUnit, and xUnit runners), these extensions are auto-registered when you install their NuGet packages — no code changes needed. The manual registration specified in this article is only required if you disabled the auto-generated entry point by setting `false`.
+## Report file names
+
+Every report extension writes its file to the test results directory, which you can set with the [`--results-directory`](microsoft-testing-platform-cli-options.md) option. To override the name, use the matching `--report-*-filename` option. Each report section lists the default name for that report.
+
+A file name can include a relative path that stays within the test results directory, and it can use the following replacement items (placeholders):
+
+| Placeholder | Description |
+|---|---|
+| `{asm}` | Entry assembly name, or `unknown` when it's unavailable. |
+| `{tfm}` | Target framework moniker detected at runtime, such as `net9.0`. |
+| `{arch}` | Process architecture, such as `x64`, `x86`, or `arm64`. |
+| `{pname}` | Process name. |
+| `{pid}` | Process ID. |
+| `{time}` | High-precision timestamp. |
+
+For example, `--report-trx-filename "{asm}_{tfm}_{arch}.trx"` reproduces the default TRX name.
+
+> [!NOTE]
+> Placeholder names are case-sensitive and use lowercase. Placeholder support for report file names is available in MTP starting with version 2.3.0.
+
## Visual Studio test reports (TRX)
The Visual Studio test result file (or TRX) is the default format for publishing test results. This extension requires the [Microsoft.Testing.Extensions.TrxReport](https://nuget.org/packages/Microsoft.Testing.Extensions.TrxReport) NuGet package.
@@ -28,15 +48,84 @@ builder.AddTrxReportProvider();
> [!NOTE]
> When using manual registration, register the TRX report provider last. The current implementation depends on registration order, so registering it after all other extensions ensures it captures all test data.
+> [!NOTE]
+> Available in MTP starting with version 1.9.0, the TRX report includes the test `Description` field.
+
+> [!NOTE]
+> Available in MTP starting with version 2.3.0, TRX results stream to disk as the run progresses. If the test host crashes, the TRX file keeps the results collected before the crash.
+
### Options
| Option | Description |
|---|---|
| `--report-trx` | Generates the TRX report. |
-| `--report-trx-filename` | The name of the generated TRX report. The default name matches the following format `__.trx`. |
+| `--report-trx-filename` | The name of the generated TRX report. Starting with MTP 2.3.0, the default is the deterministic `{asm}_{tfm}_{arch}.trx` form; before MTP 2.3.0, the default was `__.trx`. To customize the name, see [Report file names](#report-file-names). |
The report is saved inside the default _TestResults_ folder that can be specified through the `--results-directory` command line argument.
+## HTML reports
+
+The HTML report creates an interactive, self-contained HTML file for a test session. This extension requires the [Microsoft.Testing.Extensions.HtmlReport](https://nuget.org/packages/Microsoft.Testing.Extensions.HtmlReport) NuGet package.
+
+> [!NOTE]
+> Available in MTP starting with version 2.3.0. This extension is experimental, and its options and output format might change in a future version.
+
+### Manual registration
+
+```csharp
+var builder = await TestApplication.CreateBuilderAsync(args);
+builder.AddHtmlReportProvider();
+```
+
+### Options
+
+| Option | Description |
+|---|---|
+| `--report-html` | Generates the HTML report. |
+| `--report-html-filename` | The name of the generated HTML report. The value must end with `.html`. The default is `{asm}_{tfm}_{arch}.html`. To customize the name, see [Report file names](#report-file-names). Requires `--report-html`. |
+
+## JUnit reports
+
+The JUnit report creates a JUnit-compatible XML file for a test session. This extension requires the [Microsoft.Testing.Extensions.JUnitReport](https://nuget.org/packages/Microsoft.Testing.Extensions.JUnitReport) NuGet package.
+
+> [!NOTE]
+> Available in MTP starting with version 2.3.0. This extension is experimental, and its options and output format might change in a future version.
+
+### Manual registration
+
+```csharp
+var builder = await TestApplication.CreateBuilderAsync(args);
+builder.AddJUnitReportProvider();
+```
+
+### Options
+
+| Option | Description |
+|---|---|
+| `--report-junit` | Generates the JUnit XML report. |
+| `--report-junit-filename` | The name of the generated JUnit XML report. The value must end with `.xml`. The default is `{asm}_{tfm}_{arch}.xml`. To customize the name, see [Report file names](#report-file-names). Requires `--report-junit`. |
+
+## CTRF reports
+
+The CTRF report creates a JSON file that uses the [Common Test Report Format](https://ctrf.io) for a test session. This extension requires the [Microsoft.Testing.Extensions.CtrfReport](https://nuget.org/packages/Microsoft.Testing.Extensions.CtrfReport) NuGet package.
+
+> [!NOTE]
+> Available in MTP starting with version 2.3.0. This extension is experimental, and its options and output format might change in a future version.
+
+### Manual registration
+
+```csharp
+var builder = await TestApplication.CreateBuilderAsync(args);
+builder.AddCtrfReportProvider();
+```
+
+### Options
+
+| Option | Description |
+|---|---|
+| `--report-ctrf` | Generates the CTRF JSON report. |
+| `--report-ctrf-filename` | The name of the generated CTRF JSON report. The value must end with `.json`. The default is `____.ctrf.json`. To customize the name, see [Report file names](#report-file-names). Requires `--report-ctrf`. |
+
## Azure DevOps reports
Azure DevOps report plugin enhances test running for developers that host their code on GitHub, but build on Azure DevOps build agents. It adds additional information to failures to show failure directly in GitHub PR.
@@ -61,6 +150,8 @@ builder.TestHost.AddAzureDevOpsProvider();
| `--report-azdo-flaky-history` | Queries Azure DevOps test result history for the past N days (1-90) and annotates reported failures with flakiness context. Requires `--report-azdo`. |
| `--report-azdo-demote-known-flaky` | Demotes failures that are flaky enough in the Azure DevOps history window (default threshold is 25%) from errors to warnings. Requires `--report-azdo` and `--report-azdo-flaky-history`. |
| `--report-azdo-quarantine-file` | Path to a text file that lists quarantined test fully qualified names or glob patterns. Matching failures are reported as warnings. Requires `--report-azdo`. |
+| `--report-azdo-summary` | Writes a Markdown job summary at the end of the test run and uploads it through `##vso[task.uploadsummary]`. An optional file path argument overrides the default location (`{testResultsDir}/azdo-summary-{tfm}.md`). Requires `--report-azdo`. |
+| `--report-azdo-stackframe-filter` | Adds regex patterns, matched against the fully qualified type prefix of each stack frame, that are skipped when the extension locates the user's call site to annotate. The option is repeatable, up to 16 patterns, and each pattern is compiled with a 500-ms match timeout. These patterns are additive to the extension's built-in MSTest assertion-implementation prefixes. Requires `--report-azdo`. |
| `--report-azdo-upload-artifacts` | Uploads test result files and/or adds build tags to Azure DevOps. Valid values are `off` (default), `tags-only`, `files`, and `all`. |
| `--report-azdo-upload-artifact-include` | Includes files in the Azure DevOps artifact upload using glob patterns relative to the test results directory. Defaults to `**/*`. Requires `--report-azdo-upload-artifacts` to be a value other than `off`. |
| `--report-azdo-upload-artifact-exclude` | Excludes files from the Azure DevOps artifact upload using glob patterns relative to the test results directory. Requires `--report-azdo-upload-artifacts` to be a value other than `off`. |
@@ -69,6 +160,6 @@ builder.TestHost.AddAzureDevOpsProvider();
| `--publish-azdo-run-name` | Sets a custom Azure DevOps test run name for live test-result publishing. Requires `--publish-azdo-test-results`. |
> [!NOTE]
-> The Azure DevOps extension became stable in MTP 1.9.0 (`--report-azdo` and `--report-azdo-severity`). All other options in the table — `--report-azdo-flaky-history`, `--report-azdo-demote-known-flaky`, `--report-azdo-quarantine-file`, `--report-azdo-upload-artifacts`, `--report-azdo-upload-artifact-include`, `--report-azdo-upload-artifact-exclude`, `--report-azdo-upload-artifact-name`, `--publish-azdo-test-results`, and `--publish-azdo-run-name` — are available in MTP starting with version 2.3.0.
+> The Azure DevOps extension became stable in MTP 1.9.0 (`--report-azdo` and `--report-azdo-severity`). All other options in the table — `--report-azdo-flaky-history`, `--report-azdo-demote-known-flaky`, `--report-azdo-quarantine-file`, `--report-azdo-summary`, `--report-azdo-stackframe-filter`, `--report-azdo-upload-artifacts`, `--report-azdo-upload-artifact-include`, `--report-azdo-upload-artifact-exclude`, `--report-azdo-upload-artifact-name`, `--publish-azdo-test-results`, and `--publish-azdo-run-name` — are available in MTP starting with version 2.3.0.
The extension automatically detects that it is running in continuous integration (CI) environment by checking the `TF_BUILD` environment variable.
diff --git a/docs/core/testing/mstest-analyzers/mstest0047.md b/docs/core/testing/mstest-analyzers/mstest0047.md
new file mode 100644
index 0000000000000..c457b017de210
--- /dev/null
+++ b/docs/core/testing/mstest-analyzers/mstest0047.md
@@ -0,0 +1,32 @@
+---
+title: "MSTEST0047: Unused TestContext parameter suppressor."
+description: "Learn about code suppressor MSTEST0047: Unused TestContext parameter suppressor."
+ms.date: 06/16/2026
+ai-usage: ai-assisted
+f1_keywords:
+- MSTEST0047
+- UnusedParameterSuppressor
+helpviewer_keywords:
+- UnusedParameterSuppressor
+- MSTEST0047
+author: Evangelink
+ms.author: amauryleve
+---
+# MSTEST0047: Unused TestContext parameter suppressor
+
+| Property | Value |
+|-------------------------------------|-----------------------------------------------------------|
+| **Rule ID** | MSTEST0047 |
+| **Title** | Suppress IDE0060 for the TestContext parameter |
+| **Category** | Suppressor |
+| **Introduced in version** | 3.10.0 |
+
+## Suppressor description
+
+Suppress the [IDE0060: Remove unused parameter](../../../fundamentals/code-analysis/style-rules/ide0060.md) diagnostic for the parameter of fixture methods.
+
+MSTest lets you receive the `TestContext` as a parameter of fixture methods that are marked with , , , or . Because the parameter is required by MSTest even when your method body doesn't use it, IDE0060 would otherwise incorrectly flag it as unused.
+
+## When to disable suppressor
+
+.NET suppressors cannot be disabled.
diff --git a/docs/core/testing/mstest-analyzers/overview.md b/docs/core/testing/mstest-analyzers/overview.md
index 97d5e82dbdbe6..a3d6eecb3896a 100644
--- a/docs/core/testing/mstest-analyzers/overview.md
+++ b/docs/core/testing/mstest-analyzers/overview.md
@@ -190,6 +190,7 @@ Rules for properly using the TestContext object:
- [MSTEST0005](mstest0005.md) - TestContext should be valid
- [MSTEST0024](mstest0024.md) - Do not store static TestContext
- [MSTEST0033](mstest0033.md) - Suppress non-nullable reference not initialized warning
+- [MSTEST0047](mstest0047.md) - Suppress IDE0060 for the TestContext parameter
- [MSTEST0048](mstest0048.md) - TestContext property usage
- [MSTEST0049](mstest0049.md) - Flow TestContext CancellationToken
- [MSTEST0054](mstest0054.md) - Use CancellationToken property
@@ -262,6 +263,7 @@ Related documentation: [Configure MSTest](../unit-testing-mstest-configure.md),
| [MSTEST0044](mstest0044.md) | Design | Prefer TestMethod over DataTestMethod | Info |
| [MSTEST0045](mstest0045.md) | Design | Use cooperative cancellation for timeout | Info |
| [MSTEST0046](mstest0046.md) | Usage | Use Assert instead of StringAssert | Info |
+| [MSTEST0047](mstest0047.md) | Suppression | Suppress IDE0060 for the TestContext parameter | N/A |
| [MSTEST0048](mstest0048.md) | Usage | TestContext property usage | Warning |
| [MSTEST0049](mstest0049.md) | Usage | Flow TestContext CancellationToken | Info |
| [MSTEST0050](mstest0050.md) | Usage | Global test fixture should be valid | Warning |
diff --git a/docs/core/testing/mstest-analyzers/suppression-rules.md b/docs/core/testing/mstest-analyzers/suppression-rules.md
index c6c665ed534ab..9e48d59f66224 100644
--- a/docs/core/testing/mstest-analyzers/suppression-rules.md
+++ b/docs/core/testing/mstest-analyzers/suppression-rules.md
@@ -17,6 +17,7 @@ Suppression rules automatically suppress diagnostics from other analyzers (like
| [MSTEST0027](mstest0027.md) | Suppress async suffix for test methods. | VSTHRD200 |
| [MSTEST0028](mstest0028.md) | Suppress async suffix for test fixture methods. | VSTHRD200 |
| [MSTEST0033](mstest0033.md) | Suppress non-nullable reference not initialized. | CS8618 |
+| [MSTEST0047](mstest0047.md) | Suppress the unused TestContext parameter of fixture methods. | IDE0060 |
## How suppression rules work
@@ -62,6 +63,26 @@ public class MyTests
}
```
+### IDE0060: Remove unused parameter
+
+**Suppressed by**: [MSTEST0047](mstest0047.md)
+
+**Why suppress**: MSTest lets you receive the `TestContext` as a parameter of fixture methods marked with `[AssemblyInitialize]`, `[ClassInitialize]`, `[GlobalTestInitialize]`, or `[GlobalTestCleanup]`. MSTest requires this parameter even when the method body doesn't use it, so IDE0060 (which flags unused parameters) doesn't apply.
+
+**Example**:
+
+```csharp
+[TestClass]
+public class MyTests
+{
+ [ClassInitialize]
+ public static void ClassInitialize(TestContext context) // IDE0060 would warn without suppression
+ {
+ // context isn't used, but MSTest requires the parameter
+ }
+}
+```
+
## Disable suppression rules
If you prefer to see these warnings, disable the suppression rules in your `.editorconfig`:
@@ -71,6 +92,7 @@ If you prefer to see these warnings, disable the suppression rules in your `.edi
dotnet_diagnostic.MSTEST0027.severity = none
dotnet_diagnostic.MSTEST0028.severity = none
dotnet_diagnostic.MSTEST0033.severity = none
+dotnet_diagnostic.MSTEST0047.severity = none
```
## Related documentation
diff --git a/docs/core/testing/unit-testing-mstest-configure.md b/docs/core/testing/unit-testing-mstest-configure.md
index 8f8458fce636a..21bb023b285e2 100644
--- a/docs/core/testing/unit-testing-mstest-configure.md
+++ b/docs/core/testing/unit-testing-mstest-configure.md
@@ -3,7 +3,8 @@ title: Configure MSTest
description: Learn how to configure MSTest.
author: Evangelink
ms.author: amauryleve
-ms.date: 04/16/2024
+ms.date: 06/16/2026
+ai-usage: ai-assisted
---
# Configure MSTest
@@ -35,6 +36,7 @@ The following runsettings entries let you configure how MSTest behaves.
|**DeployTestSourceDependencies**|true|A value indicating whether the test source references are to be deployed.|
|**EnableBaseClassTestMethodsFromOtherAssemblies**|true|A value indicating whether to enable discovery of test methods from base classes in a different assembly from the inheriting test class.|
|**ForcedLegacyMode**|false|In older versions of Visual Studio, the MSTest adapter was optimized to make it faster and more scalable. Some behavior, such as the order in which tests are run, might not be exactly as it was in previous editions of Visual Studio. Set the value to **true** to use the older test adapter.
For example, you might use this setting if you have an *app.config* file specified for a unit test.
We recommend that you consider refactoring your tests to allow you to use the newer adapter.|
+|**LaunchDebuggerOnTestFailure**|false|Starting with MSTest 4.2, when set to **true**, MSTest launches the debugger when a test fails.|
|**MapInconclusiveToFailed**|false|If a test completes with an inconclusive status, it's mapped to the skipped status in **Test Explorer**. If you want inconclusive tests to be shown as failed, set the value to **true**.|
|**MapNotRunnableToFailed**|true|A value indicating whether a not runnable result is mapped to failed test.|
|**OrderTestsByNameInClass**|false|If you want to run tests by test names both in Test Explorers and on the command line, set this value to **true**.|
@@ -214,6 +216,7 @@ All the settings in this section belong to the `execution` element.
| considerEmptyDataSourceAsInconclusive | false | When set to `true`, an empty data source is considered as inconclusive. |
| considerFixturesAsSpecialTests | false | To display `AssemblyInitialize`, `AssemblyCleanup`, `ClassInitialize`, `ClassCleanup` as individual entries in Visual Studio and Visual Studio Code `Test Explorer` and _.trx_ log, set this value to **true**. |
| mapInconclusiveToFailed | false | If a test completes with an inconclusive status, it's mapped to the skipped status in **Test Explorer**. If you want inconclusive tests to be shown as failed, set the value to **true**. |
+| launchDebuggerOnTestFailure | false | Starting with MSTest 4.2, when set to `true`, MSTest launches the debugger when a test fails. |
| mapNotRunnableToFailed | true | A value indicating whether a not runnable result is mapped to failed test. |
| treatClassAndAssemblyCleanupWarningsAsErrors | false | To see your failures in class cleanups as errors, set this value to **true**. |
| treatDiscoveryWarningsAsErrors | false | To report test discovery warnings as errors, set this value to **true**. |
diff --git a/docs/core/testing/unit-testing-mstest-writing-tests-assertions.md b/docs/core/testing/unit-testing-mstest-writing-tests-assertions.md
index 8e5a690d88834..bcaff37ad6cc0 100644
--- a/docs/core/testing/unit-testing-mstest-writing-tests-assertions.md
+++ b/docs/core/testing/unit-testing-mstest-writing-tests-assertions.md
@@ -3,7 +3,7 @@ title: MSTest assertions
description: Learn about MSTest assertions including Assert, StringAssert, and CollectionAssert classes for validating test results.
author: Evangelink
ms.author: amauryleve
-ms.date: 06/04/2026
+ms.date: 06/16/2026
ai-usage: ai-assisted
---
@@ -34,6 +34,9 @@ Assert.AreEqual(expected, actual, "Values should match after processing");
Use the class to verify that the code under test behaves as expected.
+> [!NOTE]
+> Starting with MSTest 4.0, all `Assert` APIs capture the argument expression and include it in failure messages. This support provides richer diagnostics without a manual `message` parameter.
+
### Common assertion methods
```csharp
@@ -67,6 +70,14 @@ public async Task AssertExamples()
}
```
+### The `Assert.That` method
+
+Starting with MSTest 4.0, `Assert.That` evaluates any Boolean expression and produces a clear failure message. For richer diagnostics, `Assert.That` uses `[CallerArgumentExpression]` to capture the expression text automatically.
+
+```csharp
+Assert.That(order.Total > 0);
+```
+
### Available APIs
-
@@ -79,10 +90,12 @@ public async Task AssertExamples()
-
-
-
+-
-
-
-
-
+-
-
-
-
@@ -92,6 +105,7 @@ public async Task AssertExamples()
-
-
-
+-
-
-
-
@@ -99,11 +113,21 @@ public async Task AssertExamples()
-
-
-
+- `Assert.That`
-
-
-
-
+> [!NOTE]
+> Starting with MSTest 3.8, collection assertions include `Assert.Contains`, `Assert.DoesNotContain`, `Assert.HasCount`, `Assert.IsEmpty`, `Assert.IsNotEmpty`, and `Assert.ContainsSingle`.
+>
+> Starting with MSTest 3.10, comparison assertions include `Assert.IsInRange`, `Assert.IsGreaterThan`, `Assert.IsGreaterThanOrEqualTo`, `Assert.IsLessThan`, `Assert.IsLessThanOrEqualTo`, `Assert.IsPositive`, and `Assert.IsNegative`.
+>
+> Starting with MSTest 3.10, string-matching assertions include `Assert.StartsWith`, `Assert.EndsWith`, `Assert.MatchesRegex`, `Assert.DoesNotStartWith`, `Assert.DoesNotEndWith`, and `Assert.DoesNotMatchRegex`.
+>
+> Starting with MSTest 4.1, `Assert.IsExactInstanceOfType` and `Assert.IsNotExactInstanceOfType` require an exact type match. Unlike `Assert.IsInstanceOfType`, these methods don't match derived types.
+
## The `StringAssert` class
Use the class to compare and examine strings.
diff --git a/docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md b/docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md
index 0bf2091fc2d0f..1ac3889851d9d 100644
--- a/docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md
+++ b/docs/core/testing/unit-testing-mstest-writing-tests-controlling-execution.md
@@ -3,7 +3,8 @@ title: Test execution and control in MSTest
description: Learn how to control test execution in MSTest with parallelization, threading, timeouts, retries, and conditional execution.
author: Evangelink
ms.author: amauryleve
-ms.date: 07/15/2025
+ms.date: 06/16/2026
+ai-usage: ai-assisted
---
# Test execution and control in MSTest
@@ -361,7 +362,7 @@ public class RetryTests
### Custom retry implementations
-Create custom retry logic by inheriting from :
+Starting with MSTest 3.8, create custom retry logic by inheriting from :
```csharp
public class CustomRetryAttribute : RetryBaseAttribute
@@ -386,6 +387,9 @@ Conditional execution attributes control whether tests run based on specific con
The is the abstract base class for conditional execution. MSTest provides several built-in implementations.
+> [!NOTE]
+> The `ConditionBaseAttribute` was introduced in MSTest 3.8.
+
> [!NOTE]
> By default, condition attributes aren't inherited. Applying them to a base class doesn't affect derived classes. Custom condition attributes can override this behavior by redefining `AttributeUsage`, but this isn't recommended to maintain consistency with the built-in condition attributes.
@@ -398,6 +402,9 @@ The i
The runs or skips tests based on the operating system. Use the flags enum to specify which operating systems apply.
+> [!NOTE]
+> The `OSConditionAttribute` was introduced in MSTest 3.8.
+
```csharp
[TestClass]
public class OSSpecificTests
@@ -445,6 +452,9 @@ Combine operating systems with the bitwise OR operator (`|`).
The runs or skips tests based on whether they're executing in a continuous integration environment.
+> [!NOTE]
+> The `CIConditionAttribute` was introduced in MSTest 3.10.
+
```csharp
[TestClass]
public class CIAwareTests
diff --git a/docs/core/testing/unit-testing-mstest-writing-tests-data-driven.md b/docs/core/testing/unit-testing-mstest-writing-tests-data-driven.md
index 568d0d83e56a3..6039045c0dcc8 100644
--- a/docs/core/testing/unit-testing-mstest-writing-tests-data-driven.md
+++ b/docs/core/testing/unit-testing-mstest-writing-tests-data-driven.md
@@ -4,7 +4,7 @@ description: Learn how to use data-driven testing in MSTest with DataRow, Dynami
author: Evangelink
ms.author: amauryleve
ai-usage: ai-assisted
-ms.date: 03/09/2026
+ms.date: 06/16/2026
---
# Data-driven testing in MSTest
@@ -98,6 +98,9 @@ public class DataRowExamples
}
```
+> [!NOTE]
+> Starting with MSTest v3.10, use `DateOnly` and `TimeOnly` as `DataRow` arguments and in `DynamicData` parameterized tests.
+
### Using params for variable arguments
Use the `params` keyword to accept a variable number of arguments:
@@ -117,6 +120,20 @@ public class ParamsExample
}
```
+### Generic test methods
+
+Starting with MSTest v3.8, a `TestMethod` can have type parameters. The framework infers type arguments from `DataRow` or `DynamicData` values:
+
+```csharp
+[TestMethod]
+[DataRow(42)]
+[DataRow("alpha")]
+public void Value_RoundTrips(T value)
+{
+ Assert.AreEqual(value, value);
+}
+```
+
### Custom display names
Set the property to customize how test cases appear in Test Explorer:
@@ -178,7 +195,10 @@ The data source can return any `IEnumerable` where `T` is one of the types li
### Data sources
-The data source can be a method, property, or field. All three are interchangeable—choose based on your preference:
+The data source can be a method or property and, starting with MSTest v3.11, a field. These sources are interchangeable, so choose based on your preference:
+
+> [!NOTE]
+> Starting with MSTest v3.8, `DynamicData` auto-detects the data source type. You don't need to specify `DynamicDataSourceType` explicitly.
```csharp
[TestClass]
@@ -231,6 +251,9 @@ public class DynamicDataExample
> [!NOTE]
> Data source methods, properties, and fields must be `public static` and return an `IEnumerable` of a supported type.
+> [!NOTE]
+> Starting with MSTest v3.11, the data source can be a field. Earlier versions support methods and properties.
+
> [!TIP]
> Related analyzer: [MSTEST0018](mstest-analyzers/mstest0018.md) validates that the data source exists, is accessible, and has the correct signature.
@@ -260,6 +283,19 @@ public class DynamicDataExternalExample
}
```
+### Parameterized `DynamicData` source methods
+
+Starting with MSTest v3.10, pass values to a `DynamicData` source method with the `Arguments` property:
+
+```csharp
+[TestMethod]
+[DynamicData(nameof(GetValues), Arguments = new object[] { true })]
+public void Value_IsPositive(int value, bool expected) => Assert.AreEqual(expected, value > 0);
+
+public static IEnumerable<(int Value, bool Expected)> GetValues(bool includeZero) =>
+ includeZero ? [(1, true), (0, false)] : [(1, true)];
+```
+
### Custom display names
Customize test case display names using the property:
@@ -326,6 +362,9 @@ public class IgnoreDynamicDataExample
The class provides enhanced control over test data in data-driven tests. Use of as your data source return type to specify:
+> [!NOTE]
+> MSTest introduced `TestDataRow` in version 3.8.
+
- **Custom display names**: Set a unique display name per test case using the property.
- **Test categories**: Attach metadata to individual test cases using the property.
- **Ignore messages**: Skip specific test cases with reasons using the property.
diff --git a/docs/core/testing/unit-testing-mstest-writing-tests-lifecycle.md b/docs/core/testing/unit-testing-mstest-writing-tests-lifecycle.md
index 228fa55335082..612d0692db6f5 100644
--- a/docs/core/testing/unit-testing-mstest-writing-tests-lifecycle.md
+++ b/docs/core/testing/unit-testing-mstest-writing-tests-lifecycle.md
@@ -3,7 +3,8 @@ title: MSTest test lifecycle
description: Learn about the creation and lifecycle of test classes and test methods in MSTest, including initialization and cleanup at assembly, class, and test levels.
author: marcelwgn
ms.author: marcelwagner
-ms.date: 07/15/2025
+ms.date: 06/16/2026
+ai-usage: ai-assisted
---
# MSTest lifecycle
@@ -119,6 +120,9 @@ public class ClassLifecycleExample
- `ClassCleanup` accepts zero parameters, or one `TestContext` parameter (MSTest 3.8+)
- Only one of each attribute allowed per class
+> [!NOTE]
+> Starting with MSTest 4.2, MSTest reports failures in `ClassCleanup` and `AssemblyCleanup` as a separate test result. The separate result makes cleanup failures easier to identify in Test Explorer and TRX reports.
+
### Inheritance behavior
Control whether `ClassInitialize` runs for derived classes using :
diff --git a/docs/core/testing/unit-testing-mstest-writing-tests-organizing.md b/docs/core/testing/unit-testing-mstest-writing-tests-organizing.md
index 1de4fb210f206..db58b232371fe 100644
--- a/docs/core/testing/unit-testing-mstest-writing-tests-organizing.md
+++ b/docs/core/testing/unit-testing-mstest-writing-tests-organizing.md
@@ -3,7 +3,8 @@ title: Test organization and metadata in MSTest
description: Learn how to organize and categorize tests in MSTest using categories, properties, priorities, owners, and work item references.
author: Evangelink
ms.author: amauryleve
-ms.date: 07/15/2025
+ms.date: 06/16/2026
+ai-usage: ai-assisted
---
# Test organization and metadata in MSTest
@@ -288,6 +289,9 @@ public class BugFixTests
The links tests to GitHub issues.
+> [!NOTE]
+> The `GitHubWorkItemAttribute` was introduced in MSTest 3.8.
+
```csharp
[TestClass]
public class GitHubLinkedTests
diff --git a/docs/core/testing/unit-testing-mstest-writing-tests-testcontext.md b/docs/core/testing/unit-testing-mstest-writing-tests-testcontext.md
index 7c42a6dd7457f..a64aca5dd84cc 100644
--- a/docs/core/testing/unit-testing-mstest-writing-tests-testcontext.md
+++ b/docs/core/testing/unit-testing-mstest-writing-tests-testcontext.md
@@ -3,7 +3,8 @@ title: MSTest TestContext
description: Learn about the TestContext class of MSTest.
author: Evangelink
ms.author: amauryleve
-ms.date: 11/12/2024
+ms.date: 06/16/2026
+ai-usage: ai-assisted
---
# The `TestContext` class
@@ -41,6 +42,7 @@ The provides inf
- - the directory where the test results are stored. Typically a subdirectory of the .
- - the directory where the test results are stored. Typically a subdirectory of the .
- - the directory where the test results are stored. Typically a subdirectory of the .
+- Starting with MSTest 3.9, - the number of times the current test has run, counting from 1. The value is greater than 1 when a test is retried with `[Retry]`.
In MSTest 3.7 and later, the class also provides new properties helpful for `TestInitialize` and `TestCleanup` methods:
@@ -76,6 +78,13 @@ TestContext.Properties["MyKey"] = "MyValue";
string value = TestContext.Properties["MyKey"]?.ToString();
```
+> [!NOTE]
+> Starting with MSTest 4.2, test categories from `[TestCategory]` are included in .
+
+### Access `TestContext` from the current call stack
+
+Starting with MSTest 4.2, returns the current test's from anywhere in the call stack during test method execution. This API is experimental, uses the `[Experimental]` attribute, and might change in a future MSTest version.
+
### Associate data to a test
The method allows you to add a file to the test results, making it available for review in the test output. This can be useful if you generate files during your test (for example, log files, screenshots, or data files) that you want to attach to the test results.
diff --git a/docs/navigate/devops-testing/toc.yml b/docs/navigate/devops-testing/toc.yml
index 1f4b9de4bb2f0..c2ca8e557ded7 100644
--- a/docs/navigate/devops-testing/toc.yml
+++ b/docs/navigate/devops-testing/toc.yml
@@ -128,6 +128,8 @@ items:
href: ../../core/testing/mstest-analyzers/mstest0028.md
- name: MSTEST0033
href: ../../core/testing/mstest-analyzers/mstest0033.md
+ - name: MSTEST0047
+ href: ../../core/testing/mstest-analyzers/mstest0047.md
- name: Usage rules
items:
- name: Overview