Surface per-test standard output/error on the MTP execution path - #16284
Merged
Azat Mukhametshin (azat-msft) merged 1 commit intoJul 14, 2026
Merged
Conversation
The MTP test node carries per-test standardOutput/standardError, but MtpTestNodeConverter.ToTestResult dropped them, so a test's captured output appeared in neither the console nor the TRX. Map them onto the vstest result as StandardOut/StandardError messages, matching the classic path. Adds acceptance test RunMtpApplicationSurfacesPerTestStandardOutput; TestPassesToo now writes markers that the test asserts reach the TRX. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: fb7de7a6-b8a1-4ebb-8266-5c5a948f245c
Copilot started reviewing on behalf of
Azat Mukhametshin (azat-msft)
July 14, 2026 10:33
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes missing per-test standard output/error when running Microsoft.Testing.Platform (MTP) applications via the vstest.console MTP execution path by mapping the MTP node’s standardOutput/standardError fields onto TestResult.Messages using the standard StandardOut/StandardError categories, enabling existing loggers (console/TRX) to surface the captured output.
Changes:
- Add
standardOutput/standardErrorprotocol keys toMtpConstants. - Extend
MtpTestNodeConverter.ToTestResultto attach per-test stdout/stderr asTestResultMessages. - Add an acceptance test that validates the markers appear in the generated TRX, and update the MTP MSTest asset to emit those markers.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/TestAssets/MtpMSTestProject/UnitTests.cs | Emit stdout/stderr markers from a passing test to drive end-to-end validation. |
| test/Microsoft.TestPlatform.Acceptance.IntegrationTests/MtpUnderVstestTests.cs | New acceptance test asserts stdout/stderr markers are present in the produced TRX. |
| src/Microsoft.TestPlatform.CrossPlatEngine/Client/MTP/MtpTestNodeConverter.cs | Maps MTP per-test stdout/stderr fields onto TestResult.Messages for logger consumption. |
| src/Microsoft.TestPlatform.CrossPlatEngine/Client/MTP/MtpConstants.cs | Adds constants for standardOutput/standardError node properties. |
Jakub Jareš (nohwnd)
approved these changes
Jul 14, 2026
Azat Mukhametshin (azat-msft)
merged commit Jul 14, 2026
f48a80f
into
microsoft:main
20 checks passed
Azat Mukhametshin (azat-msft)
added a commit
to azat-msft/vstest
that referenced
this pull request
Jul 14, 2026
- RunMtpApplicationSurfacesPerTestStandardOutput asserted the old 4-test summary (2,1,1); the shared MtpMSTestProject asset gained a 5th test (RunSettingsEnvironmentVariableIsInjected), so the run is (3,1,1). This is a semantic collision between microsoft#16283 and microsoft#16284 that only surfaces when both are on main. Update the expected summary. - Address review feedback: extract the near-identical MTP discovery routine from MtpProxyDiscoveryManager and MtpProxyExecutionManager into a single MtpClientHelpers.DiscoverSourceTests helper so the two paths cannot drift (timeouts, cancellation, sentinel drain, env-var policy). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 61d9a1c3-3c9f-4dab-8ba3-5baba8d55ed6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On the
vstest.consolepath that runs a Microsoft.Testing.Platform (MTP) app as its own testhost (#16201), a test's standard output/error appeared in neither the console nor the TRX. Diagnostic output printed by tests was lost.Root cause
The MTP test node does carry per-test
standardOutput/standardError(confirmed from the raw JSON-RPC node), butMtpTestNodeConverter.ToTestResultnever read them, so nothing was attached to the vstestTestResultfor the loggers to write.Fix
Map the node's
standardOutput/standardErrorontoTestResult.Messageswith theStandardOut/StandardErrorcategories, matching the classic path where a test's captured output is attached to its result.Test
New acceptance test
RunMtpApplicationSurfacesPerTestStandardOutput:TestPassesToonow writesMTP_STDOUT_MARKER/MTP_STDERR_MARKER; the test runs the MTP app with/logger:trxand asserts both markers appear in the TRX.Validation
RunMtpApplicationSurfacesPerTestStandardOutput: 2/2 matrix cases pass (markers absent onmain).Microsoft.TestPlatform.CrossPlatEngineand the acceptance project: clean.