Repository navigation
Report the Azure DevOps test run URL and send pipelineReference when live publishing - #10331
Conversation
…hing Live publishing already streams results as tests complete, but nothing told users where those results were going, and the build's Tests tab only lists a test run once it is finalized. That combination made a correctly working run look like nothing was happening until the very end (#10191). Real-time Tests tab updates are not reachable through the public Test Management REST API: the documented in-progress view is gated on the VSTest task in a Multi-Agent job, which gets it from DTA-only plumbing and from many short server-collated runs. What is reachable is the run's own page, which does show results as they arrive, so report its URL once when the run is created (from the owning process only, since every other process shares that run id) and state when the Tests tab catches up. Also send pipelineReference and startedDate on run creation. The pipelines agent always sets pipelineReference; without it a run is attributed to the build as a whole and cannot be attributed to the stage and job that produced it in a multi-stage pipeline. pipelineId must equal build.id, and the stage, phase and job parts are omitted when the corresponding pipeline variables are absent. Finally, reword the --publish-azdo-test-results description, which promised publishing "live to the Azure DevOps Tests tab" and was itself a source of the confusion. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e7232d5f-1e25-4737-a40a-f7e3e553fd7f
There was a problem hiding this comment.
Pull request overview
Adds Azure DevOps live-run visibility and stage/job attribution for streamed test results.
Changes:
- Reports the created test-run URL and clarifies Tests-tab timing.
- Sends
startedDateand pipeline stage, phase, and job references. - Updates tests, help text, localization resources, API tracking, and changelog.
Show a summary per file
| File | Description |
|---|---|
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/AzureDevOpsLivePublishingTests.cs |
Tests run URL and pipeline payloads. |
test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs |
Updates help expectations. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/Resources/AzureDevOpsResources.resx |
Adds and revises messages. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/Resources/xlf/AzureDevOpsResources.cs.xlf |
Regenerates Czech localization metadata. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/Resources/xlf/AzureDevOpsResources.de.xlf |
Regenerates German localization metadata. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/Resources/xlf/AzureDevOpsResources.es.xlf |
Regenerates Spanish localization metadata. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/Resources/xlf/AzureDevOpsResources.fr.xlf |
Regenerates French localization metadata. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/Resources/xlf/AzureDevOpsResources.it.xlf |
Regenerates Italian localization metadata. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/Resources/xlf/AzureDevOpsResources.ja.xlf |
Regenerates Japanese localization metadata. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/Resources/xlf/AzureDevOpsResources.ko.xlf |
Regenerates Korean localization metadata. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/Resources/xlf/AzureDevOpsResources.pl.xlf |
Regenerates Polish localization metadata. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/Resources/xlf/AzureDevOpsResources.pt-BR.xlf |
Regenerates Portuguese localization metadata. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/Resources/xlf/AzureDevOpsResources.ru.xlf |
Regenerates Russian localization metadata. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/Resources/xlf/AzureDevOpsResources.tr.xlf |
Regenerates Turkish localization metadata. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/Resources/xlf/AzureDevOpsResources.zh-Hans.xlf |
Regenerates Simplified Chinese metadata. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/Resources/xlf/AzureDevOpsResources.zh-Hant.xlf |
Regenerates Traditional Chinese metadata. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/InternalAPI/InternalAPI.Unshipped.txt |
Tracks new internal API surface. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsTestResultsPublisher.cs |
Emits the live-run URL. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsTestResultsPublisher.Configuration.cs |
Reads pipeline context variables. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsTestResultsClient.cs |
Serializes pipeline reference and start date. |
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsLivePublishingModels.cs |
Defines pipeline-reference models. |
docs/Changelog-Platform.md |
Documents the new behavior. |
Review details
- Files reviewed: 22/22 changed files
- Comments generated: 1
- Review effort level: Medium
DotnetTestPassthroughOutputDevice deliberately discards TextOutputDeviceData, forwarding only session messages, warnings, errors and Azure DevOps command lines over the pipe. Since dotnet test is how this extension usually runs in a pipeline (it is the exact invocation reported in #10191), the run URL never reached the user in the one scenario it was written for. SessionMessageOutputDeviceData is the durable channel for extension messages and renders identically through TerminalOutputDevice, so direct runs are unchanged. The test now asserts on the message type, not just the text, so the regression cannot come back silently. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e7232d5f-1e25-4737-a40a-f7e3e553fd7f
🧪 Test quality grade — PR #10331
This advisory comment was generated automatically. Grades are heuristic and informational — they do not block merging. Suggestions on the Files changed tab can be applied with one click. Re-run with
|
There was a problem hiding this comment.
🤖 Automated content by GitHub Copilot. Generated by the Grade Tests on PR (on open / sync) workflow. · sonnet46 89.3 AIC · ⌖ 4.59 AIC · ⊞ 11.8K · ◷
The test name promised plural attempts but only asserted StageAttempt, so the PhaseAttempt and JobAttempt parses were exercised without being checked. Give each attempt a differently unusable value (non-numeric, non-integer, empty) and assert all three, so every GetOptionalEnvironmentVariableAsInt32 call is pinned to null rather than only the one. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e7232d5f-1e25-4737-a40a-f7e3e553fd7f
There was a problem hiding this comment.
Review details
Comments suppressed due to low confidence (1)
src/Platform/Microsoft.Testing.Extensions.AzureDevOpsReport/AzureDevOpsTestResultsPublisher.cs:208
- The PR description still says the new message uses
TextOutputDeviceData, but this corrected implementation now usesSessionMessageOutputDeviceData. Please update that reviewer note so it no longer contradicts the code and the resolved review thread.
private Task DisplayAsync(string message, CancellationToken cancellationToken)
=> DisplayCoreAsync(new SessionMessageOutputDeviceData(message), cancellationToken);
- Files reviewed: 22/22 changed files
- Comments generated: 0 new
- Review effort level: Medium
There was a problem hiding this comment.
🤖 Automated content by GitHub Copilot. Generated by the Grade Tests on PR (on open / sync) workflow. · sonnet46 84.2 AIC · ⌖ 4.97 AIC · ⊞ 11.8K · ◷
Follow-up to the discussion in #10191, where a user observed that the Tests tab only appears once every test has finished, rather than updating live.
Why
That observation is correct, and it is expected.
--publish-azdo-test-resultsalready streams results as tests complete (batch of 100, flush every 5s, plus a background timer flush for the tail of a slow run). What is not live is the Tests tab: we create the run asInProgressand only PATCH it toCompletedinOnTestSessionFinishingAsync, and the build's Tests tab only lists finalized runs.I checked whether we could do better, because the previous evidence for "InProgress runs are not surfaced" was a code comment we wrote ourselves:
Completedruns collated server-side, plus a DTA-onlyenvironmentUri = vstest://env/....icnocop/AzurePipelines.TestLogger, xunit v2VstsClient) does exactly what we do. Their "real-time" claim is about sending results, not viewing them.So real-time Tests-tab updates are not reachable through the public Test Management REST API. The only alternative, publishing many short
Completedruns, would fragment the tab into dozens of run rows.What this changes
Surface the live view that does exist. The run's own page does show results as they arrive. We knew the run id from the moment we created the run and never told anyone. The process that owns the run now reports its URL once, and says when the Tests tab catches up, so an empty tab mid-run is not mistaken for a failure:
Only the owner reports it, since every other process in a multi-project run shares the same run id and would just repeat the line.
Send
pipelineReferenceandstartedDateon run creation. This is a real gap rather than cosmetics: the pipelines agent (TestRunContextBuilder.cs) always setspipelineReference, and without it a run is attributed to the build as a whole and cannot be attributed to the stage and job that produced it in a multi-stage pipeline.pipelineIdmust equalbuild.idper the API docs, and the stage/phase/job parts are omitted individually when the correspondingSYSTEM_*variables are absent, so nothing changes for pipelines that do not expose them.Reword the
--publish-azdo-test-resultsdescription. It promised publishing "live to the Azure DevOps Tests tab", which over-promises and is arguably where the confusion in #10191 started. It now says results are published to a test run as tests complete, and that the run is listed in the Tests tab once the session finishes.Notes for reviewers
AzureDevOpsPublishConfiguration.PipelineReferenceis declared as a property rather than a positional record parameter specifically so the existing constructor and deconstructor entries inInternalAPI.Shipped.txtdo not change.WarnAsyncwas split so warnings and informational messages share the same never-throwing display path. The new message goes out asSessionMessageOutputDeviceData, not a warning:DotnetTestPassthroughOutputDevicedeliberately discards plain informational text, anddotnet testis the invocation reported inMicrosoft.Testing.Extensions.AzureDevOpsReportcrashes during teardown after successful live Azure DevOps test-result publishing #10191.Verification
Microsoft.Testing.Extensions.UnitTestsassembly: 815 pass.build.cmd -packclean, then all 9HelpInfoAllExtensionsTestshelp/info acceptance tests pass with the updated option description.--helpoutput that the new description renders on a single line with the expected indentation..xlffiles regenerated with/t:UpdateXlf;InternalAPI.Unshipped.txtupdated.