Skip to content

Run Azure Test Plans with Microsoft.Testing.Platform - #12686

Merged
Amaury Levé (Evangelink) merged 10 commits into
microsoft:mainfrom
Evangelink:dev/amauryleve/azdo-test-plan-selection
Dec 2, 2026
Merged

Amaury Levé (Evangelink) merged 10 commits into
microsoft:mainfrom
Evangelink:dev/amauryleve/azdo-test-plan-selection

Conversation

@Evangelink

@Evangelink Amaury Levé (Evangelink) commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 7d0e9175457ab8f66026dcba33d6981d7ae8d7bf

Dimension Assessment Rationale
Change confidence 7.5/10 ↑ Packed MSTest and MTP acceptance tests and focused unit tests cover plan selection, retry outcomes and run metadata.
↑ Counterfactuals exposed the reviewed defects.
↑ The Windows and Ubuntu full Bazel matrix passed for this revision, and the registration counterfactual detected a missing filter.
↓ Live hosted stage attribution, real publication-budget expiry, third-party frameworks and the Progress Report discrepancy remain unverified.

Pull request

Summary

Add opt-in Azure Test Plan selection and plan-point result publishing to Microsoft.Testing.Extensions.AzureDevOpsReport. MSTest on MTP uses fully qualified method names; another MTP framework must expose test-node UIDs matching the associated Azure DevOps AutomatedTestName. Data-driven rows aggregate to the worst point outcome. No public .NET API is added.

dotnet test .\MyTests.csproj -- --publish-azdo-test-results --publish-azdo-test-plan <planId> --publish-azdo-test-configuration <configurationId> --publish-azdo-test-suite <suiteId>

The suite option is optional and repeatable; the run name is generated. Selection fails closed, and plan mode rejects --retry-failed-tests and server-mode requests. MSTest's in-process [Retry] is supported: superseded attempts do not affect the final point outcome. Each test module publishes its own plan-linked run; modules without matching points fail, and the latest shared point outcome is not a cross-module aggregate. Plan-linked runs do not upload the standalone publisher's result or coverage attachments. Publishing failures remain warnings and do not change the test exit code. Plan runs use the session start time and include pipeline stage, phase and job references when available; abort cleanup has its own bounded token.

Relates to #4477; follows the feasibility work in #12678.

Design and decision record

Azure Test Plan research and decisions records the API and lifecycle contract, alternatives, experiments, package provenance, and remaining rollout/servicing decisions.

Demonstration

A private Azure Pipelines DotNetCoreCLI@2 job used SDK 10.0.404, an MSTest net10.0 consumer, and the packed extension. The selected run passed three rows and excluded an intentionally failing unassociated test. REST readback verified two correctly associated Passed points. With a planned test intentionally failed, the process exited 2 with two passed and one failed; the plan run contained the matching Passed and Failed points. A final run using the then-current package passed and restored both points. The executed extension DLL SHA-256 was F48BDF427DCA2ED30DB244D737EC00A486DB097E05BF48F0FC4112424050DD35.

The live Test Plans Execute view and failed-run summary were also inspected at 1280×720 using a local packed consumer; point identities and outcomes matched. A redacted transcript is used instead of screenshots containing private playground information. The earlier Progress Report discrepancy remains unresolved; real xUnit/NUnit consumers have not been verified. This live demonstration predates the review fixes; their stage attribution has not been verified in the hosted UI.

