Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .openpublishing.redirection.core.json
Original file line number Diff line number Diff line change
Expand Up @@ -1925,11 +1925,6 @@
"source_path_from_root": "/docs/core/testing/unit-testing-platform-diagnostics.md",
"redirect_url": "/dotnet/core/testing/microsoft-testing-platform-crash-hang-dumps"
},
{
"source_path_from_root": "/docs/core/testing/microsoft-testing-platform-diagnostics.md",
"redirect_url": "/dotnet/core/testing/microsoft-testing-platform-crash-hang-dumps",
"redirect_document_id": false
},
{
"source_path_from_root": "/docs/core/testing/unit-testing-platform-exit-codes.md",
"redirect_url": "/dotnet/core/testing/microsoft-testing-platform-troubleshooting#exit-codes"
Expand Down
42 changes: 42 additions & 0 deletions docs/core/testing/microsoft-testing-platform-diagnostics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: Microsoft.Testing.Platform (MTP) diagnostics
description: Learn about the MTP extensions that capture evidence, such as screen recordings, to help you diagnose a test run.
author: evangelink
ms.author: amauryleve
ms.date: 07/09/2026
ai-usage: ai-assisted
---

# Diagnostics

These extensions capture evidence during a test run so you can diagnose failures after the fact. Each extension requires an additional NuGet package, as described in each section.

> [!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 `<GenerateTestingPlatformEntryPoint>false</GenerateTestingPlatformEntryPoint>`.

For process-level diagnostics, see the related [Crash and hang dumps](microsoft-testing-platform-crash-hang-dumps.md) extensions, which collect process dump files when the test host crashes or hangs.

## Video recorder

The video recorder records the screen while your tests run and attaches the captured videos to the test session as artifacts. Recording is opt-in per run and driven by an external `ffmpeg` process, which must be available on the `PATH` or set through an explicit path. This extension requires the [Microsoft.Testing.Extensions.VideoRecorder](https://nuget.org/packages/Microsoft.Testing.Extensions.VideoRecorder) 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.AddVideoRecorderProvider();
```

### Options

| Option | MTP version | Description |
|---|---|---|
| `--capture-video` | 2.3.0 | Enables screen recording. The optional value controls retention: `on-failure` (default) keeps footage only for failing tests, and `always` keeps footage for every test. |
| `--capture-video-source` | 2.3.0 | Sets the capture source. Valid values are `screen` (default) and `window`. Requires `--capture-video`. |
| `--capture-video-granularity` | 2.3.0 | Sets whether the recorder produces one video per test or one chaptered video for the whole run. Valid values are `test` (default) and `session`. Requires `--capture-video`. |
| `--capture-video-max-duration` | 2.3.0 | Bounds disk usage on long runs by keeping approximately the last N seconds of footage. The value is a positive integer number of seconds. Requires `--capture-video`. |
| `--capture-video-chapters` | 2.3.0 | Sets whether chapter bookmarks are added to the per-session video. Valid values are `on` (default) and `off`. Requires `--capture-video`. |
| `--capture-video-args` | 2.3.0 | Passes extra arguments to the underlying recorder (`ffmpeg`). Requires `--capture-video`. |
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: Microsoft.Testing.Platform (MTP) Microsoft.Extensions integration
description: Learn about the MTP extensions that bridge Microsoft.Testing.Platform to the Microsoft.Extensions.* libraries your application already uses.
author: evangelink
ms.author: amauryleve
ms.date: 07/09/2026
ai-usage: ai-assisted
---

# Microsoft.Extensions integration

These extensions bridge Microsoft.Testing.Platform (MTP) to the `Microsoft.Extensions.*` libraries your application already uses, so platform and extension components flow through the same infrastructure as the rest of your code. Each extension requires an additional NuGet package, as described in each section.

> [!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 `<GenerateTestingPlatformEntryPoint>false</GenerateTestingPlatformEntryPoint>`.

## Logging bridge

The logging bridge forwards Microsoft.Testing.Platform diagnostic logs to <xref:Microsoft.Extensions.Logging.ILogger>, so platform and extension logs flow through the same `Microsoft.Extensions.Logging` pipeline your application already uses. You can reuse an existing logging stack — Console, Debug, Serilog, Application Insights, OpenTelemetry, or a custom `ILoggerProvider` — without writing a custom MTP logger provider. This extension requires the [Microsoft.Testing.Extensions.Logging](https://nuget.org/packages/Microsoft.Testing.Extensions.Logging) 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.

The bridge forwards each message only when the platform's diagnostic logging is enabled. When the platform's effective log level is `None` (the default, unless you pass [`--diagnostic`](microsoft-testing-platform-cli-options.md)), the configuration delegate isn't invoked and no logger factory is created. Per-category filters that you set in the `ILoggingBuilder` can narrow the platform's effective diagnostic level, but they can't widen it.

### Manual registration

```csharp
var builder = await TestApplication.CreateBuilderAsync(args);
builder.AddMicrosoftExtensionsLogging(logging => logging.AddConsole());
```
24 changes: 9 additions & 15 deletions docs/core/testing/microsoft-testing-platform-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ Use the following path based on your goal:
- Need GitHub Actions-native output (log groups, annotations, and job summary): [GitHub Actions report](https://www.nuget.org/packages/Microsoft.Testing.Extensions.GitHubActionsReport) (extension, experimental)
- Need coverage data: [Code coverage](./microsoft-testing-platform-code-coverage.md) (extension)
- Need crash or hang diagnostics: [Crash and hang dumps](./microsoft-testing-platform-crash-hang-dumps.md) (extension)
- Need to record the screen during a run: [Diagnostics](./microsoft-testing-platform-diagnostics.md) (extension, experimental)
- Need to deploy and launch a packaged-app test host: [Test host deployment](./microsoft-testing-platform-test-host-deployment.md) (extension, experimental)
- Need to route platform logs through `Microsoft.Extensions.Logging`: [Microsoft.Extensions integration](./microsoft-testing-platform-extensions-integration.md) (extension, experimental)
- Need to retry failed tests: [Retry](./microsoft-testing-platform-retry.md#retry) (extension)
- Need hot reload support: [Hot Reload](./microsoft-testing-platform-hot-reload.md) (extension)
- Need Microsoft Fakes support: [Microsoft Fakes](./microsoft-testing-platform-fakes.md) (extension)
Expand Down Expand Up @@ -88,23 +91,14 @@ Run tests that use Microsoft Fakes for stubs and shims.

Telemetry collection. Learn how to opt out and what data is collected.

**[Video recorder](https://www.nuget.org/packages/Microsoft.Testing.Extensions.VideoRecorder)** (experimental, introduced in MTP 2.3.0)
**[Diagnostics](./microsoft-testing-platform-diagnostics.md)** (experimental, introduced in MTP 2.3.0)

Record the screen during a test run. It requires `ffmpeg` to be available on the machine and is enabled with the `--capture-video` option. Register it manually with `builder.AddVideoRecorderProvider()`.
Capture evidence to diagnose a run, such as recording the screen with the video recorder.

**[Packaged app deployment](https://www.nuget.org/packages/Microsoft.Testing.Extensions.PackagedApp)** (experimental, introduced in MTP 2.3.0)
**[Test host deployment](./microsoft-testing-platform-test-host-deployment.md)** (experimental, introduced in MTP 2.3.0)

A reference extension that uses the experimental `ITestHostLauncher` extension point to deploy and launch a packaged-app test host. Register it manually with `builder.AddPackagedAppDeployment()`.
Control how and where the test host is deployed and launched, such as deploying and launching a packaged-app test host.

## Microsoft.Extensions integration
**[Microsoft.Extensions integration](./microsoft-testing-platform-extensions-integration.md)** (experimental, introduced in MTP 2.3.0)

These extensions bridge Microsoft.Testing.Platform to the `Microsoft.Extensions.*` libraries your application already uses.

**[Logging bridge](https://www.nuget.org/packages/Microsoft.Testing.Extensions.Logging)** (experimental, introduced in MTP 2.3.0)

The Microsoft.Testing.Extensions.Logging package bridges Microsoft.Testing.Platform diagnostics to <xref:Microsoft.Extensions.Logging.ILogger>, so platform and extension logs flow through the same `Microsoft.Extensions.Logging` pipeline your application already uses. Register it manually with the following call:

```csharp
var builder = await TestApplication.CreateBuilderAsync(args);
builder.AddMicrosoftExtensionsLogging(logging => logging.AddConsole());
```
Bridge platform and extension diagnostics into the `Microsoft.Extensions.*` libraries your application already uses, such as forwarding logs through the `Microsoft.Extensions.Logging` pipeline.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: Microsoft.Testing.Platform (MTP) test host deployment
description: Learn about the MTP extensions that control how and where the test host is deployed and launched.
author: evangelink
ms.author: amauryleve
ms.date: 07/09/2026
ai-usage: ai-assisted
---

# Test host deployment

These extensions control how and where the test host is deployed and launched. They build on the experimental `ITestHostLauncher` extension point, which lets an extension take over the deployment and launch of the test host instead of starting it in place. Each extension requires an additional NuGet package, as described in each section.

> [!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 `<GenerateTestingPlatformEntryPoint>false</GenerateTestingPlatformEntryPoint>`.

## Packaged app deployment

The packaged app deployment extension deploys a packaged Windows test host (UWP or packaged WinUI) into an isolated directory and launches it from there, rather than starting the test host in place. It's the reference consumer of the experimental `ITestHostLauncher` extension point for packaged Windows apps. This extension requires the [Microsoft.Testing.Extensions.PackagedApp](https://nuget.org/packages/Microsoft.Testing.Extensions.PackagedApp) 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.AddPackagedAppDeployment();
```
9 changes: 9 additions & 0 deletions docs/navigate/devops-testing/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,15 @@ items:
- name: Crash and hang dumps
href: ../../core/testing/microsoft-testing-platform-crash-hang-dumps.md
displayName: MTP,crash dump,hang dump,diagnostics
- name: Diagnostics
href: ../../core/testing/microsoft-testing-platform-diagnostics.md
displayName: MTP,diagnostics,video recorder,screen recording,capture video
- name: Test host deployment
href: ../../core/testing/microsoft-testing-platform-test-host-deployment.md
displayName: MTP,test host,deployment,packaged app,UWP,WinUI,ITestHostLauncher
- name: Microsoft.Extensions integration
href: ../../core/testing/microsoft-testing-platform-extensions-integration.md
displayName: MTP,Microsoft.Extensions,logging bridge,ILogger,Microsoft.Extensions.Logging
- name: OpenTelemetry
href: ../../core/testing/microsoft-testing-platform-open-telemetry.md
displayName: MTP,OpenTelemetry,traces,metrics
Expand Down
Loading