feat: route real test program output to Test Results#1887
Merged
Conversation
The debuggee's stdout/stderr are delivered by java-debug as standard DAP `output` events, which by default only surface in the Debug Console. This splits program output (Debug Console) from test results (Test Results view) across two separate surfaces, and the runner previously echoed the raw JUnit/TestNG control protocol frames to Test Results as noise. - Attach a DebugAdapterTracker to the test's own debug session and forward its DAP `output` events into the Test Results view (BaseRunner). - Stop echoing the socket control protocol to Test Results: JUnit no longer appends every raw line, and TestNG no longer echoes its JSON frames. - Attribute forwarded output to the running test when exactly one test is executing; fall back to run-level output when idle or when several tests run in parallel (attribution would only be a guess).
Correlate debug sessions with a unique launch marker, mirror non-telemetry DAP output at run level, and preserve structured TestNG runner errors while suppressing control protocol noise. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 8db89d6b-bcb8-42d2-9f14-78aab176fcd0
There was a problem hiding this comment.
Pull request overview
This PR improves the VS Code Java Test experience by routing real program/debug output into Test Results (in addition to the Debug Console) and by suppressing runner-protocol “noise” previously echoed into Test Results.
Changes:
- Adds a
DebugAdapterTrackerfor the specific Java test debug session (correlated via an internal run UUID) and forwards non-telemetry DAPoutputevents toTestRun.appendOutput. - Stops echoing raw control/protocol frames into Test Results for JUnit and TestNG; preserves structured diagnostics via the Testing API.
- Adds/updates tests to validate DAP-output forwarding and TestNG runner-error handling / control-frame ignoring.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/suite/TestNGAnalyzer.test.ts | New unit tests for TestNG analyzer: structured runner error surfacing and ignoring control frames without test attributes. |
| test/suite/baseRunner.test.ts | Adds unit tests covering BaseRunner.handleDebugAdapterMessage forwarding behavior and telemetry filtering. |
| src/runners/testngRunner/TestNGRunnerResultAnalyzer.ts | Stops echoing raw TestNG frames; ignores control frames without test identifiers; surfaces runner-level error frames as structured test errors; makes duration parsing resilient. |
| src/runners/junitRunner/JUnitRunnerResultAnalyzer.ts | Removes echoing of raw JUnit socket lines into Test Results (protocol-only stream), relying on structured messages instead. |
| src/runners/baseRunner/BaseRunner.ts | Correlates the correct debug session via internal run ID, attaches a tracker, and mirrors non-telemetry DAP output events into Test Results with CRLF normalization. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
chagong
approved these changes
Jul 16, 2026
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
Running a test with the Java Test Runner splits output across two disconnected surfaces:
outputevents, which normally appear only in the Debug Console.The runner also echoed raw JUnit/TestNG control frames into Test Results, producing protocol noise such as
%TESTS,%TESTE, and TestNG JSON frames instead of useful user-facing output.See eclipse-jdtls/eclipse.jdt.ls#3834 for the broader discussion.
Change
DebugAdapterTrackerto the test debug session and forward all non-telemetry DAPoutputevents throughTestRun.appendOutput.errorframes are surfaced as structured test errors.This requires no changes to java-debug; it consumes the standard DAP events already emitted by the debug session.
Notes / limitations
TestRun.appendOutputis an uncategorized stream, so stdout, stderr, and console color separation is not preserved.Validation