Validation and regression proof

  • .\eng\build.ps1 -installWindowsSdk -restore -build -pack -c Release -msbuildMultiThreaded:$false -bl — passed, 0 warnings/errors, with the repository-pinned SDK, before the review fixes.

  • .\build.cmd -pack -c Release -projects 'src\MTP\Microsoft.Testing.Extensions.AzureDevOpsReport\Microsoft.Testing.Extensions.AzureDevOpsReport.csproj' -bl — passed before the review fixes. Then-current package SHA-256: A96D54E97C6F50334A02A6147F4CCE23D0A1FF116B2F6B13F60E081992BB8C8E.

  • .\.dotnet\dotnet.exe run --project test\UnitTests\Microsoft.Testing.Extensions.UnitTests\Microsoft.Testing.Extensions.UnitTests.csproj -c Release -f net10.0 -p:NetCurrent=net10.0 --no-build --no-restore -- --filter 'FullyQualifiedName~AzureDevOpsTestPlanTests' — exit 0; 34 passed, 0 failed/skipped.

  • .\.dotnet\dotnet.exe run --project test\IntegrationTests\Microsoft.Testing.Platform.Acceptance.IntegrationTests\Microsoft.Testing.Platform.Acceptance.IntegrationTests.csproj -c Release -f net10.0 -p:NetCurrent=net10.0 --no-build --no-restore -- --filter 'FullyQualifiedName~AzureDevOpsLivePublishingTests.TestPlanSelection_' --report-trx --results-directory $results --report-trx-filename FinalDelivery.trx — exit 0; 5 passed, 0 failed/skipped. $results was a fresh directory with TESTFX_COLLECTION_NUGET_CACHE set to its marked package cache; the restored package hash matched the then-current package. Cases cover MSTest outcomes, no matching points, custom-MTP UID mapping, and cancellation.

  • Native live-service cancellation exited 3 and produced an Aborted run with one Passed and one NotExecuted point. A concurrent two-TFM run exited 2 with 5 passed and 1 failed across two independently verified plan runs. These are local live-service results, not the hosted CI status of this PR.

  • At c9cc5fc021932e0660778377a1661b7f54f697d6, with fresh Release packages and a fresh marked TESTFX_COLLECTION_NUGET_CACHE: .\.dotnet\dotnet.exe artifacts\bin\MSTest.Acceptance.IntegrationTests\Release\net12.0\MSTest.Acceptance.IntegrationTests.dll --filter "FullyQualifiedName~AzureDevOpsTestPlanTests" — exit 0; 2 passed, 0 failed/skipped. The same run of Microsoft.Testing.Platform.Acceptance.IntegrationTests.dll --filter "FullyQualifiedName~AzureDevOpsLivePublishingTests" — exit 0; 13 passed.

  • Review fixes at 33f57dd813ff100c7797244b87e49dd52cfa9760: the focused unit filter passed 60 cases on both net10.0 and net11.0; packed net12.0 acceptance ran 3 MSTest and 13 MTP cases successfully. The Release AzureDevOpsReport package and fresh-cache copies matched SHA-256 7DBA384FF63585066608AE8E4A3D57C1FBCA4FCFF39C2F4D02C28E7FF121A5C5. Exact commands and results are in the linked decision record. The timeout test verifies independent cancellation tokens, not a real five-minute expiry.

  • Bazel fixture fix at 7d0e9175457ab8f66026dcba33d6981d7ae8d7bf: pwsh -NoLogo -NoProfile -File .\eng\bazel.ps1 test //:extension_tests --nocache_test_results --test_output=errors --jobs=4 --noshow_progress --downloader_config=artifacts\bazel-downloader-33f.cfg on Windows exited 0; TRX reported 4,132 total, 4,106 passed, 0 failed and 26 skipped. All four Azure DevOps direct/hook and normal/Test Plan registration cases passed. The temporary downloader configuration rewrote the inaccessible NuGet index to the public dotnet-public feed; it was not committed. The Windows and Ubuntu Bazel CI run passed on both platforms.

  • Using the repository SDK, & .\build.cmd -c Release -msbuildEngine dotnet '-warnAsError:$false' -projects $project -bl "/p:TargetFramework=$tfm" and & "$sdk\dotnet.exe" "artifacts\bin\Microsoft.Testing.Extensions.UnitTests\Release\$tfm\Microsoft.Testing.Extensions.UnitTests.dll" --filter 'FullyQualifiedName~CiReporterRegistrationBehaviorTests' ran on both net10.0 and net11.0: 8 passed, 0 failed/skipped on each. $project was test\UnitTests\Microsoft.Testing.Extensions.UnitTests\Microsoft.Testing.Extensions.UnitTests.csproj, and $sdk was the repository-local .dotnet directory. -warnAsError:$false was needed locally because the preview SDK emits unrelated NU1510 package-pruning warnings.

Test-value evidence

At a46034dcd1a8a35aa5aa72a29157ec936d8df64a, the packed MSTest configuration-selection cases passed. In an isolated, separately packed compiling mutation that removed the configuration predicate while retaining the same tests, both cases executed and failed their intended assertion: two names were expected but three were returned. TestPlanSelection_CanceledSessionPublishesPartialResultsAsAborted also failed against the pre-cleanup package because no point results were published, then passed with the correction. Commands, test identities, source states, package/DLL hashes, and the private-artifact limitation are in the decision record. These are executed behavioral comparisons, not build-failure evidence.

