Skip to content

Report the Azure DevOps test run URL and send pipelineReference when live publishing - #10331

Merged
Amaury Levé (Evangelink) merged 3 commits into
mainfrom
dev/amauryleve/turbo-spork
Jul 29, 2026
Merged

Amaury Levé (Evangelink) merged 3 commits into
mainfrom
dev/amauryleve/turbo-spork

Conversation

@Evangelink

@Evangelink Amaury Levé (Evangelink) commented Jul 29, 2026 •

Copy link
Copy Markdown
Member

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-results already 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 as InProgress and only PATCH it to Completed in OnTestSessionFinishingAsync, 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:

  • MS Learn gates the documented "View execution of in-progress tests" feature on the VSTest task in a Multi-Agent job.
  • azure-pipelines-tasks#8718: a Microsoft engineer explains that VSTest's incremental visibility comes from many small Completed runs collated server-side, plus a DTA-only environmentUri = vstest://env/....
  • Prior art that drives the same REST API (icnocop/AzurePipelines.TestLogger, xunit v2 VstsClient) 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 Completed runs, 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:

Azure DevOps live publishing is streaming results to test run 4242, which you can follow while the tests are still running at https://dev.azure.com/org/project/_TestManagement/Runs?runId=4242&_a=resultQuery. The build's Tests tab lists the run once it completes.

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 pipelineReference and startedDate on run creation. This is a real gap rather than cosmetics: the pipelines agent (TestRunContextBuilder.cs) always sets pipelineReference, 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. pipelineId must equal build.id per the API docs, and the stage/phase/job parts are omitted individually when the corresponding SYSTEM_* variables are absent, so nothing changes for pipelines that do not expose them.

Reword the --publish-azdo-test-results description. 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.PipelineReference is declared as a property rather than a positional record parameter specifically so the existing constructor and deconstructor entries in InternalAPI.Shipped.txt do not change.
  • WarnAsync was split so warnings and informational messages share the same never-throwing display path. The new message goes out as SessionMessageOutputDeviceData, not a warning: DotnetTestPassthroughOutputDevice deliberately discards plain informational text, and dotnet test is the invocation reported in Microsoft.Testing.Extensions.AzureDevOpsReport crashes during teardown after successful live Azure DevOps test-result publishing #10191.
  • I deliberately did not implement periodic checkpoint runs (complete-and-restart every N seconds). It is the only way to get a live aggregate in the Tests tab, but it fragments the tab and complicates the multi-process run-id coordinator. Happy to prototype it if we decide the trade is worth it.

Verification

  • 204 AzureDevOps unit tests pass, including 10 new ones covering pipeline-reference population, non-numeric attempt handling, the serialized JSON payload shape, the omission cases, and the run-URL output.
  • Full Microsoft.Testing.Extensions.UnitTests assembly: 815 pass.
  • build.cmd -pack clean, then all 9 HelpInfoAllExtensionsTests help/info acceptance tests pass with the updated option description.
  • Confirmed against real --help output that the new description renders on a single line with the expected indentation.
  • .xlf files regenerated with /t:UpdateXlf; InternalAPI.Unshipped.txt updated.

…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
Copilot AI review requested due to automatic review settings July 29, 2026 18:47

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.

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 startedDate and 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

@Evangelink Amaury Levé (Evangelink) added the state/needs-review Awaiting review from the team. label Jul 29, 2026
@Evangelink
Amaury Levé (Evangelink) enabled auto-merge (squash) July 29, 2026 18:54
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
Copilot AI review requested due to automatic review settings July 29, 2026 18:57

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.

Review details

  • Files reviewed: 22/22 changed files
  • Comments generated: 0 new
  • Review effort level: Medium

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test quality grade — PR #10331

GradeTestMutationNotesHow to improve
B (80–89) new AzureDevOpsLivePublishingTests.
CreatePublisher_
NonNumericAttempts_
LeavesAttemptsNull
3/5 killed StageAttempt and PhaseName nullity are checked, but PhaseAttempt and JobAttempt are not asserted. Add Assert.IsNull(capturedConfiguration.PipelineReference.PhaseAttempt) and Assert.IsNull(...JobAttempt).
A (90–100) new AzureDevOpsLivePublishingTests.
CreatePublisher_
PopulatesPipelineReference_
FromPipelineVariables
6/6 killed All six pipeline reference fields are asserted with exact expected values. —
A (90–100) new AzureDevOpsLivePublishingTests.
CreatePublisher_
MissingStagePhaseAndJob_
LeavesPipelineReferenceNull
2/2 killed Correctly pins the null-reference boundary when all three context variables are absent. —
A (90–100) new AzureDevOpsLivePublishingTests.
OnTestSessionStartingAsync_
DisplaysTestRunUrlSoResults_
CanBeFollowedLive
3/3 killed Verifies URL content, message type (SessionMessage not Warning), and absence of warnings. —
A (90–100) new AzureDevOpsLivePublishingTests.
AzureDevOpsTestResultsClient_
CreateTestRun_
SendsStartedDateAndPipelineReference
8/8 killed Parses the raw HTTP body and asserts startedDate, all pipeline reference fields, and the pipelineId cross-check. —
A (90–100) new AzureDevOpsLivePublishingTests.
AzureDevOpsTestResultsClient_
CreateTestRun_
OmitsPipelineReferenceWhenUnavailable
2/2 killed Verifies absence of pipelineReference property in JSON when configuration has no PipelineReference. —
A (90–100) new AzureDevOpsLivePublishingTests.
AzureDevOpsTestResultsClient_
CreateTestRun_
OmitsStageAndPhaseWhenOnlyJobIsKnown
4/4 killed Asserts stageReference and phaseReference are absent, jobName matches, and no attempt field is emitted. —
A (90–100) mod HelpInfoAllExtensionsTests.
Help_
WithAllExtensionsRegistered_
OutputFullHelpContent
N/A Updated expected string accurately reflects the new CLI option description; golden-string approach is appropriate here. —
A (90–100) mod HelpInfoAllExtensionsTests.
Info_
WithAllExtensionsRegistered_
OutputFullInfoContent
N/A Updated expected string accurately reflects the new CLI option description in --info output. —

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 /grade-tests.

🤖 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 · [◷]( · ◷)

@github-actions github-actions Bot 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.

🤖 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
Copilot AI review requested due to automatic review settings July 29, 2026 19:14

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.

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 uses SessionMessageOutputDeviceData. 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

@github-actions github-actions Bot 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.

🤖 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 · ◷

@Evangelink
Amaury Levé (Evangelink) merged commit 843b5c8 into main Jul 29, 2026
49 checks passed
@Evangelink
Amaury Levé (Evangelink) deleted the dev/amauryleve/turbo-spork branch July 29, 2026 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state/needs-review Awaiting review from the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants