From 91cc9093b4a0158adc95b433cb97fcccb1b3db10 Mon Sep 17 00:00:00 2001 From: "azure-sdk-automation[bot]" <191533747+azure-sdk-automation[bot]@users.noreply.github.com> Date: Tue, 29 Sep 2026 09:35:40 -0700 Subject: [PATCH 1/3] Update package index with latest published versions (#56282) Co-authored-by: azure-sdk --- docs/azure/includes/dotnet-all.md | 7 ++++--- docs/azure/includes/dotnet-new.md | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/azure/includes/dotnet-all.md b/docs/azure/includes/dotnet-all.md index cdeb439dfbc49..7d841fc7d9cd5 100644 --- a/docs/azure/includes/dotnet-all.md +++ b/docs/azure/includes/dotnet-all.md @@ -154,7 +154,7 @@ | Provisioning | NuGet [1.6.0](https://www.nuget.org/packages/Azure.Provisioning/1.6.0) | [docs](/dotnet/api/overview/azure/Provisioning-readme) | GitHub [1.6.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning_1.6.0/sdk/provisioning/Azure.Provisioning/) | | Provisioning - API Management | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.ApiManagement/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.ApiManagement-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ApiManagement_1.0.0-beta.1/sdk/apimanagement/Azure.Provisioning.ApiManagement/) | | Provisioning - App Configuration | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.AppConfiguration/1.1.0)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.AppConfiguration/1.2.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.AppConfiguration-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppConfiguration_1.1.0/sdk/appconfiguration/Azure.Provisioning.AppConfiguration/)
GitHub [1.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppConfiguration_1.2.0-beta.2/sdk/appconfiguration/Azure.Provisioning.AppConfiguration/) | -| Provisioning - App Service | NuGet [1.3.1](https://www.nuget.org/packages/Azure.Provisioning.AppService/1.3.1)
NuGet [1.4.0-beta.3](https://www.nuget.org/packages/Azure.Provisioning.AppService/1.4.0-beta.3) | [docs](/dotnet/api/overview/azure/Provisioning.AppService-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppService_1.3.1/sdk/provisioning/Azure.Provisioning.AppService/)
GitHub [1.4.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppService_1.4.0-beta.3/sdk/provisioning/Azure.Provisioning.AppService/) | +| Provisioning - App Service | NuGet [1.3.1](https://www.nuget.org/packages/Azure.Provisioning.AppService/1.3.1)
NuGet [1.4.0-beta.3](https://www.nuget.org/packages/Azure.Provisioning.AppService/1.4.0-beta.3) | [docs](/dotnet/api/overview/azure/Provisioning.AppService-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppService_1.3.1/sdk/websites/Azure.Provisioning.AppService/)
GitHub [1.4.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppService_1.4.0-beta.3/sdk/websites/Azure.Provisioning.AppService/) | | Provisioning - Application Insights | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.ApplicationInsights/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.ApplicationInsights/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.ApplicationInsights-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ApplicationInsights_1.1.0/sdk/provisioning/Azure.Provisioning.ApplicationInsights/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ApplicationInsights_1.2.0-beta.1/sdk/provisioning/Azure.Provisioning.ApplicationInsights/) | | Provisioning - Attestation | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Attestation/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Attestation-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Attestation_1.0.0-beta.1/sdk/attestation/Azure.Provisioning.Attestation/) | | Provisioning - Batch | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Batch/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Batch-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Batch_1.0.0-beta.1/sdk/batch/Azure.Provisioning.Batch/) | @@ -162,7 +162,7 @@ | Provisioning - Cognitive Services | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Provisioning.CognitiveServices/1.2.0)
NuGet [1.3.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.CognitiveServices/1.3.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.CognitiveServices-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.CognitiveServices_1.2.0/sdk/cognitiveservices/Azure.Provisioning.CognitiveServices/)
GitHub [1.3.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.CognitiveServices_1.3.0-beta.1/sdk/cognitiveservices/Azure.Provisioning.CognitiveServices/) | | Provisioning - Communication | NuGet [1.0.0-beta.5](https://www.nuget.org/packages/Azure.Provisioning.Communication/1.0.0-beta.5) | [docs](/dotnet/api/overview/azure/Provisioning.Communication-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Communication_1.0.0-beta.5/sdk/communication/Azure.Provisioning.Communication/) | | Provisioning - Compute | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.Compute/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.Compute-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Compute_1.0.0-beta.2/sdk/compute/Azure.Provisioning.Compute/) | -| Provisioning - Container Apps | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Provisioning.AppContainers/1.2.0)
NuGet [1.3.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.AppContainers/1.3.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.AppContainers-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppContainers_1.2.0/sdk/provisioning/Azure.Provisioning.AppContainers/)
GitHub [1.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppContainers_1.3.0-beta.2/sdk/provisioning/Azure.Provisioning.AppContainers/) | +| Provisioning - Container Apps | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Provisioning.AppContainers/1.2.0)
NuGet [1.3.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.AppContainers/1.3.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.AppContainers-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppContainers_1.2.0/sdk/containerapps/Azure.Provisioning.AppContainers/)
GitHub [1.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppContainers_1.3.0-beta.2/sdk/containerapps/Azure.Provisioning.AppContainers/) | | Provisioning - Container Instances | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.ContainerInstance/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.ContainerInstance-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ContainerInstance_1.0.0-beta.1/sdk/containerinstance/Azure.Provisioning.ContainerInstance/) | | Provisioning - Container Registry | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.ContainerRegistry/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.ContainerRegistry-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ContainerRegistry_1.1.0/sdk/provisioning/Azure.Provisioning.ContainerRegistry/) | | Provisioning - Container Service | NuGet [1.0.0-beta.6](https://www.nuget.org/packages/Azure.Provisioning.ContainerService/1.0.0-beta.6) | [docs](/dotnet/api/overview/azure/Provisioning.ContainerService-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ContainerService_1.0.0-beta.6/sdk/containerservice/Azure.Provisioning.ContainerService/) | @@ -316,7 +316,7 @@ | Resource Management - Event Grid | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.EventGrid/1.1.0)
NuGet [1.2.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.EventGrid/1.2.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.EventGrid-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EventGrid_1.1.0/sdk/eventgrid/Azure.ResourceManager.EventGrid/)
GitHub [1.2.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EventGrid_1.2.0-beta.3/sdk/eventgrid/Azure.ResourceManager.EventGrid/) | | Resource Management - Event Hubs | NuGet [1.3.0](https://www.nuget.org/packages/Azure.ResourceManager.EventHubs/1.3.0)
NuGet [1.4.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.EventHubs/1.4.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.EventHubs-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EventHubs_1.3.0/sdk/eventhub/Azure.ResourceManager.EventHubs/)
GitHub [1.4.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EventHubs_1.4.0-beta.1/sdk/eventhub/Azure.ResourceManager.EventHubs/) | | Resource Management - Extended Location | NuGet [1.1.2](https://www.nuget.org/packages/Azure.ResourceManager.ExtendedLocations/1.1.2) | [docs](/dotnet/api/overview/azure/ResourceManager.ExtendedLocations-readme) | GitHub [1.1.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ExtendedLocations_1.1.2/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/) | -| Resource Management - Fabric | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.Fabric/1.0.0)
NuGet [1.1.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.Fabric/1.1.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.Fabric-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Fabric_1.0.0/sdk/fabric/Azure.ResourceManager.Fabric/)
GitHub [1.1.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Fabric_1.1.0-beta.3/sdk/fabric/Azure.ResourceManager.Fabric/) | +| Resource Management - Fabric | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.Fabric/1.0.0)
NuGet [1.1.0-beta.4](https://www.nuget.org/packages/Azure.ResourceManager.Fabric/1.1.0-beta.4) | [docs](/dotnet/api/overview/azure/ResourceManager.Fabric-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Fabric_1.0.0/sdk/fabric/Azure.ResourceManager.Fabric/)
GitHub [1.1.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Fabric_1.1.0-beta.4/sdk/fabric/Azure.ResourceManager.Fabric/) | | Resource Management - File Shares | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.FileShares/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.FileShares-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.FileShares_1.0.0/sdk/fileshares/Azure.ResourceManager.FileShares/) | | Resource Management - Fluid Relay | NuGet [1.1.2](https://www.nuget.org/packages/Azure.ResourceManager.FluidRelay/1.1.2) | [docs](/dotnet/api/overview/azure/ResourceManager.FluidRelay-readme) | GitHub [1.1.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.FluidRelay_1.1.2/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/) | | Resource Management - Front Door | NuGet [1.4.2](https://www.nuget.org/packages/Azure.ResourceManager.FrontDoor/1.4.2) | [docs](/dotnet/api/overview/azure/ResourceManager.FrontDoor-readme) | GitHub [1.4.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.FrontDoor_1.4.2/sdk/frontdoor/Azure.ResourceManager.FrontDoor/) | @@ -551,6 +551,7 @@ | Speech Extension ONNX Runtime | NuGet [1.52.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Extension.ONNX.Runtime/1.52.0) | | | | Speech Extension Telemetry | NuGet [1.52.0](https://www.nuget.org/packages/Microsoft.CognitiveServices.Speech.Extension.Telemetry/1.52.0) | | | | System Net Client Model | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/System.Net.ClientModel/1.0.0-beta.1) | | | +| unknown | NuGet [2.0.0-preview](https://www.nuget.org/packages/Microsoft.Azure.Iot.Device/2.0.0-preview) | | | | unknown | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Microsoft.Azure.WebPubSub.Emulator/1.0.0-beta.1) | | | | WebJobs Extension Cosmos DB Mongo | NuGet [1.2.2](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.AzureCosmosDb.Mongo/1.2.2)
NuGet [1.2.5-preview](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.AzureCosmosDb.Mongo/1.2.5-preview) | | | | WebJobs Extension MySQL | NuGet [1.0.130](https://www.nuget.org/packages/Microsoft.Azure.WebJobs.Extensions.MySql/1.0.130) | | | diff --git a/docs/azure/includes/dotnet-new.md b/docs/azure/includes/dotnet-new.md index 910a0c3d48414..19b67502f6305 100644 --- a/docs/azure/includes/dotnet-new.md +++ b/docs/azure/includes/dotnet-new.md @@ -167,7 +167,7 @@ | Provisioning | NuGet [1.6.0](https://www.nuget.org/packages/Azure.Provisioning/1.6.0) | [docs](/dotnet/api/overview/azure/Provisioning-readme) | GitHub [1.6.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning_1.6.0/sdk/provisioning/Azure.Provisioning/) | | Provisioning - API Management | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.ApiManagement/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.ApiManagement-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ApiManagement_1.0.0-beta.1/sdk/apimanagement/Azure.Provisioning.ApiManagement/) | | Provisioning - App Configuration | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.AppConfiguration/1.1.0)
NuGet [1.2.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.AppConfiguration/1.2.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.AppConfiguration-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppConfiguration_1.1.0/sdk/appconfiguration/Azure.Provisioning.AppConfiguration/)
GitHub [1.2.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppConfiguration_1.2.0-beta.2/sdk/appconfiguration/Azure.Provisioning.AppConfiguration/) | -| Provisioning - App Service | NuGet [1.3.1](https://www.nuget.org/packages/Azure.Provisioning.AppService/1.3.1)
NuGet [1.4.0-beta.3](https://www.nuget.org/packages/Azure.Provisioning.AppService/1.4.0-beta.3) | [docs](/dotnet/api/overview/azure/Provisioning.AppService-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppService_1.3.1/sdk/provisioning/Azure.Provisioning.AppService/)
GitHub [1.4.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppService_1.4.0-beta.3/sdk/provisioning/Azure.Provisioning.AppService/) | +| Provisioning - App Service | NuGet [1.3.1](https://www.nuget.org/packages/Azure.Provisioning.AppService/1.3.1)
NuGet [1.4.0-beta.3](https://www.nuget.org/packages/Azure.Provisioning.AppService/1.4.0-beta.3) | [docs](/dotnet/api/overview/azure/Provisioning.AppService-readme) | GitHub [1.3.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppService_1.3.1/sdk/websites/Azure.Provisioning.AppService/)
GitHub [1.4.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppService_1.4.0-beta.3/sdk/websites/Azure.Provisioning.AppService/) | | Provisioning - Application Insights | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.ApplicationInsights/1.1.0)
NuGet [1.2.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.ApplicationInsights/1.2.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.ApplicationInsights-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ApplicationInsights_1.1.0/sdk/provisioning/Azure.Provisioning.ApplicationInsights/)
GitHub [1.2.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ApplicationInsights_1.2.0-beta.1/sdk/provisioning/Azure.Provisioning.ApplicationInsights/) | | Provisioning - Attestation | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Attestation/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Attestation-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Attestation_1.0.0-beta.1/sdk/attestation/Azure.Provisioning.Attestation/) | | Provisioning - Batch | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.Batch/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.Batch-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Batch_1.0.0-beta.1/sdk/batch/Azure.Provisioning.Batch/) | @@ -175,7 +175,7 @@ | Provisioning - Cognitive Services | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Provisioning.CognitiveServices/1.2.0)
NuGet [1.3.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.CognitiveServices/1.3.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.CognitiveServices-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.CognitiveServices_1.2.0/sdk/cognitiveservices/Azure.Provisioning.CognitiveServices/)
GitHub [1.3.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.CognitiveServices_1.3.0-beta.1/sdk/cognitiveservices/Azure.Provisioning.CognitiveServices/) | | Provisioning - Communication | NuGet [1.0.0-beta.5](https://www.nuget.org/packages/Azure.Provisioning.Communication/1.0.0-beta.5) | [docs](/dotnet/api/overview/azure/Provisioning.Communication-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.5](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Communication_1.0.0-beta.5/sdk/communication/Azure.Provisioning.Communication/) | | Provisioning - Compute | NuGet [1.0.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.Compute/1.0.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.Compute-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.Compute_1.0.0-beta.2/sdk/compute/Azure.Provisioning.Compute/) | -| Provisioning - Container Apps | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Provisioning.AppContainers/1.2.0)
NuGet [1.3.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.AppContainers/1.3.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.AppContainers-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppContainers_1.2.0/sdk/provisioning/Azure.Provisioning.AppContainers/)
GitHub [1.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppContainers_1.3.0-beta.2/sdk/provisioning/Azure.Provisioning.AppContainers/) | +| Provisioning - Container Apps | NuGet [1.2.0](https://www.nuget.org/packages/Azure.Provisioning.AppContainers/1.2.0)
NuGet [1.3.0-beta.2](https://www.nuget.org/packages/Azure.Provisioning.AppContainers/1.3.0-beta.2) | [docs](/dotnet/api/overview/azure/Provisioning.AppContainers-readme) | GitHub [1.2.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppContainers_1.2.0/sdk/containerapps/Azure.Provisioning.AppContainers/)
GitHub [1.3.0-beta.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.AppContainers_1.3.0-beta.2/sdk/containerapps/Azure.Provisioning.AppContainers/) | | Provisioning - Container Instances | NuGet [1.0.0-beta.1](https://www.nuget.org/packages/Azure.Provisioning.ContainerInstance/1.0.0-beta.1) | [docs](/dotnet/api/overview/azure/Provisioning.ContainerInstance-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ContainerInstance_1.0.0-beta.1/sdk/containerinstance/Azure.Provisioning.ContainerInstance/) | | Provisioning - Container Registry | NuGet [1.1.0](https://www.nuget.org/packages/Azure.Provisioning.ContainerRegistry/1.1.0) | [docs](/dotnet/api/overview/azure/Provisioning.ContainerRegistry-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ContainerRegistry_1.1.0/sdk/provisioning/Azure.Provisioning.ContainerRegistry/) | | Provisioning - Container Service | NuGet [1.0.0-beta.6](https://www.nuget.org/packages/Azure.Provisioning.ContainerService/1.0.0-beta.6) | [docs](/dotnet/api/overview/azure/Provisioning.ContainerService-readme?view=azure-dotnet-preview&preserve-view=true) | GitHub [1.0.0-beta.6](https://github.com/Azure/azure-sdk-for-net/tree/Azure.Provisioning.ContainerService_1.0.0-beta.6/sdk/containerservice/Azure.Provisioning.ContainerService/) | @@ -333,7 +333,7 @@ | Resource Management - Event Grid | NuGet [1.1.0](https://www.nuget.org/packages/Azure.ResourceManager.EventGrid/1.1.0)
NuGet [1.2.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.EventGrid/1.2.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.EventGrid-readme) | GitHub [1.1.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EventGrid_1.1.0/sdk/eventgrid/Azure.ResourceManager.EventGrid/)
GitHub [1.2.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EventGrid_1.2.0-beta.3/sdk/eventgrid/Azure.ResourceManager.EventGrid/) | | Resource Management - Event Hubs | NuGet [1.3.0](https://www.nuget.org/packages/Azure.ResourceManager.EventHubs/1.3.0)
NuGet [1.4.0-beta.1](https://www.nuget.org/packages/Azure.ResourceManager.EventHubs/1.4.0-beta.1) | [docs](/dotnet/api/overview/azure/ResourceManager.EventHubs-readme) | GitHub [1.3.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EventHubs_1.3.0/sdk/eventhub/Azure.ResourceManager.EventHubs/)
GitHub [1.4.0-beta.1](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.EventHubs_1.4.0-beta.1/sdk/eventhub/Azure.ResourceManager.EventHubs/) | | Resource Management - Extended Location | NuGet [1.1.2](https://www.nuget.org/packages/Azure.ResourceManager.ExtendedLocations/1.1.2) | [docs](/dotnet/api/overview/azure/ResourceManager.ExtendedLocations-readme) | GitHub [1.1.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.ExtendedLocations_1.1.2/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/) | -| Resource Management - Fabric | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.Fabric/1.0.0)
NuGet [1.1.0-beta.3](https://www.nuget.org/packages/Azure.ResourceManager.Fabric/1.1.0-beta.3) | [docs](/dotnet/api/overview/azure/ResourceManager.Fabric-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Fabric_1.0.0/sdk/fabric/Azure.ResourceManager.Fabric/)
GitHub [1.1.0-beta.3](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Fabric_1.1.0-beta.3/sdk/fabric/Azure.ResourceManager.Fabric/) | +| Resource Management - Fabric | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.Fabric/1.0.0)
NuGet [1.1.0-beta.4](https://www.nuget.org/packages/Azure.ResourceManager.Fabric/1.1.0-beta.4) | [docs](/dotnet/api/overview/azure/ResourceManager.Fabric-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Fabric_1.0.0/sdk/fabric/Azure.ResourceManager.Fabric/)
GitHub [1.1.0-beta.4](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.Fabric_1.1.0-beta.4/sdk/fabric/Azure.ResourceManager.Fabric/) | | Resource Management - File Shares | NuGet [1.0.0](https://www.nuget.org/packages/Azure.ResourceManager.FileShares/1.0.0) | [docs](/dotnet/api/overview/azure/ResourceManager.FileShares-readme) | GitHub [1.0.0](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.FileShares_1.0.0/sdk/fileshares/Azure.ResourceManager.FileShares/) | | Resource Management - Fluid Relay | NuGet [1.1.2](https://www.nuget.org/packages/Azure.ResourceManager.FluidRelay/1.1.2) | [docs](/dotnet/api/overview/azure/ResourceManager.FluidRelay-readme) | GitHub [1.1.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.FluidRelay_1.1.2/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/) | | Resource Management - Front Door | NuGet [1.4.2](https://www.nuget.org/packages/Azure.ResourceManager.FrontDoor/1.4.2) | [docs](/dotnet/api/overview/azure/ResourceManager.FrontDoor-readme) | GitHub [1.4.2](https://github.com/Azure/azure-sdk-for-net/tree/Azure.ResourceManager.FrontDoor_1.4.2/sdk/frontdoor/Azure.ResourceManager.FrontDoor/) | From 9d2504da620a878ce877050bb13e01d53c003aed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Thu, 1 Oct 2026 09:40:32 +0200 Subject: [PATCH 2/3] Document MSTest Windows app support (#56292) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .../microsoft-testing-platform-features.md | 6 +- .../microsoft-testing-platform-intro.md | 6 +- ...t-testing-platform-test-host-deployment.md | 73 +++++- docs/core/testing/test-platforms-overview.md | 10 +- .../unit-testing-mstest-getting-started.md | 8 +- .../core/testing/unit-testing-mstest-intro.md | 24 +- .../unit-testing-mstest-running-tests.md | 2 +- docs/core/testing/unit-testing-mstest-sdk.md | 23 +- .../core/testing/unit-testing-mstest-winui.md | 220 ++++++++---------- docs/navigate/devops-testing/toc.yml | 2 +- 10 files changed, 212 insertions(+), 162 deletions(-) diff --git a/docs/core/testing/microsoft-testing-platform-features.md b/docs/core/testing/microsoft-testing-platform-features.md index 0dd297e6ef6c8..d5350fcd18395 100644 --- a/docs/core/testing/microsoft-testing-platform-features.md +++ b/docs/core/testing/microsoft-testing-platform-features.md @@ -35,7 +35,7 @@ Use the following path based on your goal: - 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 deploy and launch a packaged full-trust, UWP, or AppContainer 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 build editor or IDE integration: [Server mode](./microsoft-testing-platform-server-mode.md) (built-in) - Need to load extensions that aren't compile-time references: [Dynamic extension loading](./microsoft-testing-platform-architecture-extensions.md#load-extensions-dynamically) (built-in, opt-in) @@ -106,9 +106,9 @@ Telemetry collection. Learn how to opt out and what data is collected. Capture evidence to diagnose a run, such as recording the screen with the video recorder. -**[Test host deployment](./microsoft-testing-platform-test-host-deployment.md)** (experimental, introduced in MTP 2.3.0) +**[Test host deployment](./microsoft-testing-platform-test-host-deployment.md)** (experimental, introduced in MTP 2.3.0; UWP and AppContainer support introduced in MTP 2.5) -Control how and where the test host is deployed and launched, such as deploying and launching a packaged-app test host. +Control how and where the test host is deployed and launched, including packaged full-trust, UWP, and AppContainer test hosts. **[Microsoft.Extensions integration](./microsoft-testing-platform-extensions-integration.md)** (experimental, introduced in MTP 2.3.0) diff --git a/docs/core/testing/microsoft-testing-platform-intro.md b/docs/core/testing/microsoft-testing-platform-intro.md index 38e4508c74742..44fe93d74a36a 100644 --- a/docs/core/testing/microsoft-testing-platform-intro.md +++ b/docs/core/testing/microsoft-testing-platform-intro.md @@ -3,7 +3,7 @@ title: Microsoft.Testing.Platform overview - .NET test runner description: Learn about Microsoft.Testing.Platform (MTP), a lightweight and portable .NET test runner and VSTest alternative for running unit tests in CI pipelines, CLI, and IDEs. author: Evangelink ms.author: amauryleve -ms.date: 08/26/2026 +ms.date: 09/30/2026 ai-usage: ai-assisted --- @@ -26,7 +26,7 @@ Use the following path, based on what you need next: - Understand platform behavior in CLI: [Testing with `dotnet test`](./unit-testing-with-dotnet-test.md) - Find platform and extension CLI switches in one place: [MTP CLI options reference](./microsoft-testing-platform-cli-options.md) - Configure framework runners: [Run tests with MSTest](./unit-testing-mstest-running-tests.md) or [MTP support in NUnit (NUnit runner)](./unit-testing-nunit-runner-intro.md) -- Host MTP in a WinUI 3 app: [Test WinUI 3 apps with MSTest and MTP](./unit-testing-mstest-winui.md) +- Host MTP in a UWP or WinUI 3 app: [Test UWP and WinUI 3 apps with MSTest and MTP](./unit-testing-mstest-winui.md) - Migrate an existing VSTest setup: [Migrate from VSTest to MTP](./migrating-vstest-microsoft-testing-platform.md) - Add diagnostics, coverage, and reporting: [MTP features](./microsoft-testing-platform-features.md) - Build your own extension: [MTP architecture](./microsoft-testing-platform-architecture.md), [Extension points](./microsoft-testing-platform-architecture-extensions.md), and [Services](./microsoft-testing-platform-architecture-services.md) @@ -67,6 +67,8 @@ The main driving factors for the evolution of the new testing platform are detai MTP supports .NET (.NET 8 and later), .NET Framework (versions 4.6.2 and later), and targets NETStandard 2.0 for maximum compatibility with other runtimes. +Starting with MTP 2.5 and MSTest 4.5, MTP also supports classic UWP, modern .NET UWP, and WinUI 3 AppContainer test hosts through the MSTest.Sdk app-model sidecar. Packaged full-trust and unpackaged WinUI 3 test hosts are also supported. For details, see [Test UWP and WinUI 3 apps with MSTest and MTP](unit-testing-mstest-winui.md). + ## Run and debug tests For detailed guidance on running and debugging MTP test projects from CLI, Visual Studio, Visual Studio Code, and CI pipelines, see [Run and debug tests](./microsoft-testing-platform-run-and-debug.md). diff --git a/docs/core/testing/microsoft-testing-platform-test-host-deployment.md b/docs/core/testing/microsoft-testing-platform-test-host-deployment.md index d9aaa1c4160ad..dbde0a52a583c 100644 --- a/docs/core/testing/microsoft-testing-platform-test-host-deployment.md +++ b/docs/core/testing/microsoft-testing-platform-test-host-deployment.md @@ -3,37 +3,90 @@ title: Microsoft.Testing.Platform (MTP) test host deployment description: Learn how MTP extensions control test host deployment and startup. author: evangelink ms.author: amauryleve -ms.date: 08/06/2026 +ms.date: 09/30/2026 ai-usage: ai-assisted --- # Test host deployment -These extensions control how and where MTP deploys and starts the test host. They use the experimental `ITestHostLauncher` extension point to control test host deployment and startup. Each extension requires another NuGet package, as described in each section. +These extensions control how and where MTP deploys and starts the test host. They use the experimental `ITestHostLauncher` extension point to control test host deployment and startup. > [!TIP] > When you use [Microsoft.Testing.Platform.MSBuild](https://www.nuget.org/packages/Microsoft.Testing.Platform.MSBuild), install an extension's NuGet package to register the extension automatically. MSTest, NUnit, and xUnit runners include `Microsoft.Testing.Platform.MSBuild` transitively. If you disable the generated entry point, call `AddSelfRegisteredExtensions` to register the packages that MSBuild contributes. ## Packaged app deployment -The packaged-app extension registers a full-trust packaged Windows test host from its build-output layout and activates it by Application User Model ID (AUMID). 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. +The [Microsoft.Testing.Extensions.PackagedApp](https://www.nuget.org/packages/Microsoft.Testing.Extensions.PackagedApp) extension registers a packaged Windows test host from its build-output layout and activates it by Application User Model ID (AUMID). -> [!NOTE] -> The extension package is available starting with MTP version 2.3.0. Full-trust MSIX registration and AUMID activation are implemented in the `microsoft/testfx` repository but aren't available in a public NuGet package as of August 6, 2026. The extension is experimental, and its options and output format might change in a future version. +The package was introduced in MTP 2.3. Starting with MTP 2.5, it supports packaged full-trust and AppContainer hosts end to end, including: + +- Packaged full-trust WinUI 3 apps. +- Modern UWP apps that use `UseUwp`. +- Classic UWP apps that target `uap10.0`. +- WinUI 3 `packagedClassicApp` hosts that set `TrustLevel="appContainer"`. + +MSTest.Sdk 4.5 or later configures this extension and the required full-trust app-model sidecar automatically. For application setup and run commands, see [Test UWP and WinUI 3 apps with MSTest and MTP](unit-testing-mstest-winui.md). + +> [!CAUTION] +> `Microsoft.Testing.Extensions.PackagedApp` and the `ITestHostLauncher` extension point are experimental. A future release might change their APIs and behavior. + +### Meet the requirements Meet these requirements before you use the extension: -- Target Windows platform version `10.0.19041.0` or later. +- Target Windows platform version `10.0.19041.0` or later for a WinUI 3 packaged app. - To register an unsigned build-output layout, enable Developer Mode or configure sideloading. -- Use a full-trust packaged desktop host. The extension doesn't support classic UWP, modern .NET UWP with `UseUwp`, or other AppContainer hosts. +- For UWP, use desktop MSBuild from Visual Studio with the UWP workload and required Windows SDK. +- Run AppContainer test hosts from a non-elevated controller process. + +### Understand package activation + +For a packaged app, the launcher: + +1. Locates the `AppxManifest.xml` that describes the test executable. +1. Registers the build-output layout for the current user. +1. Resolves the selected manifest application's AUMID. +1. Activates the application and connects it to the MTP controller. + +For `packagedClassicApp` and `win32App` hosts, Windows supplies MTP arguments through the normal process argument array. This behavior also applies to a `packagedClassicApp` that uses AppContainer. + +For a UWP `windowsApp`, Windows supplies one opaque activation string through `LaunchActivatedEventArgs.Arguments`. In `OnLaunched`, call `PackagedAppExtensions.GetTestApplicationArguments` before you create the MTP builder. + +### Connect an AppContainer host + +An AppContainer token includes a restricted package SID. A named pipe that authorizes only the current user rejects the AppContainer process even when it belongs to the same signed-in user. + +In MTP 2.5 or later, the packaged-app launcher derives the selected application's exact package SID and asks MTP to grant that SID the minimum client rights on the controller and extension pipes. The extension doesn't grant `ALL APPLICATION PACKAGES`, lower the pipe's integrity level, or require a network loopback exemption. + +The sidecar transfers controller metadata through package `LocalState`. It also copies TRX, dump, diagnostic, and retry artifacts from package-owned storage to the requested results directory after the sandboxed host exits. + +### Control automatic activation + +By default, the launcher enables itself only when it finds a package manifest that describes the test application. An unpackaged WinUI 3 app or ordinary console test app stays on the direct-start path. + +Use `TESTINGPLATFORM_PACKAGEDAPP_LAUNCHER` to override package detection: + +| Value | Behavior | +|---|---| +| `auto` or unset | Enable only for a packaged layout. | +| `always` | Enable for any layout, including a loose layout that you want to deploy before startup. | +| `never` | Disable the packaged-app launcher. | + +Use `TESTINGPLATFORM_PACKAGEDAPP_PIPEAUTHORIZATION` to override package-SID authorization: + +| Value | Behavior | +|---|---| +| `auto` or unset | Authorize the package SID only when the manifest declares an AppContainer application. | +| `always` | Request package-SID authorization for any packaged layout. | +| `never` | Keep the current-user-only pipe authorization. | -For a complete self-hosted WinUI configuration, see [Test WinUI 3 apps with MSTest and MTP](unit-testing-mstest-winui.md). +### Register the extension manually -### Manual registration +If you don't use automatic MSBuild registration, register the extension in your MTP builder: ```csharp var builder = await TestApplication.CreateBuilderAsync(args); builder.AddPackagedAppDeployment(); ``` -Don't call `AddPackagedAppDeployment` if a self-hosted application already calls `AddSelfRegisteredExtensions` and references the package. An MTP run can register only one test host launcher. +Don't call `AddPackagedAppDeployment` if the application already calls `AddSelfRegisteredExtensions` and references the package. An MTP run can register only one test host launcher. diff --git a/docs/core/testing/test-platforms-overview.md b/docs/core/testing/test-platforms-overview.md index cb2e95f4ed0b4..55293e4bf8149 100644 --- a/docs/core/testing/test-platforms-overview.md +++ b/docs/core/testing/test-platforms-overview.md @@ -3,7 +3,7 @@ title: Microsoft.Testing.Platform vs VSTest - .NET test platform comparison description: Compare Microsoft.Testing.Platform (MTP) and VSTest to choose the right .NET test platform for your projects, CI pipelines, and IDE integration. author: Evangelink ms.author: amauryleve -ms.date: 08/06/2026 +ms.date: 09/30/2026 ai-usage: ai-assisted --- @@ -29,9 +29,9 @@ Use the following scenarios to choose quickly. | Use case | Choose | Why | |---|---|---| | You need Native AOT or trimming test execution scenarios. | MTP | MTP supports these modern deployment scenarios, while VSTest doesn't. | -| You're testing classic UWP, modern .NET UWP with `UseUwp`, or another AppContainer project. | VSTest | The MTP packaged-app extension supports full-trust packaged desktop hosts, not AppContainer hosts. | +| You're testing classic UWP, modern .NET UWP with `UseUwp`, or a WinUI 3 AppContainer project. | MTP with MSTest 4.5 or later | MTP 2.5 supports package activation, exact package-SID pipe authorization, and result artifact recovery through the MSTest.Sdk app-model sidecar. | | You're testing an unpackaged WinUI 3 app. | MTP | MTP can run inside the WinUI app and start its executable directly. | -| You're testing a packaged full-trust WinUI 3 app. | VSTest | Use VSTest until the experimental MTP extension for package registration and AUMID activation becomes available in a public NuGet package. | +| You're testing a packaged full-trust WinUI 3 app. | MTP with MSTest 4.5 or later | MSTest.Sdk registers the package and activates the test host by AUMID. | | You need to mix .NET tests and non-.NET test adapters (for example JavaScript or C++ adapters). | VSTest | VSTest supports mixed-language adapter scenarios, while MTP is .NET-specific. | | You want test projects to behave like regular executables (`dotnet run`, direct executable run, `dotnet watch`, and startup-project F5 flows). | MTP | MTP is executable-first, so test apps run like standard .NET apps in local and CI workflows. | | You rely on long-established integrations across existing tooling. | VSTest | VSTest has the longest compatibility track record across existing products, tasks, and pipelines. MTP support is growing in the ecosystem, but some integrations may lag behind VSTest. | @@ -41,6 +41,8 @@ Use the following scenarios to choose quickly. If your specific use case isn't listed, both platforms are valid choices. +The complete Windows application matrix across classic UWP, modern UWP, packaged and unpackaged WinUI 3, and WinUI 3 AppContainer hosts requires MSTest 4.5 and MTP 2.5 or later. For older versions, keep your existing VSTest configuration for UWP projects. + ## Integration and tooling support | Integration area | VSTest | MTP | @@ -73,4 +75,4 @@ For complete details about `dotnet test` modes and arguments, see [Testing with - Understand VSTest options: [VSTest options](/visualstudio/test/vstest-console-options) - Migrate from VSTest: [Migrate from VSTest to MTP](./migrating-vstest-microsoft-testing-platform.md) - Add capabilities: [MTP features](./microsoft-testing-platform-features.md) -- Test WinUI 3 apps: [Test WinUI 3 apps with MSTest and MTP](./unit-testing-mstest-winui.md) +- Test Windows apps: [Test UWP and WinUI 3 apps with MSTest and MTP](./unit-testing-mstest-winui.md) diff --git a/docs/core/testing/unit-testing-mstest-getting-started.md b/docs/core/testing/unit-testing-mstest-getting-started.md index 8bc75cadf9afb..dafe11c52325f 100644 --- a/docs/core/testing/unit-testing-mstest-getting-started.md +++ b/docs/core/testing/unit-testing-mstest-getting-started.md @@ -3,7 +3,7 @@ title: Get started with MSTest description: Learn how to create your first MSTest project and run tests. author: Evangelink ms.author: amauryleve -ms.date: 07/24/2024 +ms.date: 09/30/2026 --- # Get started with MSTest @@ -91,10 +91,12 @@ The MSTest team maintains sample projects in the [microsoft/testfx repository](h |--------|-------------|------| | **Simple1** | Basic MSTest runner setup | [View on GitHub](https://github.com/microsoft/testfx/tree/main/samples/public/mstest-runner/Simple1) | | **DemoMSTestSdk** | MSTest SDK project setup | [View on GitHub](https://github.com/microsoft/testfx/tree/main/samples/public/DemoMSTestSdk) | -| **BlankUwpNet9App** | UWP testing with .NET 9 | [View on GitHub](https://github.com/microsoft/testfx/tree/main/samples/public/BlankUwpNet9App) | -| **UwpVSTestApp** | UWP testing with VSTest | [View on GitHub](https://github.com/microsoft/testfx/tree/main/samples/public/UwpVSTestApp) | +| **UwpMtpApp** | Modern .NET UWP testing with Microsoft.Testing.Platform | [View on GitHub](https://github.com/microsoft/testfx/tree/main/samples/public/UwpMtpApp) | +| **ClassicUwpMtpApp** | Classic `uap10.0` UWP testing with Microsoft.Testing.Platform | [View on GitHub](https://github.com/microsoft/testfx/tree/main/samples/public/ClassicUwpMtpApp) | +| **UwpVSTestApp** | Legacy UWP testing with VSTest | [View on GitHub](https://github.com/microsoft/testfx/tree/main/samples/public/UwpVSTestApp) | | **WinUIMtpPackagedApp** | Packaged WinUI 3 testing with Microsoft.Testing.Platform | [View on GitHub](https://github.com/microsoft/testfx/tree/main/samples/public/WinUIMtpPackagedApp) | | **WinUIMtpUnpackagedApp** | Unpackaged WinUI 3 testing with Microsoft.Testing.Platform | [View on GitHub](https://github.com/microsoft/testfx/tree/main/samples/public/WinUIMtpUnpackagedApp) | +| **WinUIMtpAppContainerApp** | AppContainer WinUI 3 testing with Microsoft.Testing.Platform | [View on GitHub](https://github.com/microsoft/testfx/tree/main/samples/public/WinUIMtpAppContainerApp) | | **WinUIVSTestApp** | WinUI 3 testing with VSTest | [View on GitHub](https://github.com/microsoft/testfx/tree/main/samples/public/WinUIVSTestApp) | | **NativeAotRunner** | Native AOT compilation | [View on GitHub](https://github.com/microsoft/testfx/tree/main/samples/public/mstest-runner/NativeAotRunner) | | **RunInDocker** | Containerized test execution | [View on GitHub](https://github.com/microsoft/testfx/tree/main/samples/public/mstest-runner/RunInDocker) | diff --git a/docs/core/testing/unit-testing-mstest-intro.md b/docs/core/testing/unit-testing-mstest-intro.md index 9a73369a12785..6f5d70eb86af8 100644 --- a/docs/core/testing/unit-testing-mstest-intro.md +++ b/docs/core/testing/unit-testing-mstest-intro.md @@ -3,7 +3,7 @@ title: MSTest overview description: Learn about MSTest, Microsoft's testing framework for .NET, including supported platforms, key features, and getting started. author: Evangelink ms.author: amauryleve -ms.date: 09/02/2026 +ms.date: 09/30/2026 ai-usage: ai-assisted --- @@ -32,11 +32,11 @@ MSTest supports a wide range of .NET platforms and target frameworks. The follow |----------|-------------------|-------------------|-------------------|-------| | **.NET** | .NET 8+ | Full parallelization | All attributes | Recommended for new projects | | **.NET Framework** | 4.6.2+ | Full parallelization | All attributes | Full feature support | -| **UWP** | UAP 10, .NET 9+ with UAP | UI thread | `UITestMethod` | Use VSTest. Modern .NET UWP requires `true`; see [UWP sample](https://github.com/microsoft/testfx/tree/main/samples/public/BlankUwpNet9App) | -| **WinUI 3** | .NET 8+ | UI thread | `UITestMethod` | Requires Windows App SDK; see [Test WinUI 3 apps with MSTest and MTP](unit-testing-mstest-winui.md) | +| **UWP** | UAP 10, .NET 10+ with UWP tooling | UI thread | `UITestMethod` | MSTest 4.5 and MTP 2.5 support classic and modern UWP through the MSTest.Sdk app-model sidecar | +| **WinUI 3** | .NET 8+ | UI thread | `UITestMethod` | MTP supports packaged, unpackaged, and AppContainer hosts; see [Test UWP and WinUI 3 apps with MSTest and MTP](unit-testing-mstest-winui.md) | | **Native AOT** | .NET 8+ | Full parallelization | Most attributes | Limited feature set; see [Native AOT sample](https://github.com/microsoft/testfx/tree/main/samples/public/mstest-runner/NativeAotRunner) | -| **Browser WebAssembly** | .NET 10+ custom host | Single-threaded | Limited | MTP execution support starts with the MSTest 4.4 preview | -| **WASI WebAssembly** | .NET 10+ custom host | Single-threaded | Limited | MTP execution support starts with the MSTest 4.4 preview | +| **Browser WebAssembly** | .NET 10+ custom host | Single-threaded | Limited | MTP execution support starts with MSTest 4.4 | +| **WASI WebAssembly** | .NET 10+ custom host | Single-threaded | Limited | MTP execution support starts with MSTest 4.4 | ### Platform-specific considerations @@ -58,7 +58,9 @@ public class UwpTests } ``` -Use VSTest for classic UWP and modern .NET UWP because both run in an AppContainer. For a modern .NET UWP setup, see the [BlankUwpNet9App sample](https://github.com/microsoft/testfx/tree/main/samples/public/BlankUwpNet9App). +Starting with MSTest 4.5 and MTP 2.5, use MSTest.Sdk to run classic UWP and modern .NET UWP tests through MTP. A full-trust sidecar registers and activates the package, authorizes the app's exact package SID for MTP communication, and copies result artifacts from package storage. + +Modern UWP requires .NET 10, `UseUwp`, and the Visual Studio UWP build toolchain. Classic UWP keeps its existing `uap10.0` project shape. For complete configurations, see the [modern UWP sample](https://github.com/microsoft/testfx/tree/main/samples/public/UwpMtpApp) and [classic UWP sample](https://github.com/microsoft/testfx/tree/main/samples/public/ClassicUwpMtpApp). #### WinUI 3 testing @@ -78,9 +80,9 @@ public class WinUITests } ``` -To configure unpackaged or packaged full-trust WinUI 3 tests, see [Test WinUI 3 apps with MSTest and MTP](unit-testing-mstest-winui.md). +MTP supports packaged full-trust, unpackaged, and AppContainer-configured WinUI 3 test applications. MSTest.Sdk starts unpackaged apps directly and uses its app-model sidecar to register and activate packaged apps. -Starting with MSTest 4.4, Microsoft.Testing.Platform also supports unpackaged WinUI test applications. VSTest doesn't support this scenario. For setup details, see the [unpackaged WinUI sample](https://github.com/microsoft/testfx/tree/main/samples/public/mstest-runner/MSTestRunnerWinUIUnpackaged). +AppContainer support requires MSTest 4.5 and MTP 2.5 or later. VSTest doesn't support unpackaged WinUI 3. For setup details, see [Test UWP and WinUI 3 apps with MSTest and MTP](unit-testing-mstest-winui.md). #### Native AOT @@ -88,7 +90,7 @@ Native AOT compilation is supported with some limitations due to reduced reflect #### Browser and WASI WebAssembly -The MSTest 4.4 preview supports custom .NET 10 browser or WASI WebAssembly hosts. To run tests from a referenced MSTest assembly, call `AddMSTest`. In the host project, set `EnableMSTestRunner` to `true` and `GenerateTestingPlatformEntryPoint` to `false`. Keep the MSTest and MTP package versions aligned. +MSTest 4.4 supports custom .NET 10 browser or WASI WebAssembly hosts. To run tests from a referenced MSTest assembly, call `AddMSTest`. In the host project, set `EnableMSTestRunner` to `true` and `GenerateTestingPlatformEntryPoint` to `false`. Keep the MSTest and MTP package versions aligned. On a single-threaded WebAssembly runtime, MSTest can't forcibly interrupt a timed-out test. Debugger wait isn't supported on browser or WASI, and browser doesn't support debugger launch options. @@ -125,7 +127,7 @@ MSTest has undergone significant evolution across major versions: - **MSTest v4**: Current version with enhanced features > [!NOTE] -> MSTest 4.4 is under development as of August 2026. Features marked as introduced in MSTest 4.4 require a preview build until version 4.4.0 is released. +> MSTest 4.5 is under development as of September 2026. Features marked as introduced in MSTest 4.5 require a preview build until version 4.5.0 is released. For details on all releases, see the [MSTest changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md). @@ -143,6 +145,6 @@ The MSTest team carefully reviews and minimizes breaking changes. When breaking - [Get started with MSTest](unit-testing-mstest-getting-started.md) - [Write tests](unit-testing-mstest-writing-tests.md) - [Run tests](unit-testing-mstest-running-tests.md) -- [Test WinUI 3 apps](unit-testing-mstest-winui.md) +- [Test UWP and WinUI 3 apps](unit-testing-mstest-winui.md) - [Configure MSTest](unit-testing-mstest-configure.md) - [MSTest code analyzers](mstest-analyzers/overview.md) diff --git a/docs/core/testing/unit-testing-mstest-running-tests.md b/docs/core/testing/unit-testing-mstest-running-tests.md index 3c9cb92450b6c..4f0141fed9d88 100644 --- a/docs/core/testing/unit-testing-mstest-running-tests.md +++ b/docs/core/testing/unit-testing-mstest-running-tests.md @@ -157,6 +157,6 @@ Contoso.MyTests.exe --filter "FullyQualifiedName~UnitTest1|TestCategory=Category - [`dotnet test` with MTP](../tools/dotnet-test-mtp.md) - [`dotnet test` with VSTest](../tools/dotnet-test-vstest.md) - [MTP CLI options reference](microsoft-testing-platform-cli-options.md) -- [Test WinUI 3 apps with MSTest and MTP](unit-testing-mstest-winui.md) +- [Test UWP and WinUI 3 apps with MSTest and MTP](unit-testing-mstest-winui.md) - [Filter tests](selective-unit-tests.md) - [Order unit tests](order-unit-tests.md) diff --git a/docs/core/testing/unit-testing-mstest-sdk.md b/docs/core/testing/unit-testing-mstest-sdk.md index 560b4b26f3391..39cf5efeb92c9 100644 --- a/docs/core/testing/unit-testing-mstest-sdk.md +++ b/docs/core/testing/unit-testing-mstest-sdk.md @@ -3,7 +3,7 @@ title: MSTest SDK configuration author: MarcoRossignoli description: Learn how to configure MSTest.Sdk profiles, extensions, and advanced features. ms.author: mrossignoli -ms.date: 09/02/2026 +ms.date: 09/30/2026 ai-usage: ai-assisted --- @@ -24,6 +24,22 @@ If the project that uses MSTest.Sdk is intended to be a test utility helper libr By default, MSTest SDK relies on [MTP](./unit-testing-mstest-running-tests.md), but you can switch to [VSTest](/visualstudio/test/vstest-console-options) by adding the property `true`. +## Test Windows application models + +Starting with MSTest.Sdk 4.5, the default MTP runner supports the following Windows application models: + +- Classic UWP projects that target `uap10.0`. +- Modern UWP projects that use .NET 10 and set `UseUwp` to `true`. +- Packaged full-trust WinUI 3 projects. +- Unpackaged WinUI 3 projects. +- WinUI 3 `packagedClassicApp` projects that set `TrustLevel="appContainer"`. + +MSTest.Sdk supplies compatible MTP 2.5 components and starts a full-trust app-model sidecar for packaged and AppContainer test hosts. The sidecar registers the package, activates the selected application by AUMID, authorizes the exact package SID for AppContainer communication, and recovers result artifacts from package storage. + +UWP projects still require the Visual Studio UWP workload and desktop MSBuild for build-time support. They don't require `Microsoft.NET.Test.Sdk`, `vstest.console`, or the Visual Studio UWP test runtime provider. + +For project configuration, run commands, and samples, see [Test UWP and WinUI 3 apps with MSTest and MTP](unit-testing-mstest-winui.md). + ## Extend MTP You can customize the MTP experience through a set of [NuGet package extensions](./microsoft-testing-platform-features.md). To simplify and improve this experience, MSTest SDK introduces two features: @@ -116,7 +132,7 @@ For a list of all available extensions, see [MTP features](./microsoft-testing-p Some MTP extensions remain opt-in and aren't included in the `Default` or `AllMicrosoft` profiles: - Starting with MSTest.Sdk 4.3, set `true`, then pass `--report-junit`. -- Starting with the MSTest.Sdk 4.4 preview, set `true`, then pass `--report-ctrf`. +- Starting with MSTest.Sdk 4.4, set `true`, then pass `--report-ctrf`. - To reference the OpenTelemetry extension, set `true`. Because the extension requires API configuration, register it in your custom entry point as described in [OpenTelemetry](microsoft-testing-platform-open-telemetry.md). These extensions are available only with MTP. @@ -252,9 +268,6 @@ The default MSTest.Sdk extension profile supplies the `Microsoft.Testing.Extensi ## Reflection source generator -> [!IMPORTANT] -> The following MSTest 4.4 behavior is available only in preview builds until MSTest 4.4.0 is released. - MSTest 4.3 introduced the reflection source generator in the independently versioned, experimental `MSTest.SourceGeneration` package. Starting with MSTest 4.4, the package graduates from experimental status and uses the MSTest version. Native AOT projects include the source generator automatically. For a non-NativeAOT project that uses MSTest.Sdk, opt in with `true`. MSTest.Sdk aligns the `MSTest.SourceGeneration`, `MSTest.TestFramework`, and `MSTest.TestAdapter` versions through `MSTestVersion`. diff --git a/docs/core/testing/unit-testing-mstest-winui.md b/docs/core/testing/unit-testing-mstest-winui.md index f64dc0dd8cdf2..64f849f65e242 100644 --- a/docs/core/testing/unit-testing-mstest-winui.md +++ b/docs/core/testing/unit-testing-mstest-winui.md @@ -1,135 +1,120 @@ --- -title: Test WinUI 3 apps with MSTest and Microsoft.Testing.Platform -description: Learn how to configure unpackaged and packaged full-trust WinUI 3 test apps with MSTest and Microsoft.Testing.Platform. +title: Test UWP and WinUI 3 apps with MSTest and Microsoft.Testing.Platform +description: Learn how to test classic and modern UWP apps, packaged and unpackaged WinUI 3 apps, and AppContainer hosts with MSTest and Microsoft.Testing.Platform. author: Evangelink ms.author: amauryleve -ms.date: 08/06/2026 +ms.date: 09/30/2026 ai-usage: ai-assisted --- -# Test WinUI 3 apps with MSTest and Microsoft.Testing.Platform +# Test UWP and WinUI 3 apps with MSTest and Microsoft.Testing.Platform -Use Microsoft.Testing.Platform (MTP) to run MSTest tests inside a WinUI 3 app. The WinUI app acts as the test host. It owns the application entry point, UI thread, and process lifetime. - -Choose between two WinUI 3 deployment models: - -- An **unpackaged app** runs as a regular Windows executable. -- A **packaged full-trust app** keeps MSIX package identity and uses the experimental `Microsoft.Testing.Extensions.PackagedApp` extension to register and activate the test host. +Use Microsoft.Testing.Platform (MTP) to run MSTest tests inside UWP and WinUI 3 applications. The application acts as the test host and owns its UI thread and process lifetime. > [!IMPORTANT] -> The packaged-app extension supports full-trust packaged desktop apps. It doesn't support UWP or other AppContainer test hosts. -> -> Packaged full-trust AUMID activation is implemented in the `microsoft/testfx` repository but isn't available in a public NuGet package as of August 6, 2026. The current `1.0.0-alpha` packages don't contain the Windows-specific activation implementation. Use the packaged setup only after a package release identifies support for full-trust MSIX registration and AUMID activation. +> The complete Windows application support matrix described in this article is available with MSTest 4.5 and MTP 2.5. Until the stable versions are released, use matching 4.5 and 2.5 preview packages. If you manage MTP packages directly, keep the platform and extension package versions aligned. -## Choose a deployment model +## Choose an application model -Choose the deployment model before you configure the test project. +MSTest.Sdk supports the following Windows application models through MTP: -| Requirement | Choose | Test host startup | -|---|---|---| -| Your tests don't need package identity or APIs that require package identity. | Unpackaged | MTP starts the app executable directly. | -| Your tests require MSIX package identity or packaged-app behavior. | Packaged full-trust after the MTP preview becomes publicly available | The packaged-app extension registers the build output and activates the app by Application User Model ID (AUMID). | -| Your tests must run in UWP or another AppContainer. | VSTest | The MTP packaged-app extension doesn't support AppContainer isolation. | +| Application model | Packaging and trust | Test host startup | Run command | +|---|---|---|---| +| Classic UWP (`uap10.0`) | Packaged AppContainer | A full-trust sidecar registers the package and activates the app by Application User Model ID (AUMID). | `MSBuild` with the `InvokeTestingPlatform` target | +| Modern UWP (.NET 10 with `UseUwp`) | Packaged AppContainer | A full-trust sidecar registers the package and activates the app by AUMID. | `MSBuild` with the `InvokeTestingPlatform` target | +| Packaged WinUI 3 | Packaged full trust | A full-trust sidecar registers the package and activates the app by AUMID. | `dotnet run` or `dotnet test --project` | +| Unpackaged WinUI 3 | No package identity, full trust | MTP starts the app executable directly. | `dotnet run` or `dotnet test --project` | +| WinUI 3 `packagedClassicApp` with `TrustLevel="appContainer"` | Packaged AppContainer | A full-trust sidecar activates the app and authorizes its exact package security identifier (SID) on MTP communication pipes. | `dotnet msbuild` with the `InvokeTestingPlatform` target | -Unless your tests require package identity, use an unpackaged app. The unpackaged model doesn't require package registration, Developer Mode, or the experimental packaged-app extension. +Packaging and sandboxing are separate choices. A packaged WinUI 3 desktop app has package identity but runs as a full-trust process by default. A UWP app always runs in AppContainer. A packaged WinUI 3 app runs in AppContainer only when its manifest sets `TrustLevel="appContainer"`. -Until a public MTP preview includes full-trust MSIX registration and AUMID activation, use VSTest for packaged full-trust WinUI 3 tests. +For older MSTest or MTP versions, keep your existing VSTest configuration for UWP projects. Native MTP execution for UWP and AppContainer hosts requires MSTest 4.5 and MTP 2.5. -### Understand the UWP boundary +## Understand the MTP app-model sidecar -Don't treat UWP as another packaged WinUI 3 model. Both classic UWP projects that target UAP 10 and modern .NET UWP projects that set `UseUwp` to `true` run in an AppContainer. Packaging a WinUI 3 desktop app doesn't place it in that app model. +For a packaged app, the initial test tool process can't run inside the package. MSTest.Sdk starts a full-trust sidecar controller that: -Use VSTest for classic UWP and modern .NET UWP tests. The MTP packaged-app launcher targets full-trust packaged desktop hosts. It can't deliver its activation arguments or controller connection to an AppContainer host. +- Prepares command-line arguments and owns cancellation, retries, reports, and exit-code handling. +- Registers the build-output package and activates the exact manifest application by AUMID. +- Authorizes only the selected package SID when an AppContainer host connects to MTP named pipes. +- Recovers TRX, dump, diagnostic, and retry artifacts from package-owned storage. -For a modern .NET UWP configuration, see the [MSTest .NET 9 UWP sample](https://github.com/microsoft/testfx/tree/main/samples/public/BlankUwpNet9App). +The test application still hosts MTP and MSTest in its own process. UWP execution doesn't require `Microsoft.NET.Test.Sdk`, `vstest.console`, `UwpTestHostRuntimeProvider`, or the Visual Studio deployment runtime. -## Configure the WinUI test host +For a UWP `windowsApp`, Windows provides one activation string through `LaunchActivatedEventArgs.Arguments` instead of normal process arguments. Call `PackagedAppExtensions.GetTestApplicationArguments` before you create the MTP builder. The packaged-app extension restores the original argument array and the controller connection metadata. -Both deployment models use the same self-hosted MTP setup. +For a WinUI 3 `packagedClassicApp`, including one that runs in AppContainer, use the normal process arguments. -### Set the common project properties +## Meet the prerequisites -Set these properties in the WinUI test project: +Use the prerequisites that apply to your project: -```xml -Exe -net8.0-windows10.0.19041.0 -true -true -false -``` +- Use .NET SDK 10 or later for the MSTest 4.5 toolchain and `dotnet test --project`. +- For UWP, use desktop MSBuild from Visual Studio with the Universal Windows Platform workload and the required Windows SDK. These components provide build-time support only. +- For WinUI 3, install the Windows application development tools and reference a compatible Windows App SDK version. +- For packaged test apps, enable Windows Developer Mode or configure sideloading so Windows can register an unsigned build-output layout. +- For AppContainer test apps, run the controller as a non-elevated user. -Use .NET 8 or a later supported .NET version. The example targets Windows platform version `10.0.19041.0`. The packaged-app extension requires this version or later. +## Configure UWP tests -Keep the WinUI `ApplicationDefinition` item that points to your test app's XAML file. WinUI generates an entry point from that item. To prevent MTP from generating a second entry point, set `GenerateTestingPlatformEntryPoint` to `false`. +### Configure a modern UWP project -Add package references to the current compatible versions of [MSTest](https://www.nuget.org/packages/MSTest) and [Microsoft.WindowsAppSDK](https://www.nuget.org/packages/Microsoft.WindowsAppSDK). +Use MSTest.Sdk 4.5 or later, target .NET 10 with a Windows platform version, and set `UseUwp` to `true`. Keep your existing UWP XAML, MSIX, architecture, and Native AOT settings. -### Host MTP from the application +Visual Studio normally enables `UseUwpTools` during the build. MSTest.Sdk selects the UWP application model when `UseUwpTools` is `true`, or when `UseUwp` is `true` and `UseUwpTools` isn't set yet. -Override `OnLaunched` in the WinUI `Application` class. Create and activate the test window, and then publish its dispatcher queue: +If you only need UWP references in a non-UWP MTP test application, set `UseUwpTools` to `false`. The SDK then uses the direct MTP runner unless another packaged application model requires the sidecar. -```csharp -_window = new UnitTestAppWindow(); -_window.Activate(); -UITestMethodAttribute.DispatcherQueue = _window.DispatcherQueue; -``` - -Add `using Microsoft.VisualStudio.TestTools.UnitTesting.AppContainer;` for `UITestMethodAttribute`. +For a complete project, see the [modern UWP MTP sample](https://github.com/microsoft/testfx/tree/main/samples/public/UwpMtpApp). -Create the MTP application from the command-line arguments. Then register the extensions that MSBuild contributes: +### Configure a classic UWP project -```csharp -string[] cliArgs = Environment.GetCommandLineArgs().Skip(1) - .Where(arg => !arg.Contains("EnableMSTestRunner")).ToArray(); -ITestApplicationBuilder builder = await TestApplication.CreateBuilderAsync(cliArgs); -builder.AddSelfRegisteredExtensions(cliArgs); -using ITestApplication app = await builder.BuildAsync(); -``` +Keep the existing `uap10.0` project shape, desktop MSBuild toolchain, and UWP extension SDK. Import MSTest.Sdk 4.5 or later, and enable the MSTest runner and MTP. MSTest.Sdk supplies the UAP-compatible bootstrap, adapter, and runtime assets. -Add `using Microsoft.Testing.Platform.Builder;` for the MTP builder types. The WinUI build adds `EnableMSTestRunner` to the process arguments. Because it isn't an MTP command-line option, remove it before you create the test application. +For a complete project, see the [classic UWP MTP sample](https://github.com/microsoft/testfx/tree/main/samples/public/ClassicUwpMtpApp). -The project disables the generated MTP entry point, so call `AddSelfRegisteredExtensions`. For a packaged app, the method also registers the `Microsoft.Testing.Extensions.PackagedApp` launcher. +### Run UWP tests -In `OnLaunched`, put test application creation and execution in a `try` block. Assign the result of `await app.RunAsync()` to `Environment.ExitCode`. In a `finally` block, close the window and call the application's `Exit` method. +Open a Developer PowerShell for Visual Studio. Build the solution for a concrete architecture, and then invoke MTP: -The lifecycle steps provide two guarantees: +```powershell +msbuild UwpTests.sln /restore /p:Configuration=Release /p:Platform=x64 +msbuild UwpTests.csproj /t:InvokeTestingPlatform /p:Configuration=Release /p:Platform=x64 /p:TestingPlatformCommandLineArguments="--report-trx" +``` -- The process returns the MTP exit code, so a failed test produces a nonzero process exit code. -- The WinUI message loop stops after the run instead of leaving the test process active. +The second command registers the package, activates the app by AUMID, runs regular and UI-thread tests, copies result artifacts from package storage, and returns the test run exit code. -> [!WARNING] -> Don't add `[assembly: WinUITestTarget(...)]` to a self-hosted WinUI test app. The attribute starts a WinUI application for a separate test host. A self-hosted app calls `Application.Start` first. The attribute then tries to start a second application in the same process. +## Configure WinUI 3 tests -For a complete implementation, see the [unpackaged WinUI sample](https://github.com/microsoft/testfx/tree/main/samples/public/mstest-runner/MSTestRunnerWinUIUnpackaged) and the [packaged WinUI sample](https://github.com/microsoft/testfx/tree/main/samples/public/mstest-runner/MSTestRunnerWinUI). +Use MSTest.Sdk 4.5 or later, set `UseWinUI` to `true`, and target a Windows-specific target framework. For packaged activation, use Windows platform version `10.0.19041.0` or later. -### Run tests on the UI thread +### Host MTP from the WinUI application -Use `UITestMethod` for a test that creates or accesses WinUI objects. MSTest schedules the test on the dispatcher queue that you assigned during `OnLaunched`. +For a self-hosted WinUI test app, create and activate the test window in `OnLaunched`, and then publish its dispatcher queue: ```csharp -[UITestMethod] -public void CreatesControlOnUiThread() -{ - var grid = new Grid(); - Assert.IsTrue(grid.DispatcherQueue.HasThreadAccess); -} +_window = new UnitTestAppWindow(); +_window.Activate(); +UITestMethodAttribute.DispatcherQueue = _window.DispatcherQueue; ``` -A regular `TestMethod` doesn't run on the WinUI dispatcher queue. Use it for tests that don't require the UI thread. +Run the generated MTP helper, assign its result to `Environment.ExitCode`, close the window, and call `Exit`: -## Configure an unpackaged test app +```csharp +Environment.ExitCode = await MicrosoftTestingPlatformApplication.RunAsync( + Environment.GetCommandLineArgs()[1..]); +``` -For an unpackaged app, add these properties: +Use `UITestMethod` for tests that create or access WinUI objects. Use `TestMethod` for tests that don't require the UI thread. -```xml -None -false -``` +> [!WARNING] +> Don't add `[assembly: WinUITestTarget(...)]` to a self-hosted WinUI test app. That attribute starts a WinUI application for a separate test host, but the self-hosted app has already called `Application.Start`. + +### Configure an unpackaged app -Don't reference `Microsoft.Testing.Extensions.PackagedApp`. The unpackaged app has no MSIX identity or `AppxManifest.xml` in its output, so MTP can start its executable directly. +Set `WindowsPackageType` to `None`. The app has no MSIX identity or `AppxManifest.xml`, so MTP starts its executable directly. Don't add the packaged-app extension manually. -By default, the Windows App SDK injects its bootstrap initializer when the project meets these conditions: +The Windows App SDK normally injects its bootstrap initializer when the project meets these conditions: - `WindowsPackageType` is `None`. - `OutputType` is `Exe` or `WinExe`. @@ -137,70 +122,61 @@ By default, the Windows App SDK injects its bootstrap initializer when the proje If a host that isn't a Windows App SDK app loads your test library, set `WindowsAppSdkBootstrapInitialize` to `true` in the library. -> [!NOTE] -> VSTest doesn't support this unpackaged WinUI configuration. Run the project with MTP. - -## Configure a packaged full-trust test app +VSTest doesn't support unpackaged WinUI 3 test apps because its WinUI provider requires an AppX manifest. -Keep the default packaged WinUI configuration: +For a complete project, see the [unpackaged WinUI MTP sample](https://github.com/microsoft/testfx/tree/main/samples/public/WinUIMtpUnpackagedApp). -- Don't set `WindowsPackageType` to `None`. -- Keep `Package.appxmanifest` and the package assets in the project. -- Set `EnableMsixTooling` to `true` if your project uses the single-project MSIX packaging tools. +### Configure a packaged full-trust app -After a preview that includes full-trust MSIX registration and AUMID activation becomes available, add that specific version of the [Microsoft.Testing.Extensions.PackagedApp](https://www.nuget.org/packages/Microsoft.Testing.Extensions.PackagedApp) package. Don't use an earlier `1.0.0-alpha` package for this setup. +Keep the default packaged WinUI configuration and its `Package.appxmanifest`. MSTest.Sdk references and registers `Microsoft.Testing.Extensions.PackagedApp` automatically for the packaged project. -The package's MSBuild props register the launcher through `AddSelfRegisteredExtensions`. Don't also call `AddPackagedAppDeployment`. An MTP run can register only one test host launcher. +Don't also call `AddPackagedAppDeployment`. An MTP run can register only one test host launcher. Set `EnableMicrosoftTestingExtensionsPackagedApp` to `false` only when a custom launcher owns packaged activation. -The launcher performs these actions: +For a complete project, see the [packaged WinUI MTP sample](https://github.com/microsoft/testfx/tree/main/samples/public/WinUIMtpPackagedApp). -1. It checks for an `AppxManifest.xml` that describes the test executable. -1. It registers the build-output layout with Windows. -1. It resolves the app's AUMID from the registered package and manifest application ID. -1. It activates the app by AUMID and connects the activated process to the MTP controller. +### Configure an AppContainer app -The launcher ignores an unrelated manifest in an ancestor directory unless an `Application` entry points to the test executable. An unpackaged app that references the package indirectly remains on the direct-start path. +In the WinUI package manifest, configure the application as `packagedClassicApp` and set `TrustLevel="appContainer"`. MTP 2.5 authorizes the exact package SID on the controller and extension pipes. It doesn't grant `ALL APPLICATION PACKAGES` or require a loopback exemption. -Meet these requirements before you run a packaged test app: +Run the sidecar non-elevated. Use the `InvokeTestingPlatform` target so the sidecar can copy results and diagnostics from package `LocalState` to the requested results directory. -- Use a Windows-specific target framework with platform version `10.0.19041.0` or later. -- To register the unsigned build-output layout, enable Developer Mode or configure sideloading. -- Use a full-trust packaged desktop app. The extension doesn't support UWP or other AppContainer hosts. +For a complete project, see the [AppContainer WinUI MTP sample](https://github.com/microsoft/testfx/tree/main/samples/public/WinUIMtpAppContainerApp). -> [!CAUTION] -> `Microsoft.Testing.Extensions.PackagedApp` and the `ITestHostLauncher` extension point are experimental. A future release might change or remove their APIs and behavior. Evaluate the risks before you use the packaged model in production test infrastructure. +## Run WinUI 3 tests -## Run the tests +Build for a concrete architecture. For a packaged full-trust or unpackaged app, run: -From the directory that contains the WinUI test project, run: - -```dotnetcli -dotnet run +```powershell +dotnet build -p:Platform=x64 +dotnet test --project . --no-build -p:Platform=x64 ``` -To specify the project, use `dotnet run --project .\WinUITests.csproj`. +You can also use `dotnet run --no-build -p:Platform=x64`. -For an unpackaged app, MTP starts the executable directly. For a packaged app, the packaged-app launcher registers the layout and activates the app by AUMID. +For an AppContainer WinUI app, use the sidecar target and an absolute results directory: -In both models, the test window opens, MTP runs the tests, and the window closes. The terminal then reports the test summary. A successful run exits with code `0`. When a test fails, `OnLaunched` assigns the nonzero `RunAsync` result to `Environment.ExitCode`. +```powershell +dotnet msbuild .\WinUITests.csproj -t:InvokeTestingPlatform -p:Platform=x64 "-p:TestingPlatformCommandLineArguments=--report-trx --results-directory C:\TestResults" +``` -Use `dotnet run` for either model. To run an unpackaged app directly, use the generated app executable. Don't use `dotnet exec` because WinUI resolves PRI resources relative to the process path. +Don't use `dotnet exec` for a WinUI app. WinUI resolves PRI resources relative to the process path. ## Troubleshoot the setup -Use these checks for the most common setup failures: - | Symptom | Check | |---|---| -| The app reports multiple calls to `Application.Start`. | Remove the `WinUITestTarget` attribute from the self-hosted test app. | -| The test run finishes but the process stays open. | Close the test window and call `Exit` in a `finally` block after `RunAsync`. | -| Failed tests still return process exit code `0`. | Assign the result of `RunAsync` to `Environment.ExitCode`. | -| An unpackaged run fails because `AppxManifest.xml` is missing. | Confirm that the project enables MTP and that the run doesn't use VSTest. | -| A packaged run can't register or activate the app. | Confirm the Windows-specific target framework, Developer Mode or sideloading configuration, full-trust app model, and manifest executable entry. | +| The app reports multiple calls to `Application.Start`. | Remove the `WinUITestTarget` attribute from a self-hosted WinUI test app. | +| The test run finishes but the process stays open. | Close the test window and call `Exit` after the MTP run completes. | +| Failed tests return process exit code `0`. | Assign the MTP run result to `Environment.ExitCode`. | +| An unpackaged WinUI run reports a missing `AppxManifest.xml`. | Confirm that the project uses MTP instead of VSTest. | +| A packaged run can't register or activate the app. | Confirm the Windows target framework, Developer Mode or sideloading policy, architecture, and manifest executable entry. | +| An AppContainer host can't connect to the controller. | Use MSTest 4.5 and MTP 2.5 or later, and run the controller non-elevated. | +| An AppContainer report isn't copied to the requested directory. | Use `InvokeTestingPlatform` and specify an absolute results directory. | ## See also - [MSTest overview](unit-testing-mstest-intro.md) +- [MSTest SDK configuration](unit-testing-mstest-sdk.md) - [Run tests with MSTest](unit-testing-mstest-running-tests.md) - [MTP test host deployment](microsoft-testing-platform-test-host-deployment.md) -- [WinUI testing guidance in the MSTest repository](https://github.com/microsoft/testfx/blob/main/docs/winui-testing.md) +- [Windows app testing guidance in the MSTest repository](https://github.com/microsoft/testfx/blob/main/docs/winui-testing.md) diff --git a/docs/navigate/devops-testing/toc.yml b/docs/navigate/devops-testing/toc.yml index a1f3ae47b9ba7..c2176d971790f 100644 --- a/docs/navigate/devops-testing/toc.yml +++ b/docs/navigate/devops-testing/toc.yml @@ -76,7 +76,7 @@ items: items: - name: Overview href: ../../core/testing/unit-testing-mstest-running-tests.md - - name: Test WinUI 3 apps + - name: Test UWP and WinUI 3 apps href: ../../core/testing/unit-testing-mstest-winui.md - name: Configure MSTest href: ../../core/testing/unit-testing-mstest-configure.md From 1443883303ca8a9e515a13c1c39c7224bb2cfa33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Amaury=20Lev=C3=A9?= Date: Thu, 1 Oct 2026 17:01:22 +0200 Subject: [PATCH 3/3] Document MSTest 4.3-4.5 and MTP 2.3-2.5 updates (#56297) * Document MSTest and MTP updates Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Address MSTest docs review feedback Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Fix UI Automation snippet CI build Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- ...esting-platform-architecture-extensions.md | 31 ++++++- ...-testing-platform-architecture-services.md | 17 +++- ...ng-platform-architecture-test-framework.md | 19 +++- .../microsoft-testing-platform-cli-options.md | 4 +- ...icrosoft-testing-platform-code-coverage.md | 4 +- .../microsoft-testing-platform-config.md | 10 ++- ...testing-platform-extensions-integration.md | 38 +++++++- .../microsoft-testing-platform-features.md | 12 +-- .../microsoft-testing-platform-intro.md | 4 +- ...crosoft-testing-platform-open-telemetry.md | 41 ++++++++- .../microsoft-testing-platform-server-mode.md | 10 ++- ...rosoft-testing-platform-terminal-output.md | 6 +- ...t-testing-platform-test-host-deployment.md | 4 +- ...microsoft-testing-platform-test-reports.md | 16 ++-- .../testing/mstest-analyzers/mstest0048.md | 4 +- .../testing/mstest-analyzers/mstest0069.md | 4 +- .../testing/mstest-analyzers/mstest0072.md | 7 +- .../testing/mstest-analyzers/mstest0073.md | 7 +- .../testing/mstest-analyzers/mstest0074.md | 7 +- .../testing/mstest-analyzers/mstest0075.md | 7 +- .../testing/mstest-analyzers/mstest0076.md | 4 +- .../testing/mstest-analyzers/mstest0077.md | 7 +- .../testing/mstest-analyzers/mstest0078.md | 7 +- .../testing/mstest-analyzers/mstest0079.md | 4 +- .../testing/mstest-analyzers/mstest0080.md | 4 +- .../testing/mstest-analyzers/mstest0081.md | 7 +- .../testing/mstest-analyzers/mstest0082.md | 7 +- .../testing/mstest-analyzers/mstest0083.md | 7 +- .../testing/mstest-analyzers/mstest0084.md | 84 ++++++++++++++++++ .../testing/mstest-analyzers/mstest0085.md | 83 +++++++++++++++++ .../testing/mstest-analyzers/mstest0086.md | 88 +++++++++++++++++++ .../testing/mstest-analyzers/mstest0087.md | 79 +++++++++++++++++ .../core/testing/mstest-analyzers/overview.md | 10 ++- .../testing/mstest-analyzers/usage-rules.md | 10 ++- .../csharp/UIAutomationExample/MyAppTests.cs | 12 +++ .../UIAutomationExample.csproj | 22 +++++ .../UIAutomationExample/WindowTestStub.cs | 9 ++ .../vb/UIAutomationExample/MyAppTests.vb | 14 +++ .../UIAutomationExample.vbproj | 22 +++++ .../vb/UIAutomationExample/WindowTestStub.vb | 12 +++ .../testing/unit-testing-mstest-configure.md | 13 ++- .../core/testing/unit-testing-mstest-intro.md | 10 ++- .../unit-testing-mstest-running-tests.md | 3 +- docs/core/testing/unit-testing-mstest-sdk.md | 8 +- .../unit-testing-mstest-ui-automation.md | 76 ++++++++++++++++ ...testing-mstest-writing-tests-assertions.md | 7 +- ...est-writing-tests-controlling-execution.md | 10 +-- ...esting-mstest-writing-tests-data-driven.md | 11 ++- ...-testing-mstest-writing-tests-lifecycle.md | 29 +++++- ...esting-mstest-writing-tests-testcontext.md | 9 +- docs/navigate/devops-testing/toc.yml | 10 +++ 51 files changed, 806 insertions(+), 124 deletions(-) create mode 100644 docs/core/testing/mstest-analyzers/mstest0084.md create mode 100644 docs/core/testing/mstest-analyzers/mstest0085.md create mode 100644 docs/core/testing/mstest-analyzers/mstest0086.md create mode 100644 docs/core/testing/mstest-analyzers/mstest0087.md create mode 100644 docs/core/testing/snippets/unit-testing-mstest-ui-automation/csharp/UIAutomationExample/MyAppTests.cs create mode 100644 docs/core/testing/snippets/unit-testing-mstest-ui-automation/csharp/UIAutomationExample/UIAutomationExample.csproj create mode 100644 docs/core/testing/snippets/unit-testing-mstest-ui-automation/csharp/UIAutomationExample/WindowTestStub.cs create mode 100644 docs/core/testing/snippets/unit-testing-mstest-ui-automation/vb/UIAutomationExample/MyAppTests.vb create mode 100644 docs/core/testing/snippets/unit-testing-mstest-ui-automation/vb/UIAutomationExample/UIAutomationExample.vbproj create mode 100644 docs/core/testing/snippets/unit-testing-mstest-ui-automation/vb/UIAutomationExample/WindowTestStub.vb create mode 100644 docs/core/testing/unit-testing-mstest-ui-automation.md diff --git a/docs/core/testing/microsoft-testing-platform-architecture-extensions.md b/docs/core/testing/microsoft-testing-platform-architecture-extensions.md index c7ec6e6f3d8c3..e1d08005b8495 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: 08/26/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -450,7 +450,7 @@ await messageBus.PublishAsync( > `TestNodeFileArtifact` is obsolete and was removed in MTP 2.0.0. To attach test-level files, use `FileArtifactProperty` on the `TestNode`. 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). > [!NOTE] -> MTP 2.4.0 (unreleased as of August 2026) adds an experimental `kind` constructor overload and `Kind` property to `FileArtifact` and `SessionFileArtifact` (requires the `TPEXP` diagnostic to be suppressed). `Kind` is a producer-asserted, reverse-DNS identifier of the artifact *format* (for example, `microsoft.testing.trx`, `microsoft.testing.junit`, `microsoft.testing.ctrf`, or `microsoft.testing.html`) that post-processing uses to group artifacts of the same format. Leave it `null` or omit it when the producer doesn't declare a known kind. +> MTP 2.4.0 adds an experimental `kind` constructor overload and `Kind` property to `FileArtifact` and `SessionFileArtifact` (requires the `TPEXP` diagnostic to be suppressed). `Kind` is a producer-asserted, reverse-DNS identifier of the artifact *format* (for example, `microsoft.testing.trx`, `microsoft.testing.junit`, `microsoft.testing.ctrf`, or `microsoft.testing.html`) that post-processing uses to group artifacts of the same format. Leave it `null` or omit it when the producer doesn't declare a known kind. > > ```csharp > #pragma warning disable TPEXP // Experimental API. @@ -469,6 +469,33 @@ Starting with MTP 2.4.0, the experimental `IArtifactPostProcessor` extension poi The built-in TRX, JUnit, CTRF, and HTML report extensions use this extension point to consolidate related report artifacts in a `merged` directory. HTML consolidation creates a merged summary and preserves the original per-process reports. To learn how report consolidation affects test output, see [Report consolidation](microsoft-testing-platform-test-reports.md#report-consolidation). +### The `ITestExecutionFilterProvider` extensions + +Starting with MTP 2.4.0, the experimental `ITestExecutionFilterProvider` extension point lets an extension add a constraint to a discovery or run request before the test framework receives it. Register a provider factory with `AddTestExecutionFilterProvider`. + +MTP combines the request filter and every provider filter with a logical AND. It intersects `TestNodeUidListFilter` values and uses `CompositeTestExecutionFilter` for other combinations. A test framework must understand each filter type that can reach it. + +The provider receives a `TestExecutionFilterContext` that identifies whether the request is for discovery or execution and whether it came from the console or JSON-RPC server. Return `null` or `NopFilter` when the provider doesn't add a constraint. Provider constraints aren't supported for JSON-RPC server requests, so return `null` when the request origin is `Server`. + +> [!IMPORTANT] +> These APIs use the `TPEXP` diagnostic ID and might change in a future release. + +### The `ITestHostExecutionOrchestratorMiddleware` extensions + +Starting with MTP 2.5 preview, the experimental `ITestHostExecutionOrchestratorMiddleware` extension point wraps exactly one invocation of the configured test host orchestrator. Register middleware with `AddTestHostExecutionOrchestratorMiddleware`. Registration order is outermost-first. + +Middleware can observe the invocation or short-circuit it, but it can't implement retries, stress loops, sharding, or multi-phase execution. The existing `--retry-failed-tests` orchestrator doesn't use this middleware API. + +Follow these constraints: + +- Invoke `next` at most once, and start the invocation before the middleware method returns or throws. +- When you invoke `next`, return its exact exit code, and propagate its exceptions and cancellation unchanged. +- When you short-circuit without invoking `next`, return a non-success exit code. +- Treat composition order as significant. Middleware effects aren't assumed to be commutative. + +> [!IMPORTANT] +> These APIs use the `TPEXP` diagnostic ID and might change or be removed in a future release. + ### The `ITestHostEnvironmentVariableProvider` extensions The `ITestHostEnvironmentVariableProvider` is an *out-of-process* extension that enables you to establish custom environment variables for the test host. Utilizing this extension point ensures that the testing platform will initiate a new host with the appropriate environment variables, as detailed in the [architecture](./microsoft-testing-platform-architecture.md) section. diff --git a/docs/core/testing/microsoft-testing-platform-architecture-services.md b/docs/core/testing/microsoft-testing-platform-architecture-services.md index 82db9a3c0d089..152f10e86e99c 100644 --- a/docs/core/testing/microsoft-testing-platform-architecture-services.md +++ b/docs/core/testing/microsoft-testing-platform-architecture-services.md @@ -3,7 +3,7 @@ title: Microsoft.Testing.Platform services overview description: Learn about the available Microsoft.Testing.Platform (MTP) services. author: MarcoRossignoli ms.author: mrossignoli -ms.date: 08/26/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -293,6 +293,21 @@ if (logger.IsEnabled(LogLevel.Information)) Keep in mind that to prevent unnecessary allocation, you should check if the level is *enabled* using the `ILogger.IsEnabled(LogLevel)` API. +## The `IDiagnosticLoggingInformation` service + +Starting with MTP 2.5 preview, call `serviceProvider.GetDiagnosticLoggingInformation()` to retrieve experimental information about the built-in diagnostic file logger. The method returns `null` when diagnostic logging isn't enabled. + +The `IDiagnosticLoggingInformation` service exposes: + +- `LogFile`, the file that currently receives diagnostic entries. +- `LogLevel`, the minimum level written to the file. +- `SynchronousWrite`, which indicates whether the file logger writes entries synchronously. + +The service is live. During test application construction, MTP can relocate the log to the effective results directory. Retain the service and read `LogFile` when you need the path instead of caching the first `FileInfo`. If log recovery leaves a partial file in the original location, `LogFile` identifies the replacement file that receives new entries. + +> [!IMPORTANT] +> This API uses the `TPEXP` diagnostic ID and might change or be removed in a future release. + ## The `IMessageBus` service The message bus service is the central mechanism that facilitates information exchange between the test framework and its extensions. diff --git a/docs/core/testing/microsoft-testing-platform-architecture-test-framework.md b/docs/core/testing/microsoft-testing-platform-architecture-test-framework.md index 6a9ffb12b45cf..1cbb7ddf23f1f 100644 --- a/docs/core/testing/microsoft-testing-platform-architecture-test-framework.md +++ b/docs/core/testing/microsoft-testing-platform-architecture-test-framework.md @@ -3,7 +3,7 @@ title: Build a test framework for Microsoft.Testing.Platform (MTP) description: Learn how to create a custom test framework for Microsoft.Testing.Platform (MTP), including registration, lifecycle, and test node reporting. author: MarcoRossignoli ms.author: mrossignoli -ms.date: 07/17/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -310,6 +310,19 @@ await context.MessageBus.PublishAsync( failedTestNode)); ``` +#### Canonical test execution + +Starting with MTP 2.5 preview, call `ExecuteRequestContext.StartTestExecutionAsync` with an in-progress `TestNodeUpdateMessage` to start an experimental canonical `TestExecution`. The start method publishes the in-progress update and returns an object that keeps execution lifecycle, message ordering, and telemetry correlation together. + +Use `Run` or `RunAsync` to invoke framework and test code in the canonical execution context. When OpenTelemetry is active, child activities created by the test remain under the same test execution activity. + +Call `CompleteAsync` with the ordered result messages and the producer-observed execution end time. Every result must use the session, test UID, and parent UID from the start message. The last message is the final result. An empty collection publishes an execution-completed update without inventing an outcome. + +Dispose an incomplete `TestExecution` to abandon it without publishing a result. After completion or disposal, the object rejects additional execution or completion calls. + +> [!IMPORTANT] +> `StartTestExecutionAsync` and `TestExecution` use the `TPEXP` diagnostic ID and might change or be removed in a future release. + ### The `TestNodeUpdateMessage` data As mentioned in the [IMessageBus](./microsoft-testing-platform-architecture-services.md#the-imessagebus-service) section, before utilizing the message bus, you must specify the type of data you intend to supply. The testing platform has defined a well-known type, `TestNodeUpdateMessage`, to represent the concept of a *test update information*. @@ -489,6 +502,10 @@ public sealed record TestMetadataProperty( `TestMetadataProperty` is utilized to convey the characteristics or *traits* of a `TestNode`. +Starting with MTP 2.4, add `AssertionFailureProperty` to a failed test node to supply separate, preformatted expected and actual values. Report consumers can use these values to render a structured difference instead of parsing the failure message. At least one value must be non-`null`. Consumers prefer this property but can fall back to the legacy `assert.expected` and `assert.actual` entries in . + +Starting with MTP 2.4, add `RetryAttemptProperty` to every update in an in-process retry sequence. `AttemptNumber` is one-based, and `IsSuperseded` marks an attempt that a later attempt replaces. TRX, JUnit, and the process exit code ignore superseded attempts, while the terminal, HTML, and CTRF consumers can preserve the full history. This property doesn't represent the out-of-process `--retry-failed-tests` attempts. + ##### Discovery information ```csharp diff --git a/docs/core/testing/microsoft-testing-platform-cli-options.md b/docs/core/testing/microsoft-testing-platform-cli-options.md index c301b351bb1c4..2699e5ca57166 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: 09/11/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -205,6 +205,8 @@ Use the following table to find each extension's package and options. A test SDK Run your test executable with `--help`, or run `dotnet test --help` in MTP mode, to list the options available for your current extension set. +Starting with MTP 2.4, an unknown option error suggests a uniquely matching option name when one is available. If the option belongs to a known Microsoft-provided extension that the test application hasn't registered, the error also identifies the NuGet package that provides the option. + For advanced diagnostics of registered providers and options, run with `--info`. ## See also diff --git a/docs/core/testing/microsoft-testing-platform-code-coverage.md b/docs/core/testing/microsoft-testing-platform-code-coverage.md index 4dd7484d4fc18..996c570b63f4d 100644 --- a/docs/core/testing/microsoft-testing-platform-code-coverage.md +++ b/docs/core/testing/microsoft-testing-platform-code-coverage.md @@ -3,7 +3,7 @@ title: Microsoft.Testing.Platform (MTP) code coverage description: Learn about collecting code coverage data with MTP. author: evangelink ms.author: amauryleve -ms.date: 09/02/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -44,7 +44,7 @@ For more information about the available options, see [settings](../additional-t ## Coverage summaries and thresholds > [!IMPORTANT] -> The first-class coverage result model is available in MTP 2.4 preview. +> The first-class coverage result model is available starting with MTP 2.4. Compatible collectors can publish covered and coverable measurements, threshold evaluations, and coverage report references as one correlated test coverage result. The terminal reporter and compatible report consumers render the measurements and derive percentages without parsing collector-specific files. diff --git a/docs/core/testing/microsoft-testing-platform-config.md b/docs/core/testing/microsoft-testing-platform-config.md index 20bbe0fa06243..78d72a86ffaa6 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: 09/02/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -121,7 +121,7 @@ Bootstrap-only options run before MTP loads configuration. Don't put `config-fil ### Passive command-line option defaults > [!IMPORTANT] -> `commandLineOptionDefaults` is available in MTP 2.4 preview. +> `commandLineOptionDefaults` is available starting with MTP 2.4. Use `commandLineOptionDefaults` to supply an argument only when an enabled feature requests that option and no higher-priority value exists. A passive default doesn't enable an option, register an extension, or activate a feature. Omit the leading `--` from each key. @@ -200,7 +200,7 @@ If you're migrating from a *.runsettings* file, the following table maps common ## MSBuild configuration > [!IMPORTANT] -> `TestingPlatformEnvironmentVariable` is available in MTP 2.4 preview. +> `TestingPlatformEnvironmentVariable` is available starting with MTP 2.4. To set an environment variable on the test process that `InvokeTestingPlatform` launches, add a `TestingPlatformEnvironmentVariable` item: @@ -211,6 +211,8 @@ To set an environment variable on the test process that `InvokeTestingPlatform` The `Value` metadata preserves semicolons instead of splitting them into MSBuild items. Declared values overlay the environment that the MSBuild process inherits. Without these items, the launched process inherits the environment unchanged. +Starting with MTP 2.4, `InvokeTestingPlatform` also derives the architecture-specific `DOTNET_ROOT_` variable from `DOTNET_HOST_PATH` when it launches a compatible apphost. Set `TestingPlatformDisableAppHostDotnetRoot` to `true` to opt out. An applicable `TestingPlatformEnvironmentVariable` item remains authoritative. + ## Environment variables Environment variables can be used to supply some runtime configuration information. @@ -284,7 +286,7 @@ The variable has no effect on Windows, where named pipes don't use file-system p ### Deadline cancellation prototype > [!WARNING] -> **EXPERIMENTAL/PROTOTYPE:** Deadline cancellation is a prototype in MTP 2.4 preview. Its variables and behavior can change or be removed. +> **EXPERIMENTAL/PROTOTYPE:** Deadline cancellation is a prototype in MTP 2.4. Its variables and behavior can change or be removed. Set `TESTINGPLATFORM_DEADLINE` to the complete hard-cancel instant supplied by the deadline producer. Use an ISO 8601 UTC value. Don't subtract MTP's margins from the value. diff --git a/docs/core/testing/microsoft-testing-platform-extensions-integration.md b/docs/core/testing/microsoft-testing-platform-extensions-integration.md index 7d03f4db92ef0..1544373ac20f6 100644 --- a/docs/core/testing/microsoft-testing-platform-extensions-integration.md +++ b/docs/core/testing/microsoft-testing-platform-extensions-integration.md @@ -3,7 +3,7 @@ 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 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -12,7 +12,7 @@ ai-usage: ai-assisted 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 `false`. +> When using [Microsoft.Testing.Platform.MSBuild](https://www.nuget.org/packages/Microsoft.Testing.Platform.MSBuild), the logging package is auto-registered with a generated entry point. The configuration package requires an `IConfiguration` instance, and the hosting package requires either `TestingPlatformHostFactory` or a custom entry point, so follow their registration sections. ## Logging bridge @@ -29,3 +29,37 @@ The bridge forwards each message only when the platform's diagnostic logging is var builder = await TestApplication.CreateBuilderAsync(args); builder.AddMicrosoftExtensionsLogging(logging => logging.AddConsole()); ``` + +## Configuration snapshot + +The experimental [`Microsoft.Testing.Extensions.Configuration`](https://github.com/microsoft/testfx/tree/main/src/Platform/Microsoft.Testing.Extensions.Configuration) package adds a read-only snapshot of an application-owned to MTP's configuration pipeline. + +Register the configuration before you build the test application: + +```csharp +var builder = await TestApplication.CreateBuilderAsync(args); +builder.AddMicrosoftExtensionsConfigurationSnapshot(configuration); +``` + +By default, the snapshot uses order `2`. MTP command-line values (order `0`) and environment variables (order `1`) take precedence, while the snapshot takes precedence over *testconfig.json* (order `3`). Pass a different order when your application requires another precedence. + +MTP reads the snapshot when `BuildAsync` builds the configuration pipeline. Later changes and reload notifications don't propagate. The caller retains ownership of the configuration, hierarchical keys keep the standard `:` delimiter, and registration applies only to the current process. A live configuration object doesn't cross into a separately launched controller or test host process. + +## Host integration + +The experimental [`Microsoft.Testing.Extensions.Hosting`](https://github.com/microsoft/testfx/tree/main/src/Platform/Microsoft.Testing.Extensions.Hosting) package runs MTP inside an application-owned . The host remains the composition root and owns its service provider, configuration, logging, OpenTelemetry providers, lifetime, and disposal. + +For a generated entry point, set `TestingPlatformHostFactory` to a fully qualified static method that returns a fresh, unstarted `Task`: + +```xml +Contoso.Tests.TestHost.CreateHost +``` + +Set `TestingPlatformOpenTelemetryMode` to `HostOwned` when the host owns OpenTelemetry providers and the test project references `Microsoft.Testing.Extensions.OpenTelemetry`. The generated entry point creates and disposes the host, preserves self-registered extensions, and bypasses the factory for command-line `--help` and `--info`. + +For a custom entry point, call `RunTestingPlatformAsync` on the host and register the test framework through its callback. The method imports a configuration snapshot, forwards MTP diagnostics to the host's `ILoggerFactory`, starts the host before MTP, links host and caller cancellation to MTP, returns the MTP exit code, and stops the host in a `finally` block. The caller still disposes the host. + +Keep standard output free of host startup, shutdown, logging, and exporter messages because MTP uses it for machine-readable modes such as `--list-tests json`, JSON-RPC server mode, and the `dotnet test` protocol. Also avoid exclusive global resources in a host factory used with process-restart extensions, because retry, crash dump, or hang dump scenarios might invoke the factory in controller and child processes. + +> [!IMPORTANT] +> The configuration and hosting APIs use the `TPEXP` diagnostic ID and might change in a future release. They are available in MTP 2.5 preview packages. diff --git a/docs/core/testing/microsoft-testing-platform-features.md b/docs/core/testing/microsoft-testing-platform-features.md index d5350fcd18395..8cdfefa01284b 100644 --- a/docs/core/testing/microsoft-testing-platform-features.md +++ b/docs/core/testing/microsoft-testing-platform-features.md @@ -3,7 +3,7 @@ title: Microsoft.Testing.Platform features description: Learn about the various Microsoft.Testing.Platform features, both built-in and available as extensions. author: nohwnd ms.author: jajares -ms.date: 08/26/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -35,8 +35,8 @@ Use the following path based on your goal: - 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 full-trust, UWP, or AppContainer 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 deploy and launch a packaged full-trust, UWP, or AppContainer test host: [Test host deployment](./microsoft-testing-platform-test-host-deployment.md) (extension; experimental launcher API) +- Need to reuse `Microsoft.Extensions.Configuration`, `Microsoft.Extensions.Hosting`, or `Microsoft.Extensions.Logging`: [Microsoft.Extensions integration](./microsoft-testing-platform-extensions-integration.md) (extension, experimental) - Need to build editor or IDE integration: [Server mode](./microsoft-testing-platform-server-mode.md) (built-in) - Need to load extensions that aren't compile-time references: [Dynamic extension loading](./microsoft-testing-platform-architecture-extensions.md#load-extensions-dynamically) (built-in, opt-in) - Need to retry failed tests: [Retry](./microsoft-testing-platform-retry.md#retry) (extension) @@ -106,10 +106,10 @@ Telemetry collection. Learn how to opt out and what data is collected. Capture evidence to diagnose a run, such as recording the screen with the video recorder. -**[Test host deployment](./microsoft-testing-platform-test-host-deployment.md)** (experimental, introduced in MTP 2.3.0; UWP and AppContainer support introduced in MTP 2.5) +**[Test host deployment](./microsoft-testing-platform-test-host-deployment.md)** (introduced in MTP 2.3.0; stable package API starting in MTP 2.4.0; experimental launcher API; UWP and AppContainer support introduced in MTP 2.5) Control how and where the test host is deployed and launched, including packaged full-trust, UWP, and AppContainer test hosts. -**[Microsoft.Extensions integration](./microsoft-testing-platform-extensions-integration.md)** (experimental, introduced in MTP 2.3.0) +**[Microsoft.Extensions integration](./microsoft-testing-platform-extensions-integration.md)** (experimental; logging introduced in MTP 2.3.0; configuration and hosting introduced in MTP 2.5 preview) -Bridge platform and extension diagnostics into the `Microsoft.Extensions.*` libraries your application already uses, such as forwarding logs through the `Microsoft.Extensions.Logging` pipeline. +Bridge MTP to the `Microsoft.Extensions.*` libraries your application already uses, including configuration snapshots, application-owned hosts, and diagnostic log forwarding. diff --git a/docs/core/testing/microsoft-testing-platform-intro.md b/docs/core/testing/microsoft-testing-platform-intro.md index 44fe93d74a36a..54ff712769b1e 100644 --- a/docs/core/testing/microsoft-testing-platform-intro.md +++ b/docs/core/testing/microsoft-testing-platform-intro.md @@ -3,7 +3,7 @@ title: Microsoft.Testing.Platform overview - .NET test runner description: Learn about Microsoft.Testing.Platform (MTP), a lightweight and portable .NET test runner and VSTest alternative for running unit tests in CI pipelines, CLI, and IDEs. author: Evangelink ms.author: amauryleve -ms.date: 09/30/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -89,6 +89,8 @@ The NuGet package [Microsoft.Testing.Platform.MSBuild](https://www.nuget.org/pac When this package is active (the default for MSTest, NUnit, and xUnit runners), installing an extension NuGet package is all that's needed — extensions are auto-registered with no code changes. If you disable the auto-generated entry point by setting `false`, you must register extensions manually in your `Main` method. Each extension page documents its manual registration call. +Starting with MTP 2.4, Microsoft-provided extension packages constrain their `Microsoft.Testing.Platform` dependency to the current major version. For example, a 2.4 extension requires `Microsoft.Testing.Platform` in the range `[2.4.0, 3.0.0)`. This range prevents NuGet from silently combining an extension with an unsupported future platform major. Keep the platform and extension packages on the same release line. + > [!NOTE] > This integration works in a transitive way (a project that references another project referencing this package will behave as if it references the package) and can be disabled through the `IsTestingPlatformApplication` MSBuild property. diff --git a/docs/core/testing/microsoft-testing-platform-open-telemetry.md b/docs/core/testing/microsoft-testing-platform-open-telemetry.md index 266a26e130910..9211276478ab1 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: 08/26/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -19,10 +19,13 @@ This extension integrates [OpenTelemetry](https://opentelemetry.io/) with Micros > [!IMPORTANT] > Starting with MTP 2.4.0, the OpenTelemetry extension follows the MTP release version and its public entry points are no longer experimental. -## Registration +## Choose provider ownership -> [!NOTE] -> This extension doesn't support auto-registration. You must register it manually by disabling the auto-generated entry point (`false`) and calling `AddOpenTelemetryProvider` in your `Main` method. +Choose whether MTP or your application owns the OpenTelemetry providers. + +### Use MTP-owned providers + +Disable the auto-generated entry point (`false`) and call `AddOpenTelemetryProvider` in your `Main` method: ```csharp var builder = await TestApplication.CreateBuilderAsync(args); @@ -48,8 +51,26 @@ builder.AddOpenTelemetryProviderFromEnvironment(); The method adds instrumentation only when you configure an exporter or pass a configuration callback, so you can leave the registration in the application when some environments don't export telemetry. +### Use application-owned providers + +Starting with MTP 2.5 preview, call `AddTestingPlatformDiagnostics` when your application already configures OpenTelemetry through Aspire ServiceDefaults, `Microsoft.Extensions.Hosting`, or another composition root. This method activates the `Microsoft.Testing.Platform` activity source and meter without creating, flushing, or disposing a `TracerProvider` or `MeterProvider`. + +Subscribe the application-owned provider with `AddTestingPlatformInstrumentation` on its tracing and metrics builders. The application retains ownership of its providers, exporters, resource identity, and disposal. + +For an MSBuild-generated hosted entry point, reference `Microsoft.Testing.Extensions.Hosting`, set `TestingPlatformHostFactory` to the host factory method, and set: + +```xml +HostOwned +``` + +`HostOwned` calls only `AddTestingPlatformDiagnostics`; it doesn't create providers or replace the host's resource identity. For host lifecycle and factory requirements, see [Host integration](microsoft-testing-platform-extensions-integration.md#host-integration). + ## API +### `AddTestingPlatformDiagnostics` + +Activates MTP's activity source and meter for application-owned listeners or OpenTelemetry providers without transferring provider ownership to MTP. + ### `AddOpenTelemetryProvider` Registers the OpenTelemetry provider on `ITestApplicationBuilder`. Accepts two optional callbacks: @@ -65,6 +86,10 @@ Call on `TracerProviderBuilder` or `MeterProviderBuilder` to subscribe to the bu Call on `ResourceBuilder` to add test assembly, host, operating system, and runtime attributes. The detector also identifies CI provider, pipeline, branch, and commit information for GitHub Actions, Azure Pipelines, GitLab CI, and Jenkins. +### Focused resource helpers + +For an application-owned provider, call `AddTestingPlatformTestResource` to add test-specific identity and `AddTestingPlatformCIResource` to add CI and source-control provenance. These focused helpers don't replace application-owned `service.*`, `host.*`, `os.*`, or `process.*` attributes. + ### `AddOpenTelemetryProviderFromEnvironment` Registers tracing, metrics, resource detection, and an OTLP exporter from standard OpenTelemetry environment variables. `OTEL_SDK_DISABLED=true` disables the integration. Configure `OTEL_TRACES_EXPORTER`, `OTEL_METRICS_EXPORTER`, or `OTEL_EXPORTER_OTLP_ENDPOINT` to activate export. @@ -84,6 +109,14 @@ MTP extends the conventions with additional result states (`skipped`, `error`, ` When the launching process supplies `TRACEPARENT` and `TRACESTATE`, MTP places the test run under that trace instead of starting an unrelated root trace. +## MSTest execution spans + +Starting with MSTest 4.5 and MTP 2.5 preview, native MSTest runs use one canonical MTP-owned activity for each test execution. MSTest makes the activity current while it runs the test constructor, initialization, test method, cleanup, and custom `TestMethodAttribute` code. Automatically instrumented `HttpClient`, SQL, Entity Framework, WCF, and custom activities therefore become children of the test activity. + +MTP adds the final result, timing, output, and artifacts to the same activity and stops it at the execution end time recorded by MSTest. This behavior avoids duplicate framework and result spans and prevents asynchronous result processing from inflating the test duration. + +Test frameworks that don't use the canonical execution API retain the compatibility topology: the framework execution activity and MTP result activity remain siblings, and the result activity links to the activity that was current when the framework published the in-progress update. + ## Emitted metrics | Instrument | Type | Unit | Description | diff --git a/docs/core/testing/microsoft-testing-platform-server-mode.md b/docs/core/testing/microsoft-testing-platform-server-mode.md index e3c774dd7cb31..322f4813be2fc 100644 --- a/docs/core/testing/microsoft-testing-platform-server-mode.md +++ b/docs/core/testing/microsoft-testing-platform-server-mode.md @@ -3,7 +3,7 @@ title: Microsoft.Testing.Platform (MTP) server mode description: Learn how tools and IDEs drive MTP test applications through JSON-RPC server mode. author: Evangelink ms.author: amauryleve -ms.date: 09/02/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -18,7 +18,7 @@ Start the public JSON-RPC server with `--server` or `--server jsonrpc`. ## Use the source-only client -The MTP 2.4 preview provides a canonical JSON-RPC client. Add the [Microsoft.Testing.Platform.ServerMode.Client.Sources](https://www.nuget.org/packages/Microsoft.Testing.Platform.ServerMode.Client.Sources) package. The package injects C# source into your project instead of adding a runtime assembly. +MTP 2.4 provides a canonical JSON-RPC client. Add the [Microsoft.Testing.Platform.ServerMode.Client.Sources](https://www.nuget.org/packages/Microsoft.Testing.Platform.ServerMode.Client.Sources) package. The package injects C# source into your project instead of adding a runtime assembly. The source-only design provides: @@ -57,6 +57,12 @@ Set `MtpServerClientOptions.IsStateful` to tell the server whether the client pr The client sends this setting through the experimental `capabilities.testing.isStateful` protocol capability. +## Negotiate protocol compatibility + +Starting with MTP 2.4, server-mode protocol negotiation is independent from the MTP NuGet package version. A client declares the protocol versions that it supports, and the server selects a common version. When no supported version overlaps, the test application exits with the `ProtocolError` exit code (`12`) instead of continuing with an incompatible wire contract. + +Use the versioned [server-mode 1.0 JSON schema](https://github.com/microsoft/testfx/blob/main/docs/mstest-runner-protocol/server-mode-1.0.schema.json) to validate messages. The System.Text.Json and Jsonite serializers follow the same schema and error envelope. + ## See also - [Run and debug tests with MTP](microsoft-testing-platform-run-and-debug.md) diff --git a/docs/core/testing/microsoft-testing-platform-terminal-output.md b/docs/core/testing/microsoft-testing-platform-terminal-output.md index ba38a90ed9ea2..e03cf2a01434b 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: 09/02/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -22,7 +22,7 @@ MTP supports these output modes: - `Detailed` reports all result blocks. ![Output with 1 failed, and 1 passed test and a summary](./media/test-output-and-summary-with-passed.png) -`Minimal` is available in MTP 2.4 preview. +`Minimal` is available starting with MTP 2.4. ## ANSI @@ -60,7 +60,7 @@ If your code must write directly to the console and you need that output to rema | `--progress` | 2.3.0 | Controls whether progress is shown. Valid values are `auto` (default), `on` (also accepts `true`, `enable`, `1`), and `off` (also accepts `false`, `disable`, `0`). | | `--no-ansi` | — | Disables outputting ANSI escape characters to screen. | | `--ansi` | 2.3.0 | 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`). | -| `--output` | — | Specifies the output verbosity for test results. Valid values are `Minimal`, `Normal`, and `Detailed`. The default is `Normal`. `Minimal` requires MTP 2.4 preview. | +| `--output` | — | Specifies the output verbosity for test results. Valid values are `Minimal`, `Normal`, and `Detailed`. The default is `Normal`. `Minimal` requires MTP 2.4 or later. | | `--show-test-results ` | 2.4.0 | Selects result blocks by outcome. Use `passed`, `failed`, `skipped`, `all`, or `none`. `failed` also includes errors, timeouts, and cancellations. | | `--show-stdout` | 2.2.1 | Determines when to show captured standard output of a test. Valid values are `All`, `Failed`, and `None`. Default is `All`. | | `--show-stderr` | 2.2.1 | Determines when to show captured error output of a test. Valid values are `All`, `Failed`, and `None`. Default is `All`. | diff --git a/docs/core/testing/microsoft-testing-platform-test-host-deployment.md b/docs/core/testing/microsoft-testing-platform-test-host-deployment.md index dbde0a52a583c..60cfe2daf8d60 100644 --- a/docs/core/testing/microsoft-testing-platform-test-host-deployment.md +++ b/docs/core/testing/microsoft-testing-platform-test-host-deployment.md @@ -3,7 +3,7 @@ title: Microsoft.Testing.Platform (MTP) test host deployment description: Learn how MTP extensions control test host deployment and startup. author: evangelink ms.author: amauryleve -ms.date: 09/30/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -28,7 +28,7 @@ The package was introduced in MTP 2.3. Starting with MTP 2.5, it supports packag MSTest.Sdk 4.5 or later configures this extension and the required full-trust app-model sidecar automatically. For application setup and run commands, see [Test UWP and WinUI 3 apps with MSTest and MTP](unit-testing-mstest-winui.md). > [!CAUTION] -> `Microsoft.Testing.Extensions.PackagedApp` and the `ITestHostLauncher` extension point are experimental. A future release might change their APIs and behavior. +> Starting with MTP 2.4, `Microsoft.Testing.Extensions.PackagedApp` follows the MTP release version, and its public registration API is no longer experimental. The generic `ITestHostLauncher` extension point remains experimental and might change in a future release. ### Meet the requirements diff --git a/docs/core/testing/microsoft-testing-platform-test-reports.md b/docs/core/testing/microsoft-testing-platform-test-reports.md index 0500d41d6c000..d44bc17de95ad 100644 --- a/docs/core/testing/microsoft-testing-platform-test-reports.md +++ b/docs/core/testing/microsoft-testing-platform-test-reports.md @@ -3,7 +3,7 @@ title: Microsoft.Testing.Platform (MTP) test reports description: Learn about the MTP extensions that create test report files (TRX, HTML, JUnit, CTRF, Azure DevOps, GitHub Actions). author: evangelink ms.author: amauryleve -ms.date: 09/15/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -31,7 +31,7 @@ A file name can include a relative path that stays within the test results direc For example, `--report-trx-filename "{asm}_{tfm}_{arch}.trx"` reproduces the default TRX name. -If a default or explicit TRX, HTML, or JUnit file name already exists for a test source, the extension warns and overwrites the file. Starting with the MTP 2.4 preview, CTRF uses the same behavior. To retain report history, include `{time}`. +If a default or explicit TRX, HTML, or JUnit file name already exists for a test source, the extension warns and overwrites the file. Starting with MTP 2.4, CTRF uses the same behavior. To retain report history, include `{time}`. > [!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. @@ -64,7 +64,9 @@ builder.AddTrxReportProvider(); > [!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. > -> Starting with the MTP 2.4 preview, an MTP-generated TRX preserves MSTest `[WorkItem]` and `[GitHubWorkItem]` metadata. +> Starting with MTP 2.4, TRX uses controller-backed recovery by default when the platform has a test-host controller. Browser, WASI, iOS, and tvOS use the in-process compatibility path. +> +> Starting with MTP 2.4, an MTP-generated TRX preserves MSTest `[WorkItem]` and `[GitHubWorkItem]` metadata. ### Options @@ -140,10 +142,12 @@ builder.AddCtrfReportProvider(); | `--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`. | -Starting with the MTP 2.4 preview, CTRF preserves every result when multiple tests use the same UID. It also includes per-test and prior-attempt attachments and infers their MIME types from file names. +Starting with MTP 2.4, CTRF preserves every result when multiple tests use the same UID. It also includes per-test and prior-attempt attachments and infers their MIME types from file names. For retried tests, CTRF correlates attempts only when the relationship is unambiguous. It then records earlier attempts in `retryAttempts`, sets `retries`, and marks a later successful result as `flaky: true`. Ambiguous same-UID results remain separate so the report doesn't associate diagnostics with the wrong test. +Starting with MTP 2.5 preview, `testId` derives from the framework's complete MTP test node UID. The reporter escapes values in its reserved identity namespaces and uses a deterministic SHA-256 identity for long UIDs instead of truncating them. Each reported execution receives a new UUID in `executionId`, and earlier retry attempts receive their own `attemptId`. The compatibility field `extra.uid` retains the original MTP UID. Attachment paths remain opaque values and can point to local files that a remote consumer can't access. + The terminal summary identifies flaky and retried tests. TRX and JUnit reports keep one final result per test instead of recording every attempt. ## Azure DevOps reports @@ -201,7 +205,9 @@ The extension automatically detects that it runs in a continuous integration (CI Starting with MTP 2.4.0, Azure DevOps Markdown summaries aggregate results across every test module in a `dotnet test` invocation. When you also enable code coverage, the summary includes covered and total counts, percentages, threshold results, and an indicator when coverage data is partial. -In the MTP 2.4 preview, live publishing automatically uploads file attachments for unsuccessful results to Azure DevOps test results. Unsuccessful outcomes include failed, errored, timed-out, and canceled results. +Starting with MTP 2.5 preview, the summary also presents pass rates, flaky-test history, duration comparisons, test dependency edges, focused failure diagnostics, and a compact deterministic layout for multi-module runs. + +Starting with MTP 2.4, live publishing automatically uploads file attachments for unsuccessful results to Azure DevOps test results. Unsuccessful outcomes include failed, errored, timed-out, and canceled results. When a result supplies standard output or standard error, the extension can attach up to 256 KiB of each inline stream. Each file-backed attachment has a 16-MiB limit. diff --git a/docs/core/testing/mstest-analyzers/mstest0048.md b/docs/core/testing/mstest-analyzers/mstest0048.md index e694a077a34c5..ae7b7a7afc1e7 100644 --- a/docs/core/testing/mstest-analyzers/mstest0048.md +++ b/docs/core/testing/mstest-analyzers/mstest0048.md @@ -1,7 +1,7 @@ --- title: "MSTEST0048: Avoid TestContext properties in fixture methods" description: "Learn about code analysis rule MSTEST0048: Avoid TestContext properties in fixture methods" -ms.date: 09/02/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted f1_keywords: - MSTEST0048 @@ -29,7 +29,7 @@ ms.author: amauryleve A fixture method (methods with , , , or ) accesses restricted properties. -Starting with MSTest.Analyzers 4.4 preview, the rule also reports constant indexer access to a restricted key, such as `testContext.Properties["TestName"]`. It doesn't report indexer access when the key isn't a constant string. +Starting with MSTest.Analyzers 4.4, the rule also reports constant indexer access to a restricted key, such as `testContext.Properties["TestName"]`. It doesn't report indexer access when the key isn't a constant string. ## Rule description diff --git a/docs/core/testing/mstest-analyzers/mstest0069.md b/docs/core/testing/mstest-analyzers/mstest0069.md index 8acfdfa626f49..3d699b0a539d7 100644 --- a/docs/core/testing/mstest-analyzers/mstest0069.md +++ b/docs/core/testing/mstest-analyzers/mstest0069.md @@ -1,7 +1,7 @@ --- title: "MSTEST0069: Inherited [TestClass] is ignored by the MSTest source generator" description: "Learn about code analysis rule MSTEST0069: Inherited [TestClass] is ignored by the MSTest source generator" -ms.date: 06/30/2026 +ms.date: 10/01/2026 f1_keywords: - MSTEST0069 - InheritedTestClassAttributeWithSourceGeneratorAnalyzer @@ -28,7 +28,7 @@ dev_langs: | **Is there a code fix** | No | > [!NOTE] -> This analyzer ships in the `MSTest.SourceGeneration` package and is only loaded for projects that have opted into the [MSTest reflection source generator](../unit-testing-mstest-sdk.md), which is an experimental feature. It doesn't apply when the default reflection-based discovery is used. +> This analyzer ships in the `MSTest.SourceGeneration` package and is only loaded for projects that have opted into the [MSTest reflection source generator](../unit-testing-mstest-sdk.md). It doesn't apply when the default reflection-based discovery is used. ## Cause diff --git a/docs/core/testing/mstest-analyzers/mstest0072.md b/docs/core/testing/mstest-analyzers/mstest0072.md index 970bd27a3f132..76a15410da7f7 100644 --- a/docs/core/testing/mstest-analyzers/mstest0072.md +++ b/docs/core/testing/mstest-analyzers/mstest0072.md @@ -1,7 +1,7 @@ --- title: "MSTEST0072: '[AssemblyFixtureProvider]' isn't supported with ahead-of-time compilation" description: "Learn about code analysis rule MSTEST0072: '[AssemblyFixtureProvider]' isn't supported with ahead-of-time compilation" -ms.date: 08/06/2026 +ms.date: 10/01/2026 f1_keywords: - MSTEST0072 - AssemblyFixtureProviderNotSupportedWithNativeAotAnalyzer @@ -24,12 +24,9 @@ dev_langs: | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | | **Default severity** | Warning | -| **Introduced in version** | 4.4.0 (preview) | +| **Introduced in version** | 4.4.0 | | **Is there a code fix** | No | -> [!IMPORTANT] -> This analyzer is planned for MSTest 4.4 and is available only in preview builds until MSTest 4.4.0 is released. - ## Cause A project applies `[AssemblyFixtureProvider]`, either directly or through a referenced library, while publishing with Native AOT (`PublishAot`) or Blazor WebAssembly AOT (`RunAOTCompilation`). diff --git a/docs/core/testing/mstest-analyzers/mstest0073.md b/docs/core/testing/mstest-analyzers/mstest0073.md index ef7fad3234102..90ee8b3af73d6 100644 --- a/docs/core/testing/mstest-analyzers/mstest0073.md +++ b/docs/core/testing/mstest-analyzers/mstest0073.md @@ -1,7 +1,7 @@ --- title: "MSTEST0073: Prefer a constant for the '[ResourceLock]' resource key" description: "Learn about code analysis rule MSTEST0073: Prefer a constant for the '[ResourceLock]' resource key" -ms.date: 08/06/2026 +ms.date: 10/01/2026 f1_keywords: - MSTEST0073 - PreferConstantForResourceLockAnalyzer @@ -24,12 +24,9 @@ dev_langs: | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | | **Default severity** | Info | -| **Introduced in version** | 4.4.0 (preview) | +| **Introduced in version** | 4.4.0 | | **Is there a code fix** | No | -> [!IMPORTANT] -> `ResourceLockAttribute` is planned for MSTest 4.4 and is available only in preview builds until MSTest 4.4.0 is released. - ## Cause A `[ResourceLock]` attribute passes its resource key as a bare string literal instead of referencing a shared constant. diff --git a/docs/core/testing/mstest-analyzers/mstest0074.md b/docs/core/testing/mstest-analyzers/mstest0074.md index 44c0ce3b3dbfb..0fa97ebbb7ad0 100644 --- a/docs/core/testing/mstest-analyzers/mstest0074.md +++ b/docs/core/testing/mstest-analyzers/mstest0074.md @@ -1,7 +1,7 @@ --- title: "MSTEST0074: Test mutating process-global state should declare a resource lock" description: "Learn about code analysis rule MSTEST0074: Test mutating process-global state should declare a resource lock" -ms.date: 08/06/2026 +ms.date: 10/01/2026 f1_keywords: - MSTEST0074 - UndeclaredProcessGlobalStateMutationAnalyzer @@ -24,12 +24,9 @@ dev_langs: | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | | **Default severity** | Info | -| **Introduced in version** | 4.4.0 (preview) | +| **Introduced in version** | 4.4.0 | | **Is there a code fix** | Yes, for C# only | -> [!IMPORTANT] -> `ResourceLockAttribute` is planned for MSTest 4.4 and is available only in preview builds until MSTest 4.4.0 is released. - > [!NOTE] > This analyzer activates only when assembly parallelization is syntactically enabled, for example through `[assembly: Parallelize]` without a matching `[assembly: DoNotParallelize]`, or when a `.editorconfig` file sets `mstest_parallel_safety_mode = always`. The analyzer can't detect parallelization that's enabled only through `.runsettings` or MSBuild properties such as `MSTestParallelizeWorkers`. Set the `.editorconfig` option if you configure parallelization that way and still want this analyzer to run. diff --git a/docs/core/testing/mstest-analyzers/mstest0075.md b/docs/core/testing/mstest-analyzers/mstest0075.md index 67b6ea96b8c3f..27c1c69a09a2e 100644 --- a/docs/core/testing/mstest-analyzers/mstest0075.md +++ b/docs/core/testing/mstest-analyzers/mstest0075.md @@ -1,7 +1,7 @@ --- title: "MSTEST0075: Avoid changing the current directory in a parallelized test" description: "Learn about code analysis rule MSTEST0075: Avoid changing the current directory in a parallelized test" -ms.date: 08/06/2026 +ms.date: 10/01/2026 f1_keywords: - MSTEST0075 - CurrentDirectoryMutationUnderParallelizationAnalyzer @@ -24,12 +24,9 @@ dev_langs: | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | | **Default severity** | Info | -| **Introduced in version** | 4.4.0 (preview) | +| **Introduced in version** | 4.4.0 | | **Is there a code fix** | Yes, for C# only | -> [!IMPORTANT] -> `ResourceLockAttribute` is planned for MSTest 4.4 and is available only in preview builds until MSTest 4.4.0 is released. - > [!NOTE] > This analyzer activates only when assembly parallelization is syntactically enabled, for example through `[assembly: Parallelize]` without a matching `[assembly: DoNotParallelize]`, or when a `.editorconfig` file sets `mstest_parallel_safety_mode = always`. The analyzer can't detect parallelization that's enabled only through `.runsettings` or MSBuild properties such as `MSTestParallelizeWorkers`. Set the `.editorconfig` option if you configure parallelization that way and still want this analyzer to run. diff --git a/docs/core/testing/mstest-analyzers/mstest0076.md b/docs/core/testing/mstest-analyzers/mstest0076.md index c7e9d871ddc5d..2e3cddf29a69f 100644 --- a/docs/core/testing/mstest-analyzers/mstest0076.md +++ b/docs/core/testing/mstest-analyzers/mstest0076.md @@ -1,7 +1,7 @@ --- title: "MSTEST0076: Avoid mutating process-wide culture in a parallelized test" description: "Learn about code analysis rule MSTEST0076: Avoid mutating process-wide culture in a parallelized test" -ms.date: 08/06/2026 +ms.date: 10/01/2026 f1_keywords: - MSTEST0076 - CultureMutationUnderParallelizationAnalyzer @@ -24,7 +24,7 @@ dev_langs: | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | | **Default severity** | Info | -| **Introduced in version** | 4.4.0 (preview) | +| **Introduced in version** | 4.4.0 | | **Is there a code fix** | No | > [!NOTE] diff --git a/docs/core/testing/mstest-analyzers/mstest0077.md b/docs/core/testing/mstest-analyzers/mstest0077.md index 3bea5dd82e952..154dc82b821bc 100644 --- a/docs/core/testing/mstest-analyzers/mstest0077.md +++ b/docs/core/testing/mstest-analyzers/mstest0077.md @@ -1,7 +1,7 @@ --- title: "MSTEST0077: Avoid hardcoded or shared filesystem paths in a parallelized test" description: "Learn about code analysis rule MSTEST0077: Avoid hardcoded or shared filesystem paths in a parallelized test" -ms.date: 08/06/2026 +ms.date: 10/01/2026 f1_keywords: - MSTEST0077 - SharedFileSystemPathInTestAnalyzer @@ -24,12 +24,9 @@ dev_langs: | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | | **Default severity** | Info | -| **Introduced in version** | 4.4.0 (preview) | +| **Introduced in version** | 4.4.0 | | **Is there a code fix** | No | -> [!IMPORTANT] -> `TestContext.TestTempDirectory` is planned for MSTest 4.4 and is available only in preview builds until MSTest 4.4.0 is released. - > [!NOTE] > This analyzer activates only when assembly parallelization is syntactically enabled, for example through `[assembly: Parallelize]` without a matching `[assembly: DoNotParallelize]`, or when a `.editorconfig` file sets `mstest_parallel_safety_mode = always`. The analyzer can't detect parallelization that's enabled only through `.runsettings` or MSBuild properties such as `MSTestParallelizeWorkers`. Set the `.editorconfig` option if you configure parallelization that way and still want this analyzer to run. diff --git a/docs/core/testing/mstest-analyzers/mstest0078.md b/docs/core/testing/mstest-analyzers/mstest0078.md index a88480dabce4c..490156a811618 100644 --- a/docs/core/testing/mstest-analyzers/mstest0078.md +++ b/docs/core/testing/mstest-analyzers/mstest0078.md @@ -1,7 +1,7 @@ --- title: "MSTEST0078: '[DependsOn]' arguments should be valid" description: "Learn about code analysis rule MSTEST0078: '[DependsOn]' arguments should be valid" -ms.date: 08/06/2026 +ms.date: 10/01/2026 f1_keywords: - MSTEST0078 - DependsOnShouldBeValidAnalyzer @@ -24,12 +24,9 @@ dev_langs: | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | | **Default severity** | Warning | -| **Introduced in version** | 4.4.0 (preview) | +| **Introduced in version** | 4.4.0 | | **Is there a code fix** | No | -> [!IMPORTANT] -> Test dependencies are planned for MSTest 4.4 and are available only in preview builds until MSTest 4.4.0 is released. - ## Cause A `[DependsOn]` attribute references a test by name, and the reference has a problem that the test framework can decide only at run time, such as a target that doesn't exist. diff --git a/docs/core/testing/mstest-analyzers/mstest0079.md b/docs/core/testing/mstest-analyzers/mstest0079.md index a42caed42add9..72f02738b7352 100644 --- a/docs/core/testing/mstest-analyzers/mstest0079.md +++ b/docs/core/testing/mstest-analyzers/mstest0079.md @@ -1,7 +1,7 @@ --- title: "MSTEST0079: Use ArchitectureCondition attribute instead of runtime checks" description: "Learn about code analysis rule MSTEST0079: Use ArchitectureCondition attribute instead of runtime checks" -ms.date: 08/06/2026 +ms.date: 10/01/2026 f1_keywords: - MSTEST0079 - UseArchitectureConditionAttributeInsteadOfRuntimeCheckAnalyzer @@ -24,7 +24,7 @@ dev_langs: | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | | **Default severity** | Info | -| **Introduced in version** | 4.4.0 (preview) | +| **Introduced in version** | 4.4.0 | | **Is there a code fix** | Yes, for C# only | ## Cause diff --git a/docs/core/testing/mstest-analyzers/mstest0080.md b/docs/core/testing/mstest-analyzers/mstest0080.md index cde1095d08fa3..269110ef2028b 100644 --- a/docs/core/testing/mstest-analyzers/mstest0080.md +++ b/docs/core/testing/mstest-analyzers/mstest0080.md @@ -1,7 +1,7 @@ --- title: "MSTEST0080: Use CICondition attribute instead of environment checks" description: "Learn about code analysis rule MSTEST0080: Use CICondition attribute instead of environment checks" -ms.date: 08/06/2026 +ms.date: 10/01/2026 f1_keywords: - MSTEST0080 - UseCIConditionAttributeInsteadOfEnvironmentCheckAnalyzer @@ -24,7 +24,7 @@ dev_langs: | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | | **Default severity** | Info | -| **Introduced in version** | 4.4.0 (preview) | +| **Introduced in version** | 4.4.0 | | **Is there a code fix** | Yes, for C# only | ## Cause diff --git a/docs/core/testing/mstest-analyzers/mstest0081.md b/docs/core/testing/mstest-analyzers/mstest0081.md index b9e6c8db835ab..ade25f8aa662a 100644 --- a/docs/core/testing/mstest-analyzers/mstest0081.md +++ b/docs/core/testing/mstest-analyzers/mstest0081.md @@ -1,7 +1,7 @@ --- title: "MSTEST0081: '[TestFilterProvider]' should reference a valid test filter type" description: "Learn about code analysis rule MSTEST0081: '[TestFilterProvider]' should reference a valid test filter type" -ms.date: 08/06/2026 +ms.date: 10/01/2026 f1_keywords: - MSTEST0081 - TestFilterProviderShouldBeValidAnalyzer @@ -24,12 +24,9 @@ dev_langs: | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | | **Default severity** | Warning | -| **Introduced in version** | 4.4.0 (preview) | +| **Introduced in version** | 4.4.0 | | **Is there a code fix** | No | -> [!IMPORTANT] -> This analyzer is planned for MSTest 4.4 and is available only in preview builds until MSTest 4.4.0 is released. - ## Cause `[assembly: TestFilterProvider(typeof(MyFilter))]` references a type that doesn't satisfy the requirements the adapter enforces at run time, or the assembly registers more than one test filter provider. diff --git a/docs/core/testing/mstest-analyzers/mstest0082.md b/docs/core/testing/mstest-analyzers/mstest0082.md index 188e61fbc2b19..f3312d8cbb423 100644 --- a/docs/core/testing/mstest-analyzers/mstest0082.md +++ b/docs/core/testing/mstest-analyzers/mstest0082.md @@ -1,7 +1,7 @@ --- title: "MSTEST0082: A test class inherits a lifecycle or test method from a different MSTest version" description: "Learn about code analysis rule MSTEST0082: A test class inherits a lifecycle or test method from a different MSTest version" -ms.date: 08/26/2026 +ms.date: 10/01/2026 f1_keywords: - MSTEST0082 - InheritedMemberFromDifferentMSTestVersionAnalyzer @@ -24,12 +24,9 @@ dev_langs: | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | | **Default severity** | Warning | -| **Introduced in version** | 4.4.0 (preview) | +| **Introduced in version** | 4.4.0 | | **Is there a code fix** | No | -> [!IMPORTANT] -> This analyzer is planned for MSTest 4.4 and is available only in preview builds until MSTest 4.4.0 is released. - ## Cause A discoverable test class inherits a public test method or lifecycle method from an assembly that references a different major version of MSTest. diff --git a/docs/core/testing/mstest-analyzers/mstest0083.md b/docs/core/testing/mstest-analyzers/mstest0083.md index f184e1a012ebe..9dd510756661e 100644 --- a/docs/core/testing/mstest-analyzers/mstest0083.md +++ b/docs/core/testing/mstest-analyzers/mstest0083.md @@ -1,7 +1,7 @@ --- title: "MSTEST0083: Use '[ExecutableCondition]' instead of 'File.Exists' checks before 'Process.Start'" description: "Learn about code analysis rule MSTEST0083: Use '[ExecutableCondition]' instead of 'File.Exists' checks before 'Process.Start'" -ms.date: 08/26/2026 +ms.date: 10/01/2026 f1_keywords: - MSTEST0083 - UseExecutableConditionAttributeInsteadOfProcessCheckAnalyzer @@ -24,12 +24,9 @@ dev_langs: | **Fix is breaking or non-breaking** | Non-breaking | | **Enabled by default** | Yes | | **Default severity** | Info | -| **Introduced in version** | 4.4.0 (preview) | +| **Introduced in version** | 4.4.0 | | **Is there a code fix** | Yes, for C# only | -> [!IMPORTANT] -> This analyzer is planned for MSTest 4.4 and is available only in preview builds until MSTest 4.4.0 is released. - ## Cause A test method first checks whether an executable exists and returns or calls `Assert.Inconclusive` when it doesn't, then calls `Process.Start` with the same executable path. diff --git a/docs/core/testing/mstest-analyzers/mstest0084.md b/docs/core/testing/mstest-analyzers/mstest0084.md new file mode 100644 index 0000000000000..93a12b39683b4 --- /dev/null +++ b/docs/core/testing/mstest-analyzers/mstest0084.md @@ -0,0 +1,84 @@ +--- +title: "MSTEST0084: Platform compatibility attributes should be consistent with '[OSCondition]'" +description: "Learn about code analysis rule MSTEST0084: Platform compatibility attributes should be consistent with '[OSCondition]'" +ms.date: 10/01/2026 +f1_keywords: +- MSTEST0084 +- OSPlatformAttributesShouldBeConsistentAnalyzer +helpviewer_keywords: +- OSPlatformAttributesShouldBeConsistentAnalyzer +- MSTEST0084 +author: evangelink +ms.author: amauryleve +ai-usage: ai-generated +dev_langs: +- CSharp +- VB +--- +# MSTEST0084: Platform compatibility attributes should be consistent with '\[OSCondition]' + +| Property | Value | +|---|---| +| **Rule ID** | MSTEST0084 | +| **Title** | Platform compatibility attributes should be consistent with `[OSCondition]` | +| **Category** | Usage | +| **Fix is breaking or non-breaking** | Non-breaking | +| **Enabled by default** | Yes | +| **Default severity** | Info | +| **Introduced in version** | 4.5.0 (preview) | +| **Is there a code fix** | Yes, for C# only | + +## Cause + +An MSTest class or method uses or , but its MSTest doesn't express a compatible operating-system condition. + +## Rule description + +Platform compatibility attributes inform compile-time analysis, but they don't control whether MSTest runs a test. Without a compatible `[OSCondition]`, a test can execute on an unsupported operating system and fail before it reaches the behavior that it intends to verify. + +```csharp +[TestMethod] +[SupportedOSPlatform("windows")] +public void UsesWindowsApi() { } // Violation +``` + +The rule compares operating-system families. `[OSCondition]` doesn't represent platform version constraints, so the analyzer doesn't report scenarios whose version constraints can't be represented safely. + +## How to fix violations + +Keep the platform compatibility attribute for API analysis, and add or update `[OSCondition]` so MSTest skips the test on unsupported operating-system families. + +```csharp +[TestMethod] +[SupportedOSPlatform("windows")] +[OSCondition(OperatingSystems.Windows)] +public void UsesWindowsApi() { } +``` + +A C# code fix adds or updates `[OSCondition]`. Visual Basic reports the diagnostic but doesn't provide an automatic fix. + +## When to suppress warnings + +Suppress the rule when another mechanism guarantees that the test can't run on an incompatible operating system and adding `[OSCondition]` would duplicate that policy. + +## Suppress a warning + +```csharp +#pragma warning disable MSTEST0084 +// The code that's violating the rule is on this line. +#pragma warning restore MSTEST0084 +``` + +To disable the rule for a file, folder, or project, set its severity to `none` in the [configuration file](../../../fundamentals/code-analysis/configuration-files.md). + +```ini +[*.{cs,vb}] +dotnet_diagnostic.MSTEST0084.severity = none +``` + +For more information, see [How to suppress code analysis warnings](../../../fundamentals/code-analysis/suppress-warnings.md). + +## See also + +- [OSConditionAttribute](../unit-testing-mstest-writing-tests-controlling-execution.md#osconditionattribute) +- [MSTEST0061: Use OSCondition attribute instead of runtime check](mstest0061.md) diff --git a/docs/core/testing/mstest-analyzers/mstest0085.md b/docs/core/testing/mstest-analyzers/mstest0085.md new file mode 100644 index 0000000000000..80269e6afcd33 --- /dev/null +++ b/docs/core/testing/mstest-analyzers/mstest0085.md @@ -0,0 +1,83 @@ +--- +title: "MSTEST0085: '[TestClass]' should not be applied to abstract classes" +description: "Learn about code analysis rule MSTEST0085: '[TestClass]' should not be applied to abstract classes" +ms.date: 10/01/2026 +f1_keywords: +- MSTEST0085 +- TestClassAttributeShouldNotBeAppliedToAbstractClassAnalyzer +helpviewer_keywords: +- TestClassAttributeShouldNotBeAppliedToAbstractClassAnalyzer +- MSTEST0085 +author: evangelink +ms.author: amauryleve +ai-usage: ai-generated +dev_langs: +- CSharp +- VB +--- +# MSTEST0085: '\[TestClass]' should not be applied to abstract classes + +| Property | Value | +|---|---| +| **Rule ID** | MSTEST0085 | +| **Title** | `[TestClass]` should not be applied to abstract classes | +| **Category** | Usage | +| **Fix is breaking or non-breaking** | Non-breaking | +| **Enabled by default** | Yes | +| **Default severity** | Info | +| **Introduced in version** | 4.5.0 (preview) | +| **Is there a code fix** | No | + +## Cause + +An abstract class declares or an attribute that derives from it. + +## Rule description + +MSTest can't instantiate or discover an abstract class as a test class, so `[TestClass]` has no effect on the abstract type. Test methods declared in an abstract base class are discovered through concrete derived classes. Each concrete class must declare its own `[TestClass]` attribute because test-class attributes aren't inherited. + +```csharp +[TestClass] // Violation +public abstract class SharedTests +{ + [TestMethod] public void CommonTest() { } +} +``` + +## How to fix violations + +Remove `[TestClass]` from the abstract base class, and apply it to each concrete derived test class. + +```csharp +public abstract class SharedTests { } + +[TestClass] +public sealed class ConcreteTests : SharedTests { } +``` + +## When to suppress warnings + +Don't suppress this rule. The attribute on the abstract class doesn't make the class discoverable, and concrete derived classes still require `[TestClass]`. + +## Suppress a warning + +```csharp +#pragma warning disable MSTEST0085 +// The code that's violating the rule is on this line. +#pragma warning restore MSTEST0085 +``` + +To disable the rule for a file, folder, or project, set its severity to `none` in the [configuration file](../../../fundamentals/code-analysis/configuration-files.md). + +```ini +[*.{cs,vb}] +dotnet_diagnostic.MSTEST0085.severity = none +``` + +For more information, see [How to suppress code analysis warnings](../../../fundamentals/code-analysis/suppress-warnings.md). + +## See also + +- [Write tests with MSTest](../unit-testing-mstest-writing-tests.md) +- [MSTEST0002: Test class should be valid](mstest0002.md) +- [MSTEST0069: Inherited TestClass is ignored by the MSTest source generator](mstest0069.md) diff --git a/docs/core/testing/mstest-analyzers/mstest0086.md b/docs/core/testing/mstest-analyzers/mstest0086.md new file mode 100644 index 0000000000000..9dac87f92c899 --- /dev/null +++ b/docs/core/testing/mstest-analyzers/mstest0086.md @@ -0,0 +1,88 @@ +--- +title: "MSTEST0086: Remove redundant test method attribute" +description: "Learn about code analysis rule MSTEST0086: Remove redundant test method attribute" +ms.date: 10/01/2026 +f1_keywords: +- MSTEST0086 +- RedundantTestMethodAttributeAnalyzer +helpviewer_keywords: +- RedundantTestMethodAttributeAnalyzer +- MSTEST0086 +author: evangelink +ms.author: amauryleve +ai-usage: ai-generated +dev_langs: +- CSharp +- VB +--- +# MSTEST0086: Remove redundant test method attribute + +| Property | Value | +|---|---| +| **Rule ID** | MSTEST0086 | +| **Title** | Remove redundant test method attribute | +| **Category** | Usage | +| **Fix is breaking or non-breaking** | Non-breaking | +| **Enabled by default** | Yes | +| **Default severity** | Info | +| **Introduced in version** | 4.5.0 (preview) | +| **Is there a code fix** | Yes, for C# only | + +## Cause + +A test method declares an MSTest attribute whose effective behavior is already supplied by its containing test class or a base test class. + +## Rule description + +Duplicate attributes make the effective test policy harder to understand and maintain. The rule reports method-level conditions, retry settings, isolation settings, metadata, deployment items, or dependencies only when the class-level configuration already provides equivalent or more restrictive behavior. + +The rule covers `OSCondition`, `ArchitectureCondition`, `CICondition`, `DoNotParallelize`, `ResourceLock`, `Retry`, `Ignore`, `TestCategory`, `TestProperty`, `DeploymentItem`, and `DependsOn`. + +```csharp +[TestClass, DoNotParallelize] +public class Tests +{ + [TestMethod, DoNotParallelize] // Violation + public void Test() { } +} +``` + +## How to fix violations + +Remove the redundant method-level attribute. Keep an attribute on the method when it changes or narrows the class-level behavior. + +```csharp +[TestClass, DoNotParallelize] +public class Tests +{ + [TestMethod] public void Test() { } +} +``` + +A C# code fix removes the redundant attribute. Visual Basic reports the diagnostic but doesn't provide an automatic fix. + +## When to suppress warnings + +Suppress the rule when the duplicate attribute intentionally documents a local policy and that documentation value outweighs the maintenance cost. + +## Suppress a warning + +```csharp +#pragma warning disable MSTEST0086 +// The code that's violating the rule is on this line. +#pragma warning restore MSTEST0086 +``` + +To disable the rule for a file, folder, or project, set its severity to `none` in the [configuration file](../../../fundamentals/code-analysis/configuration-files.md). + +```ini +[*.{cs,vb}] +dotnet_diagnostic.MSTEST0086.severity = none +``` + +For more information, see [How to suppress code analysis warnings](../../../fundamentals/code-analysis/suppress-warnings.md). + +## See also + +- [Write tests with MSTest](../unit-testing-mstest-writing-tests.md) +- [Test execution and control](../unit-testing-mstest-writing-tests-controlling-execution.md) diff --git a/docs/core/testing/mstest-analyzers/mstest0087.md b/docs/core/testing/mstest-analyzers/mstest0087.md new file mode 100644 index 0000000000000..bd21b84fdcc44 --- /dev/null +++ b/docs/core/testing/mstest-analyzers/mstest0087.md @@ -0,0 +1,79 @@ +--- +title: "MSTEST0087: Avoid duplicated 'DataRow' display names" +description: "Learn about code analysis rule MSTEST0087: Avoid duplicated 'DataRow' display names" +ms.date: 10/01/2026 +f1_keywords: +- MSTEST0087 +- DuplicateDataRowDisplayNameAnalyzer +helpviewer_keywords: +- DuplicateDataRowDisplayNameAnalyzer +- MSTEST0087 +author: evangelink +ms.author: amauryleve +ai-usage: ai-generated +dev_langs: +- CSharp +- VB +--- +# MSTEST0087: Avoid duplicated `DataRow` display names + +| Property | Value | +|---|---| +| **Rule ID** | MSTEST0087 | +| **Title** | Avoid duplicated `DataRow` display names | +| **Category** | Usage | +| **Fix is breaking or non-breaking** | Non-breaking | +| **Enabled by default** | Yes | +| **Default severity** | Warning | +| **Introduced in version** | 4.5.0 (preview) | +| **Is there a code fix** | No | + +## Cause + +Two or more instances on the same test method set the same nonempty `DisplayName`. + +## Rule description + +Duplicate explicit display names make data rows indistinguishable in Test Explorer, reports, and failure output. The rule compares names with ordinal, case-sensitive equality and reports each duplicate after the first occurrence. + +```csharp +[TestMethod] +[DataRow(1, DisplayName = "valid")] +[DataRow(2, DisplayName = "valid")] // Violation +public void Validate(int value) { } +``` + +## How to fix violations + +Give each row a unique display name, or remove `DisplayName` and let MSTest generate names from the method and arguments. + +```csharp +[DataRow(1, DisplayName = "valid-one")] +[DataRow(2, DisplayName = "valid-two")] +``` + +## When to suppress warnings + +Don't suppress this rule when the rows must remain distinguishable in test results. Suppression is reasonable only when a downstream runner replaces the display names with another unique identity. + +## Suppress a warning + +```csharp +#pragma warning disable MSTEST0087 +// The code that's violating the rule is on this line. +#pragma warning restore MSTEST0087 +``` + +To disable the rule for a file, folder, or project, set its severity to `none` in the [configuration file](../../../fundamentals/code-analysis/configuration-files.md). + +```ini +[*.{cs,vb}] +dotnet_diagnostic.MSTEST0087.severity = none +``` + +For more information, see [How to suppress code analysis warnings](../../../fundamentals/code-analysis/suppress-warnings.md). + +## See also + +- [Data-driven testing in MSTest](../unit-testing-mstest-writing-tests-data-driven.md) +- [MSTEST0042: Duplicate DataRow](mstest0042.md) diff --git a/docs/core/testing/mstest-analyzers/overview.md b/docs/core/testing/mstest-analyzers/overview.md index 486ca0559e82a..321bf992d0049 100644 --- a/docs/core/testing/mstest-analyzers/overview.md +++ b/docs/core/testing/mstest-analyzers/overview.md @@ -3,7 +3,7 @@ title: MSTest code analysis description: Learn about the MSTest code analysis. author: evangelink ms.author: amauryleve -ms.date: 08/26/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -119,6 +119,8 @@ Rules that help ensure your test classes and methods are properly structured and - [MSTEST0078](mstest0078.md) - `[DependsOn]` arguments should be valid - [MSTEST0081](mstest0081.md) - `[TestFilterProvider]` should reference a valid test filter type - [MSTEST0082](mstest0082.md) - A test class inherits a lifecycle or test method from a different MSTest version +- [MSTEST0085](mstest0085.md) - `[TestClass]` should not be applied to abstract classes +- [MSTEST0086](mstest0086.md) - Remove redundant test method attribute Related documentation: [Write tests with MSTest](../unit-testing-mstest-writing-tests.md) @@ -149,6 +151,7 @@ Rules for working with data-driven test scenarios: - [MSTEST0042](mstest0042.md) - Duplicate DataRow - [MSTEST0052](mstest0052.md) - Avoid explicit DynamicDataSourceType - [MSTEST0062](mstest0062.md) - Avoid out/ref test method parameters +- [MSTEST0087](mstest0087.md) - Avoid duplicated `DataRow` display names Related documentation: [Data-driven testing](../unit-testing-mstest-writing-tests-data-driven.md) @@ -244,6 +247,7 @@ Rules for configuring test execution, parallelization, and other test settings: - [MSTEST0081](mstest0081.md) - `[TestFilterProvider]` should reference a valid test filter type - [MSTEST0082](mstest0082.md) - A test class inherits a lifecycle or test method from a different MSTest version - [MSTEST0083](mstest0083.md) - Use `[ExecutableCondition]` instead of `File.Exists` checks before `Process.Start` +- [MSTEST0084](mstest0084.md) - Platform compatibility attributes should be consistent with `[OSCondition]` Related documentation: [Configure MSTest](../unit-testing-mstest-configure.md), [Running tests](../unit-testing-mstest-running-tests.md) @@ -334,6 +338,10 @@ Related documentation: [Configure MSTest](../unit-testing-mstest-configure.md), | [MSTEST0081](mstest0081.md) | Usage | `[TestFilterProvider]` should reference a valid test filter type | Warning | | [MSTEST0082](mstest0082.md) | Usage | A test class inherits a lifecycle or test method from a different MSTest version | Warning | | [MSTEST0083](mstest0083.md) | Usage | Use `[ExecutableCondition]` instead of `File.Exists` checks before `Process.Start` | Info | +| [MSTEST0084](mstest0084.md) | Usage | Platform compatibility attributes should be consistent with `[OSCondition]` | Info | +| [MSTEST0085](mstest0085.md) | Usage | `[TestClass]` should not be applied to abstract classes | Info | +| [MSTEST0086](mstest0086.md) | Usage | Remove redundant test method attribute | Info | +| [MSTEST0087](mstest0087.md) | Usage | Avoid duplicated `DataRow` display names | Warning | \* Escalated to Error in `Recommended` and `All` modes. diff --git a/docs/core/testing/mstest-analyzers/usage-rules.md b/docs/core/testing/mstest-analyzers/usage-rules.md index e3a24d0dbc481..fe12302b21f45 100644 --- a/docs/core/testing/mstest-analyzers/usage-rules.md +++ b/docs/core/testing/mstest-analyzers/usage-rules.md @@ -3,7 +3,7 @@ title: MSTest Usage rules (code analysis) description: Learn about MSTest code analysis usage rules. author: evangelink ms.author: amauryleve -ms.date: 08/26/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -79,6 +79,10 @@ Usage rules support proper usage of MSTest attributes, methods, and patterns. Th | [MSTEST0081](mstest0081.md) | `[TestFilterProvider]` should reference a valid test filter type. | Warning | No | | [MSTEST0082](mstest0082.md) | A test class inherits a lifecycle or test method from a different MSTest version. | Warning | No | | [MSTEST0083](mstest0083.md) | Use `[ExecutableCondition]` instead of `File.Exists` checks before `Process.Start`. | Info | Yes | +| [MSTEST0084](mstest0084.md) | Platform compatibility attributes should be consistent with `[OSCondition]`. | Info | Yes | +| [MSTEST0085](mstest0085.md) | `[TestClass]` should not be applied to abstract classes. | Info | No | +| [MSTEST0086](mstest0086.md) | Remove redundant test method attribute. | Info | Yes | +| [MSTEST0087](mstest0087.md) | Avoid duplicated `DataRow` display names. | Warning | No | \* Escalated to Error in `Recommended` and `All` modes. @@ -94,6 +98,8 @@ Ensure your test classes, methods, and fixtures follow MSTest requirements: - **[MSTEST0063](mstest0063.md)**: Test class constructor validation. - **[MSTEST0069](mstest0069.md)**: Apply [TestClass] directly so source-generated discovery finds the class. - **[MSTEST0082](mstest0082.md)**: Keep base and derived test classes on the same MSTest major version. +- **[MSTEST0085](mstest0085.md)**: Remove `[TestClass]` from abstract base classes. +- **[MSTEST0086](mstest0086.md)**: Remove method attributes whose behavior the test class already supplies. ### Lifecycle methods @@ -120,6 +126,7 @@ Ensure data attributes are used correctly: - **[MSTEST0042](mstest0042.md)**: Detect duplicate DataRows. - **[MSTEST0052](mstest0052.md)**: Use AutoDetect for DynamicDataSourceType. - **[MSTEST0062](mstest0062.md)**: Avoid out/ref parameters. +- **[MSTEST0087](mstest0087.md)**: Give every explicit `DataRow` display name a unique value. ### Writing better assertions @@ -187,6 +194,7 @@ Rules for tests that run in parallel: - **[MSTEST0081](mstest0081.md)**: Validate test filter provider registrations. - **[MSTEST0082](mstest0082.md)**: Detect inherited tests and lifecycle methods compiled against another MSTest major version. - **[MSTEST0083](mstest0083.md)**: Use `ExecutableCondition` instead of an imperative executable check. +- **[MSTEST0084](mstest0084.md)**: Align platform compatibility attributes with `OSCondition`. ## Related documentation diff --git a/docs/core/testing/snippets/unit-testing-mstest-ui-automation/csharp/UIAutomationExample/MyAppTests.cs b/docs/core/testing/snippets/unit-testing-mstest-ui-automation/csharp/UIAutomationExample/MyAppTests.cs new file mode 100644 index 0000000000000..79d3eb73364ae --- /dev/null +++ b/docs/core/testing/snippets/unit-testing-mstest-ui-automation/csharp/UIAutomationExample/MyAppTests.cs @@ -0,0 +1,12 @@ +// +using System.Diagnostics; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using Microsoft.VisualStudio.TestTools.UnitTesting.Windows.UIAutomation; + +[STATestClass] +public sealed class MyAppTests : WindowTest +{ + protected override ProcessStartInfo CreateProcessStartInfo() + => new(@"C:\MyApp\MyApp.exe"); +} +// diff --git a/docs/core/testing/snippets/unit-testing-mstest-ui-automation/csharp/UIAutomationExample/UIAutomationExample.csproj b/docs/core/testing/snippets/unit-testing-mstest-ui-automation/csharp/UIAutomationExample/UIAutomationExample.csproj new file mode 100644 index 0000000000000..35df0fb7b8a0a --- /dev/null +++ b/docs/core/testing/snippets/unit-testing-mstest-ui-automation/csharp/UIAutomationExample/UIAutomationExample.csproj @@ -0,0 +1,22 @@ + + + + net10.0-windows + enable + + + + + + + + + + + + + + + + + diff --git a/docs/core/testing/snippets/unit-testing-mstest-ui-automation/csharp/UIAutomationExample/WindowTestStub.cs b/docs/core/testing/snippets/unit-testing-mstest-ui-automation/csharp/UIAutomationExample/WindowTestStub.cs new file mode 100644 index 0000000000000..1466ab4b8638e --- /dev/null +++ b/docs/core/testing/snippets/unit-testing-mstest-ui-automation/csharp/UIAutomationExample/WindowTestStub.cs @@ -0,0 +1,9 @@ +using System.Diagnostics; + +namespace Microsoft.VisualStudio.TestTools.UnitTesting.Windows.UIAutomation; + +// Build-only fallback until the MSTest 4.5 preview packages are publicly available. +public abstract class WindowTest +{ + protected abstract ProcessStartInfo CreateProcessStartInfo(); +} diff --git a/docs/core/testing/snippets/unit-testing-mstest-ui-automation/vb/UIAutomationExample/MyAppTests.vb b/docs/core/testing/snippets/unit-testing-mstest-ui-automation/vb/UIAutomationExample/MyAppTests.vb new file mode 100644 index 0000000000000..8b5e48983bbbf --- /dev/null +++ b/docs/core/testing/snippets/unit-testing-mstest-ui-automation/vb/UIAutomationExample/MyAppTests.vb @@ -0,0 +1,14 @@ +' +Imports System.Diagnostics +Imports Microsoft.VisualStudio.TestTools.UnitTesting +Imports Microsoft.VisualStudio.TestTools.UnitTesting.Windows.UIAutomation + + +Public NotInheritable Class MyAppTests + Inherits WindowTest + + Protected Overrides Function CreateProcessStartInfo() As ProcessStartInfo + Return New ProcessStartInfo("C:\MyApp\MyApp.exe") + End Function +End Class +' diff --git a/docs/core/testing/snippets/unit-testing-mstest-ui-automation/vb/UIAutomationExample/UIAutomationExample.vbproj b/docs/core/testing/snippets/unit-testing-mstest-ui-automation/vb/UIAutomationExample/UIAutomationExample.vbproj new file mode 100644 index 0000000000000..08d4d3ca14ca6 --- /dev/null +++ b/docs/core/testing/snippets/unit-testing-mstest-ui-automation/vb/UIAutomationExample/UIAutomationExample.vbproj @@ -0,0 +1,22 @@ + + + + UIAutomationExample + net10.0-windows + + + + + + + + + + + + + + + + + diff --git a/docs/core/testing/snippets/unit-testing-mstest-ui-automation/vb/UIAutomationExample/WindowTestStub.vb b/docs/core/testing/snippets/unit-testing-mstest-ui-automation/vb/UIAutomationExample/WindowTestStub.vb new file mode 100644 index 0000000000000..a99a6cf3cdb24 --- /dev/null +++ b/docs/core/testing/snippets/unit-testing-mstest-ui-automation/vb/UIAutomationExample/WindowTestStub.vb @@ -0,0 +1,12 @@ +Imports System.Diagnostics + +Namespace Global.Microsoft.VisualStudio.TestTools.UnitTesting.Windows.UIAutomation + + ' Build-only fallback until the MSTest 4.5 preview packages are publicly available. + Public MustInherit Class WindowTest + + Protected MustOverride Function CreateProcessStartInfo() As ProcessStartInfo + + End Class + +End Namespace diff --git a/docs/core/testing/unit-testing-mstest-configure.md b/docs/core/testing/unit-testing-mstest-configure.md index b90f69e0197a8..637f527691b3a 100644 --- a/docs/core/testing/unit-testing-mstest-configure.md +++ b/docs/core/testing/unit-testing-mstest-configure.md @@ -3,7 +3,7 @@ title: Configure MSTest description: Learn how to configure MSTest. author: Evangelink ms.author: amauryleve -ms.date: 09/14/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -32,7 +32,8 @@ The following runsettings entries let you configure how MSTest behaves. |`AssemblyCleanupTimeout`|None|Specify globally the timeout to apply on each instance of assembly cleanup method. `[Timeout]` attribute specified on the assembly cleanup method overrides the global timeout.| |`AssemblyInitializeTimeout`|None|Specify globally the timeout to apply on each instance of assembly initialize method. `[Timeout]` attribute specified on the assembly initialize method overrides the global timeout.| |`AssemblyResolution`|false|You can specify paths to extra assemblies when finding and running unit tests. For example, use these paths for dependency assemblies that aren't in the same directory as the test assembly. To specify a path, use a **Directory Path** element. Paths can include environment variables.

` `

This feature is only applied when using a .NET Framework target.| -|`CaptureTraceOutput`|`Result`|Capture text from the `Console.Write*` and `Trace.Write*` APIs and associate it with the current test. On .NET Framework, capture also includes `Debug.Write*` through shared trace listeners. Modern .NET doesn't route `Debug.Write*` through those listeners, so MSTest doesn't capture it. Starting with the MSTest 4.4 preview, use `None`, `Result`, or `Live`. `Live` also echoes `Console`, `Trace`, and `TestContext.Write*` output while the test runs. The earlier Boolean values remain supported: `true` maps to `Result`, and `false` maps to `None`.| +|`CaptureAssertionFailureDiagnostics`|false|Starting with MSTest 4.5 preview, capture bounded JSON diagnostics when an MSTest assertion fails. The artifacts include assertion values, source frames, concurrently active tests, and process state. MSTest attaches up to three captures per test attempt to an unsuccessful result and deletes captures for a passing result. UWP, WinUI, Native AOT, and other environments without dynamic code don't support this setting.| +|`CaptureTraceOutput`|`Result`|Capture text from the `Console.Write*` and `Trace.Write*` APIs and associate it with the current test. On .NET Framework, capture also includes `Debug.Write*` through shared trace listeners. Modern .NET doesn't route `Debug.Write*` through those listeners, so MSTest doesn't capture it. Starting with MSTest 4.4, use `None`, `Result`, or `Live`. `Live` also echoes `Console`, `Trace`, and `TestContext.Write*` output while the test runs. The earlier Boolean values remain supported: `true` maps to `Result`, and `false` maps to `None`.| |`ClassCleanupLifecycle`|EndOfClass|If you want the class cleanup to occur at the end of assembly, set it to `EndOfAssembly`. (No longer supported starting from MSTest v4 as `EndOfClass` is the default and only [ClassCleanup]() behavior)| |`ClassCleanupTimeout`|None|Specify globally the timeout to apply on each instance of class cleanup method. `[Timeout]` attribute specified on the class cleanup method overrides the global timeout.| |`ClassInitializeTimeout`|None|Specify globally the timeout to apply on each instance of class initialize method. `[Timeout]` attribute specified on the class initialize method overrides the global timeout.| @@ -182,7 +183,7 @@ All the settings in this section belong to the `output` element. | Entry | Default | Description | |-------|---------|-------------| -| captureTrace | `Result` | Capture `Console` and `Trace` output and associate it with the current test. On .NET Framework, capture also includes `Debug` output through shared trace listeners. Modern .NET `Debug.Write*` output isn't captured. Starting with the MSTest 4.4 preview, use `None`, `Result`, or `Live`. `Live` also echoes output, including `TestContext.Write*` messages, while the test runs. The Boolean values remain supported: `true` maps to `Result`, and `false` maps to `None`. | +| captureTrace | `Result` | Capture `Console` and `Trace` output and associate it with the current test. On .NET Framework, capture also includes `Debug` output through shared trace listeners. Modern .NET `Debug.Write*` output isn't captured. Starting with MSTest 4.4, use `None`, `Result`, or `Live`. `Live` also echoes output, including `TestContext.Write*` messages, while the test runs. The Boolean values remain supported: `true` maps to `Result`, and `false` maps to `None`. | Example: @@ -230,6 +231,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**. | +| captureAssertionFailureDiagnostics | false | Starting with MSTest 4.5 preview, capture up to three JSON assertion-failure diagnostic artifacts per test attempt. The setting maps to `CaptureAssertionFailureDiagnostics` in *.runsettings*. | | dependencies | | Starting with MSTest 4.4, declare test dependency `chains` and `nodes`. This setting is available only with Microsoft.Testing.Platform. For more information, see [Test dependencies](unit-testing-mstest-writing-tests-controlling-execution.md#test-dependencies). | | 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. | @@ -257,6 +259,11 @@ Example: } ``` +The generated files use names such as `mstest-assertion-failure-state-attempt-1-invocation-1-capture-1.json`. Diagnostics are best effort and never replace or hide the original assertion failure. + +> [!IMPORTANT] +> Assertion-failure diagnostic artifacts can contain source file paths, test names, assertion values, and process metadata. If you publish these files as CI artifacts, restrict access to them and use the shortest retention period that meets your needs. + #### `timeout` settings All the settings in this section belong to the `timeout` element. diff --git a/docs/core/testing/unit-testing-mstest-intro.md b/docs/core/testing/unit-testing-mstest-intro.md index 6f5d70eb86af8..72ece5dcf4d82 100644 --- a/docs/core/testing/unit-testing-mstest-intro.md +++ b/docs/core/testing/unit-testing-mstest-intro.md @@ -3,7 +3,7 @@ title: MSTest overview description: Learn about MSTest, Microsoft's testing framework for .NET, including supported platforms, key features, and getting started. author: Evangelink ms.author: amauryleve -ms.date: 09/30/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -34,6 +34,7 @@ MSTest supports a wide range of .NET platforms and target frameworks. The follow | **.NET Framework** | 4.6.2+ | Full parallelization | All attributes | Full feature support | | **UWP** | UAP 10, .NET 10+ with UWP tooling | UI thread | `UITestMethod` | MSTest 4.5 and MTP 2.5 support classic and modern UWP through the MSTest.Sdk app-model sidecar | | **WinUI 3** | .NET 8+ | UI thread | `UITestMethod` | MTP supports packaged, unpackaged, and AppContainer hosts; see [Test UWP and WinUI 3 apps with MSTest and MTP](unit-testing-mstest-winui.md) | +| **Windows desktop UI automation** | .NET 8+ Windows target | STA | `STATestClass` | MSTest 4.5 preview can launch unpackaged Win32, Windows Forms, and WPF apps and expose a window through Windows UI Automation | | **Native AOT** | .NET 8+ | Full parallelization | Most attributes | Limited feature set; see [Native AOT sample](https://github.com/microsoft/testfx/tree/main/samples/public/mstest-runner/NativeAotRunner) | | **Browser WebAssembly** | .NET 10+ custom host | Single-threaded | Limited | MTP execution support starts with MSTest 4.4 | | **WASI WebAssembly** | .NET 10+ custom host | Single-threaded | Limited | MTP execution support starts with MSTest 4.4 | @@ -84,6 +85,10 @@ MTP supports packaged full-trust, unpackaged, and AppContainer-configured WinUI AppContainer support requires MSTest 4.5 and MTP 2.5 or later. VSTest doesn't support unpackaged WinUI 3. For setup details, see [Test UWP and WinUI 3 apps with MSTest and MTP](unit-testing-mstest-winui.md). +#### Windows desktop UI automation + +The `MSTest.Windows.UIAutomation` package integrates MSTest lifecycle management with Windows UI Automation for unpackaged Win32, Windows Forms, and WPF applications. For setup, limitations, and the `ApplicationTest` and `WindowTest` base classes, see [Test Windows desktop apps with MSTest UI Automation](unit-testing-mstest-ui-automation.md). + #### Native AOT Native AOT compilation is supported with some limitations due to reduced reflection capabilities. Use source generators where possible and test your AOT scenarios with the [NativeAotRunner sample](https://github.com/microsoft/testfx/tree/main/samples/public/mstest-runner/NativeAotRunner). @@ -127,7 +132,7 @@ MSTest has undergone significant evolution across major versions: - **MSTest v4**: Current version with enhanced features > [!NOTE] -> MSTest 4.5 is under development as of September 2026. Features marked as introduced in MSTest 4.5 require a preview build until version 4.5.0 is released. +> MSTest 4.5 is under development as of October 2026. Features marked as introduced in MSTest 4.5 require a preview build until version 4.5.0 is released. For details on all releases, see the [MSTest changelog](https://github.com/microsoft/testfx/blob/main/docs/Changelog.md). @@ -146,5 +151,6 @@ The MSTest team carefully reviews and minimizes breaking changes. When breaking - [Write tests](unit-testing-mstest-writing-tests.md) - [Run tests](unit-testing-mstest-running-tests.md) - [Test UWP and WinUI 3 apps](unit-testing-mstest-winui.md) +- [Test Windows desktop apps with MSTest UI Automation](unit-testing-mstest-ui-automation.md) - [Configure MSTest](unit-testing-mstest-configure.md) - [MSTest code analyzers](mstest-analyzers/overview.md) diff --git a/docs/core/testing/unit-testing-mstest-running-tests.md b/docs/core/testing/unit-testing-mstest-running-tests.md index 4f0141fed9d88..26cc76cf211f7 100644 --- a/docs/core/testing/unit-testing-mstest-running-tests.md +++ b/docs/core/testing/unit-testing-mstest-running-tests.md @@ -3,7 +3,7 @@ title: Run tests with MSTest description: Learn about how to run MSTest tests using VSTest or Microsoft.Testing.Platform (MTP). author: Evangelink ms.author: amauryleve -ms.date: 09/12/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -158,5 +158,6 @@ Contoso.MyTests.exe --filter "FullyQualifiedName~UnitTest1|TestCategory=Category - [`dotnet test` with VSTest](../tools/dotnet-test-vstest.md) - [MTP CLI options reference](microsoft-testing-platform-cli-options.md) - [Test UWP and WinUI 3 apps with MSTest and MTP](unit-testing-mstest-winui.md) +- [Test Windows desktop apps with MSTest UI Automation](unit-testing-mstest-ui-automation.md) - [Filter tests](selective-unit-tests.md) - [Order unit tests](order-unit-tests.md) diff --git a/docs/core/testing/unit-testing-mstest-sdk.md b/docs/core/testing/unit-testing-mstest-sdk.md index 39cf5efeb92c9..e428369b7bfb6 100644 --- a/docs/core/testing/unit-testing-mstest-sdk.md +++ b/docs/core/testing/unit-testing-mstest-sdk.md @@ -3,7 +3,7 @@ title: MSTest SDK configuration author: MarcoRossignoli description: Learn how to configure MSTest.Sdk profiles, extensions, and advanced features. ms.author: mrossignoli -ms.date: 09/30/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -40,6 +40,8 @@ UWP projects still require the Visual Studio UWP workload and desktop MSBuild fo For project configuration, run commands, and samples, see [Test UWP and WinUI 3 apps with MSTest and MTP](unit-testing-mstest-winui.md). +Starting with MSTest.Sdk 4.5 preview, set `EnableWindowsUIAutomation` to `true` to add the matching `MSTest.Windows.UIAutomation` package to a Windows-targeted project. This feature launches and automates an external unpackaged Win32, Windows Forms, or WPF application rather than hosting tests inside a UWP or WinUI app. For details, see [Test Windows desktop apps with MSTest UI Automation](unit-testing-mstest-ui-automation.md). + ## Extend MTP You can customize the MTP experience through a set of [NuGet package extensions](./microsoft-testing-platform-features.md). To simplify and improve this experience, MSTest SDK introduces two features: @@ -47,6 +49,8 @@ You can customize the MTP experience through a set of [NuGet package extensions] - [Microsoft.Testing.Platform profile](#microsofttestingplatform-profile) - [Enable or disable extensions](#enable-or-disable-extensions) +Starting with MSTest 4.4, the MSTest adapter uses its native MTP integration and no longer depends on `Microsoft.Testing.Extensions.VSTestBridge`. Reference the bridge explicitly only when the MTP test application must run a framework through its VSTest adapter. + ### Microsoft.Testing.Platform profile The concept of *profiles* allows you to select the default set of configurations and extensions that will be applied to your test project. @@ -62,7 +66,7 @@ You can set the profile using the property `TestingExtensionsProfile` with one o * [Code Coverage](./microsoft-testing-platform-code-coverage.md#microsoft-code-coverage) * [Trx Report](./microsoft-testing-platform-test-reports.md#visual-studio-test-reports-trx) * [Azure DevOps Report](./microsoft-testing-platform-test-reports.md#azure-devops-reports) (MSTest.Sdk 4.3.0+) - * [GitHub Actions Report](./microsoft-testing-platform-test-reports.md#github-actions-reports) (experimental and prerelease, MSTest.Sdk 4.3.0+) + * [GitHub Actions Report](./microsoft-testing-platform-test-reports.md#github-actions-reports) (MSTest.Sdk 4.3.0+; the package was prerelease in 4.3.x and follows the MTP release version starting in 4.4) * `AllMicrosoft` - Enables the Microsoft extensions selected for broad out-of-the-box use, including extensions with a restrictive license. Experimental and API-only extensions can still require explicit opt-in. diff --git a/docs/core/testing/unit-testing-mstest-ui-automation.md b/docs/core/testing/unit-testing-mstest-ui-automation.md new file mode 100644 index 0000000000000..fe00717f27985 --- /dev/null +++ b/docs/core/testing/unit-testing-mstest-ui-automation.md @@ -0,0 +1,76 @@ +--- +title: Test Windows desktop apps with MSTest UI Automation +description: Learn how to launch and test unpackaged Win32, Windows Forms, and WPF applications with MSTest.Windows.UIAutomation. +author: Evangelink +ms.author: amauryleve +ms.date: 10/01/2026 +dev_langs: + - "csharp" + - "vb" +ai-usage: ai-generated +--- + +# Test Windows desktop apps with MSTest UI Automation + +The preview [`MSTest.Windows.UIAutomation`](https://github.com/microsoft/testfx/tree/main/src/TestFramework/TestFramework.Windows.UIAutomation) package integrates MSTest lifecycle management with the built-in Windows UI Automation API. Use it to launch an unpackaged full-trust desktop application, find one of its windows as an , and stop the application after each test. + +The package supports Win32, Windows Forms, and WPF applications in an interactive Windows session. It doesn't provide MSIX, UWP, or WinUI activation, elevated-process automation, a headless desktop, locators, automatic waits, screenshots, or a multi-window object model. + +> [!IMPORTANT] +> This feature requires MSTest 4.5 preview packages and a Windows-specific target framework. + +## Enable Windows UI Automation + +With MSTest.Sdk, set `EnableWindowsUIAutomation` to `true`: + +```xml + + + net8.0-windows + true + + +``` + +MSTest.Sdk adds the matching `MSTest.Windows.UIAutomation` package. Without MSTest.Sdk, reference `MSTest.Windows.UIAutomation`, `MSTest.TestFramework`, and `MSTest.TestAdapter` at matching MSTest versions. Reference a compatible `Microsoft.NET.Test.Sdk` version separately because it follows the VSTest version line. + +For a Windows-targeted project that restores or builds on Linux or macOS, set `EnableWindowsTargeting` to `true`. + +## Choose a base class + +Derive from one of these classes: + +- `ApplicationTest` starts the application before each test and stops it during disposal. Override `CreateProcessStartInfo` to identify the executable. +- `WindowTest` also waits for a window and exposes it through `MainWindow`. + +Declare `STATestClass` directly on every concrete test class because MSTest test-class attributes aren't inherited: + +:::code language="csharp" source="./snippets/unit-testing-mstest-ui-automation/csharp/UIAutomationExample/MyAppTests.cs" id="WindowTestClass"::: + +:::code language="vb" source="./snippets/unit-testing-mstest-ui-automation/vb/UIAutomationExample/MyAppTests.vb" id="WindowTestClass"::: + +Use `MainWindow` in your test methods to query or invoke Windows UI Automation patterns. The package uses the UIA2 `System.Windows.Automation` API. You can layer another library, such as FlaUI, over the exposed `AutomationElement` when you need richer element interaction. + +## Customize startup and window discovery + +Override these members when the defaults don't fit your application: + +- `ApplicationShutdownTimeout` controls how long the base class waits for graceful shutdown and forced termination. The default is five seconds. +- `WindowDiscoveryTimeout` controls how long `WindowTest` waits for a window. The default is 10 seconds. +- `FindWindow` selects a window for applications that use a launcher process, show a splash screen, or create multiple top-level windows. +- `StopApplication` shuts down an application when the selected window belongs to a process other than the process that `CreateProcessStartInfo` launched. + +The base classes observe `TestContext.CancellationToken` during startup and window discovery. `WindowTest` fails when the application exits before a window appears or when discovery reaches its timeout. + +## Understand lifecycle behavior + +`ApplicationTest` starts one application process for each test invocation. `WindowTest` discovers the window after the process starts. After the test and its cleanup methods finish, MSTest disposes the base class, requests a graceful close through the main window, and terminates the process tree if the application doesn't exit within the configured timeout. + +For parameterized tests and retries, each invocation receives its own application lifecycle. + +## See also + +- [MSTest overview](unit-testing-mstest-intro.md) +- [Test execution and control](unit-testing-mstest-writing-tests-controlling-execution.md) +- [Test UWP and WinUI 3 apps with MSTest and MTP](unit-testing-mstest-winui.md) +- [Windows UI Automation overview](/dotnet/framework/ui-automation/ui-automation-overview) 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 b33e296ebbeec..5d62b76ba6636 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: 09/02/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -151,16 +151,13 @@ MSTest 4.3 also adds: - Complete exception details, including stack traces and inner exceptions, in `Assert.Throws*` failure messages. - Assertion failure stacks that hide MSTest implementation frames and render built-in numeric values at full precision. -> [!IMPORTANT] -> The following assertion overloads are planned for MSTest 4.4 and are available only in preview builds until MSTest 4.4.0 is released. - MSTest 4.4 adds span and memory overloads to `Assert.IsEmpty`, `Assert.IsNotEmpty`, and the remaining collection APIs. The overloads accept , , , and : - All-item checks: `AreAllDistinct`, `AreAllNotNull`, and `AreAllOfType`. - Comparisons: `AreEquivalent`, `AreNotEquivalent`, `AreSequenceEqual`, and `AreNotSequenceEqual`. - Containment: `Contains`, `ContainsAll`, `ContainsSingle`, `DoesNotContain`, and `DoesNotContainAll`. -With the MSTest 4.4 and MTP 2.4 previews, capable IDEs and reporters receive assertion expected and actual values as separate structured properties. Consumers don't need to parse these values from the failure message. +With MSTest 4.4 and MTP 2.4, capable IDEs and reporters receive assertion expected and actual values as separate structured properties. Consumers don't need to parse these values from the failure message. `Assert.AddValueFormatter` returns an registration. Dispose the registration to remove the formatter. The formatter applies only to the current asynchronous context, so parallel tests can use different formatters without changing each other's output. Because the API is experimental in MSTest 4.3, acknowledge or suppress the `MSTESTEXP` diagnostic before you use it. 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 a97eb326c1b23..81ee6511eb2a0 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,7 @@ 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: 09/14/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -214,9 +214,6 @@ public class MixedTests ### `ResourceLockAttribute` -> [!IMPORTANT] -> `ResourceLockAttribute` is planned for MSTest 4.4 and is available only in preview builds until MSTest 4.4.0 is released. - Use `[ResourceLock]` to serialize only tests that access the same named resource. Unlike `[DoNotParallelize]`, a resource lock doesn't block tests that use unrelated resources. The default `ReadWrite` mode is exclusive, while multiple tests that request `ResourceAccessMode.Read` for the same resource can run together. ```csharp @@ -242,9 +239,6 @@ If a test also uses `[DoNotParallelize]`, `[DoNotParallelize]` takes precedence ## Test dependencies -> [!IMPORTANT] -> Test dependencies are planned for MSTest 4.4 and are available only in preview builds until MSTest 4.4.0 is released. - Use `[DependsOn]` for integration or end-to-end tests that must run after other tests. Dependencies form a directed acyclic graph, so independent branches can still run in parallel. ```csharp @@ -455,7 +449,7 @@ Starting with MSTest 3.8, create custom retry logic by inheriting from [!IMPORTANT] > The `RetryBaseAttribute.ExecuteAsync` API, and its `RetryContext` and `RetryResult` types, are experimental. Using them produces the `MSTESTEXP` diagnostic, which you must acknowledge before you use the API. -Starting with the MSTest 4.4 preview, `RetryResult.AllResults` exposes the result arrays from every attempt in the order they were added. MTP reports earlier attempts as superseded, while VSTest receives only the final result. MSTest retries only when an attempt contains a failed or timed-out result. An inconclusive result by itself stops the retry sequence. +Starting with MSTest 4.4, `RetryResult.AllResults` exposes the result arrays from every attempt in the order they were added. MTP reports earlier attempts as superseded, while VSTest receives only the final result. MSTest retries only when an attempt contains a failed or timed-out result. An inconclusive result by itself stops the retry sequence. Process-level `--retry-failed-tests` and an MSTest retry attribute apply at different levels. Their effects are multiplicative because each process-level attempt can run the attribute's complete retry sequence. 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 8f3d606c1419c..25be121356896 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 DataRow, DynamicData, CombinatorialData, and TestD author: Evangelink ms.author: amauryleve ai-usage: ai-assisted -ms.date: 09/02/2026 +ms.date: 10/01/2026 --- # Data-driven testing in MSTest @@ -27,8 +27,8 @@ MSTest also provides the following types to extend data-driven scenarios: - [`TestDataRow`](#testdatarow): A return type for `ITestDataSource` implementations (including `DynamicData`) that adds metadata support such as display names, categories, and ignore messages to individual test cases. - [`ITestDataSource`](#itestdatasource): An interface you can implement on a custom attribute to create fully custom data source attributes. -> [!IMPORTANT] -> Built-in combinatorial testing is planned for MSTest 4.4 and is available only in preview builds until MSTest 4.4.0 is released. For earlier MSTest versions, use the community-maintained [Combinatorial.MSTest](https://www.nuget.org/packages/Combinatorial.MSTest) package. +> [!NOTE] +> Built-in combinatorial testing is available starting with MSTest 4.4. For earlier MSTest versions, use the community-maintained [Combinatorial.MSTest](https://www.nuget.org/packages/Combinatorial.MSTest) package. ## `DataRowAttribute` @@ -178,7 +178,7 @@ public class IgnoreDataRowExample ## `CombinatorialDataAttribute` -In MSTest 4.4 preview builds, the `CombinatorialData` attribute generates the Cartesian product of the values for each test method parameter. Use the types in the `Microsoft.VisualStudio.TestTools.UnitTesting.Combinatorial` namespace. +Starting with MSTest 4.4, the `CombinatorialData` attribute generates the Cartesian product of the values for each test method parameter. Use the types in the `Microsoft.VisualStudio.TestTools.UnitTesting.Combinatorial` namespace. Provide values for each parameter with one of the following options: @@ -198,6 +198,9 @@ Apply no more than one combinatorial value provider to each parameter. For a par `CombinatorialData` creates an exhaustive Cartesian product. It doesn't support pairwise generation, permutations, exclusions between parameter values, member-backed values, or class data. Use `DynamicData` or a custom `ITestDataSource` when values depend on each other or when you need to filter the generated test cases. +> [!NOTE] +> Starting with MSTest 4.5 preview, automatically generated data-driven display names escape control characters and unpaired surrogate characters. Valid surrogate pairs remain unchanged, and literal escape-sequence text stays distinct from the control character that it represents. + ## `DynamicDataAttribute` The lets you provide test data from methods, properties, or fields. Use this attribute when test data is complex, computed dynamically, or too verbose for inline `DataRow` attributes. 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 42fb9785636e1..e6193f22012c9 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,7 @@ 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: 08/06/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -242,6 +242,33 @@ public class GlobalTestLifecycleExample Test-level lifecycle runs for every test method. For parameterized tests, the lifecycle runs for each data row. +### Create test classes from host services + +Starting with MSTest 4.5 preview, the experimental [`MSTest.Extensions.Hosting`](https://github.com/microsoft/testfx/tree/main/src/Adapter/MSTest.Extensions.Hosting) package lets an application-owned `Microsoft.Extensions.Hosting` container create MSTest test classes. + +Register the integration in the same host that runs MTP: + +```csharp +HostApplicationBuilder builder = Host.CreateApplicationBuilder(); +builder.Services.AddSingleton(); +builder.Services.AddMSTestTestClassInjection(); +``` + +A test class can request registered services and an optional exact `TestContext` parameter through a public constructor: + +```csharp +[TestClass] +public sealed class MyTests(MyApplicationService service, TestContext testContext) +{ + [TestMethod] + public void ServiceIsAvailable() => Assert.IsNotNull(service); +} +``` + +The integration creates one dependency-injection scope for each test invocation, including each data row and retry attempt. `TestInitialize`, the test method, and `TestCleanup` share the same test-class instance and scope. After cleanup, MSTest disposes the test-class instance and then the scope. The application still owns the host and root service provider. + +This first reflection-based integration doesn't support Native AOT, browser WebAssembly, AOT compilation, or MSTest source generation. The `AddMSTestTestClassInjection` API uses the `MSTESTEXP` diagnostic ID and might change in a future release. For host setup, see [Microsoft.Extensions integration](microsoft-testing-platform-extensions-integration.md#host-integration). + ### Setup phase Use `TestInitialize` or a constructor for per-test setup: 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 709915277b2f7..66b7b6bfd06ea 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,7 @@ title: MSTest TestContext description: Learn about the TestContext class of MSTest. author: Evangelink ms.author: amauryleve -ms.date: 09/02/2026 +ms.date: 10/01/2026 ai-usage: ai-assisted --- @@ -46,9 +46,6 @@ The provides inf ### Per-test temporary directory -> [!IMPORTANT] -> `TestContext.TestTempDirectory` is planned for MSTest 4.4 and is available only in preview builds until MSTest 4.4.0 is released. - Use `TestContext.TestTempDirectory` as private scratch space for a test. MSTest creates the directory only when you first access the property, and each test execution receives a unique directory. Each data row also receives its own directory, so parallel tests don't share paths. ```csharp @@ -91,7 +88,7 @@ You can use the `DataSource` attribute to read the data from the CSV file: You can use to store custom key-value pairs that can be accessed across different methods in the same test session. -Starting with the MSTest 4.4 preview, the indexer consistently returns `null` when a custom key doesn't exist. +Starting with MSTest 4.4, the indexer consistently returns `null` when a custom key doesn't exist. ```csharp TestContext.Properties["MyKey"] = "MyValue"; @@ -115,6 +112,8 @@ The or methods to write custom messages directly to the test output. Starting with MSTest 4.4, the `Live` output capture mode echoes these messages while the test runs and still attaches them to the final test result. For more information, see [Configure MSTest output](unit-testing-mstest-configure.md#output-settings). ### Cancellation token diff --git a/docs/navigate/devops-testing/toc.yml b/docs/navigate/devops-testing/toc.yml index c2176d971790f..8054f7ec273da 100644 --- a/docs/navigate/devops-testing/toc.yml +++ b/docs/navigate/devops-testing/toc.yml @@ -78,6 +78,8 @@ items: href: ../../core/testing/unit-testing-mstest-running-tests.md - name: Test UWP and WinUI 3 apps href: ../../core/testing/unit-testing-mstest-winui.md + - name: Test Windows desktop apps with UI Automation + href: ../../core/testing/unit-testing-mstest-ui-automation.md - name: Configure MSTest href: ../../core/testing/unit-testing-mstest-configure.md - name: MSTest SDK @@ -270,6 +272,14 @@ items: href: ../../core/testing/mstest-analyzers/mstest0082.md - name: MSTEST0083 href: ../../core/testing/mstest-analyzers/mstest0083.md + - name: MSTEST0084 + href: ../../core/testing/mstest-analyzers/mstest0084.md + - name: MSTEST0085 + href: ../../core/testing/mstest-analyzers/mstest0085.md + - name: MSTEST0086 + href: ../../core/testing/mstest-analyzers/mstest0086.md + - name: MSTEST0087 + href: ../../core/testing/mstest-analyzers/mstest0087.md - name: Migration items: - name: Migrate from MSTest v1 to v3