At c9cc5fc021932e0660778377a1661b7f54f697d6, the new MSTest AzureDevOpsTestPlanTests were also run against a compiling counterfactual where AggregatedOutcome.Add kept the least severe outcome (only AzureDevOpsReport repacked, fresh cache): TestPlan_RunsOnlyAssociatedMSTestTestsAndPublishesTheirOutcomes failed (exit 2) because point 321 (PlanSample.PlanTests.DataDriven) was published Passed instead of Failed; the suite test, which has no data rows, passed. Reverting and repacking restored 2/2 passing.

For review fixes at 33f57dd813ff100c7797244b87e49dd52cfa9760, the MSTest retry regression failed against the preceding package because point 501 was Failed instead of Passed, then passed with the fix. Its later pipeline assertions were not present in the red run. In a separate compiling counterfactual retaining the unit tests and updated API shape, restoring publication-time timestamps, reusing the abort token and omitting the pipeline reference produced 3 intended assertion failures; all 3 passed with the fixes. Details and exact selectors are in the decision record.

For the Bazel registration fixture, the parent 33f57dd813ff100c7797244b87e49dd52cfa9760 reproduced the two original cases failing with InvalidCastException because the Azure DevOps extension requires a real TestHostManager; the corrected fixture passed them and adds two Test Plan registration cases. In a separate compiling net10.0 comparison retaining the final test patch (SHA-256 17A0307C1E8278E45CB4BF490189D6E8481C4872FBA3BC653B48183E85233B22), removing only the filter registration (patch SHA-256 A3C18E48DF2553144E2E97B6718AA14560D38FA71726008EEEFEB4E5A2D23376) produced 8 executed, 6 passed and 2 failed (exit 2): both Test Plan cases reported Assert.ContainsSingle(filters), expected 1 and actual 0. Restoring the registration produced 8 passed (exit 0). Each variant was rebuilt using & "$sdk\dotnet.exe" build test\UnitTests\Microsoft.Testing.Extensions.UnitTests\Microsoft.Testing.Extensions.UnitTests.csproj --no-restore -f net10.0 -c Release "-bl:$out\<variant>.binlog" -v:q, then run with & "$sdk\dotnet.exe" artifacts\bin\Microsoft.Testing.Extensions.UnitTests\Release\net10.0\Microsoft.Testing.Extensions.UnitTests.dll --filter 'FullyQualifiedName~CiReporterRegistrationBehaviorTests'. Comparison binlogs and the local TRX remain local; they are not published artifacts.

Add a packaged-runner probe for name and UID filter composition, and record the separate playground experiment and its limitations.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…nsion

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 16:06
@github-actions github-actions Bot added the state/needs-review Awaiting review from the team. label Dec 1, 2026
Copilot stopped reviewing on behalf of Amaury Levé (Evangelink) due to an error December 1, 2026 16:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved issues can report successful retries as failures, omit pipeline attribution, record incorrect execution start times, and leave runs InProgress when publication times out.

4 open issues
What changed in this PR

Adds opt-in Azure Test Plans selection and result publishing to the Microsoft.Testing.Platform Azure DevOps extension, building on the feasibility work in #12678 and addressing #4477.

Changes:

  • Adds plan, configuration, and suite options with fail-closed test selection.
  • Publishes aggregated outcomes to plan points, including partial results after cancellation.
  • Adds protocol and packaged-consumer tests, localized resource entries, and usage/design documentation.

Test-value evidence: At reported revision a46034dcd1a8a35aa5aa72a29157ec936d8df64a, the PR documents configuration-filter mutation and cancellation regression comparisons. Execution artifacts are private and were not independently verified; no builds or tests were run during this review.

File Description
test/​UnitTests/​Microsoft.Testing.Extensions.UnitTests/​AzureDevOpsClientBehaviorTests.cs Tests plan API requests and payload mapping.
test/​IntegrationTests/​Microsoft.Testing.Platform.Acceptance.IntegrationTests/​MSBuild.KnownExtensionRegistration.cs Checks plan-option registration.
test/​IntegrationTests/​Microsoft.Testing.Platform.Acceptance.IntegrationTests/​HelpInfoAllExtensionsTests.cs Updates help and info expectations.
test/​IntegrationTests/​Microsoft.Testing.Platform.Acceptance.IntegrationTests/​AzureDevOpsLivePublishingTests.cs Adds packaged selection, publishing, and cancellation cases.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​Resources/​xlf/​AzureDevOpsResources.zh-Hant.xlf Adds Traditional Chinese catalog entries.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​Resources/​xlf/​AzureDevOpsResources.zh-Hans.xlf Adds Simplified Chinese catalog entries.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​Resources/​xlf/​AzureDevOpsResources.tr.xlf Adds Turkish catalog entries.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​Resources/​xlf/​AzureDevOpsResources.ru.xlf Adds Russian catalog entries.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​Resources/​xlf/​AzureDevOpsResources.pt-BR.xlf Adds Brazilian Portuguese catalog entries.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​Resources/​xlf/​AzureDevOpsResources.pl.xlf Adds Polish catalog entries.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​Resources/​xlf/​AzureDevOpsResources.ko.xlf Adds Korean catalog entries.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​Resources/​xlf/​AzureDevOpsResources.ja.xlf Adds Japanese catalog entries.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​Resources/​xlf/​AzureDevOpsResources.it.xlf Adds Italian catalog entries.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​Resources/​xlf/​AzureDevOpsResources.fr.xlf Adds French catalog entries.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​Resources/​xlf/​AzureDevOpsResources.es.xlf Adds Spanish catalog entries.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​Resources/​xlf/​AzureDevOpsResources.de.xlf Adds German catalog entries.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​Resources/​xlf/​AzureDevOpsResources.cs.xlf Adds Czech catalog entries.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​Resources/​AzureDevOpsResources.resx Defines plan-option descriptions and diagnostics.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​PACKAGE.md Documents usage, behavior, and limitations.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​IAzureDevOpsTestPlanClient.cs Defines internal plan operations and models.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​AzureDevOpsTestRunOrchestratorLifetime.cs Disables standalone orchestration in plan mode.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​AzureDevOpsTestResultsPublisher.SessionLifetime.cs Disables standalone publishing in plan mode.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​AzureDevOpsTestResultsClient.Uris.cs Adds plan and paged-result endpoint builders.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​AzureDevOpsTestResultsClient.TestPlans.cs Implements plan queries and result publishing requests.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​AzureDevOpsTestPlanSelectionOptions.cs Parses plan selection options.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​AzureDevOpsTestPlanSelection.cs Resolves matching module and configuration points.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​AzureDevOpsTestPlanPublisher.cs Aggregates outcomes and finalizes plan-linked runs.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​AzureDevOpsTestPlanFilterProvider.cs Applies plan selection as a UID filter.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​AzureDevOpsExtensions.cs Registers shared selection and publishing components.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​AzureDevOpsCommandLineProvider.cs Registers and validates plan options.
src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​AzureDevOpsCommandLineOptions.cs Defines option names.
docs/​decisions/​azdo-test-plan-playground.md Records implementation decisions, validation, and remaining gaps.

Review effort: Balanced

@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 1, 2026
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 1, 2026
@0101

Copy link
Copy Markdown
Member

Please report only the numeric test case IDs in this warning. The test name comes from Azure DevOps metadata, and Azure Pipelines can interpret raw console text as a logging command.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 16:35
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 1, 2026
@0101

Copy link
Copy Markdown
Member

Please report the HTTP status with a fixed message instead of printing raw REST error bodies in Test Plan selection and publishing failures. Azure Pipelines can interpret response text in the console as a logging command.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Plan publishing can misreport successful retried tests as failed, lose pipeline stage/job attribution, and leave runs InProgress because timeout cancellation also prevents aborting them.

4 open issues

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 16:58
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 1, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 1, 2026
@microsoft-github-policy-service microsoft-github-policy-service Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 1, 2026
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The tests cover only single-page responses, leaving continuation-token handling and result binding for runs exceeding 1,000 results unprotected against regressions.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Add paging regression tests for large plans and run results

src/​MTP/​Microsoft.Testing.Extensions.AzureDevOpsReport/​AzureDevOpsTestResultsClient.TestPlans.cs:171

The new plan protocol tests and loopback services return only single-page responses. Removing continuation-token handling here—or stopping run-result reads after the first 1,000 results—would therefore leave those tests green while omitting later suites/tests or preventing result binding for larger plans. Copilot, add handler-based paging regressions: multiple suite/case pages with an escaped continuation token, rejection of a repeated token, and a 1,001-result run. Assert the subsequent request parameters and the complete returned identities/counts.

4 resolved since last review

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 18:03
@github-actions github-actions Bot added state/needs-review Awaiting review from the team. and removed state/needs-review Awaiting review from the team. labels Dec 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human assessment is needed because plan-mode publishing can let a later-finishing shard overwrite another shard’s failed results with NotExecuted.

No open issues 🎉

Review effort: Balanced

@Evangelink
Amaury Levé (Evangelink) merged commit 05f3758 into microsoft:main Dec 2, 2026
22 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/azdo-test-plan-selection branch December 2, 2026 08:53
@github-actions github-actions Bot removed the state/needs-review Awaiting review from the team. label Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants