Skip to content

fix: show only test cases in Test Results#1888

Merged
wenytang-ms merged 3 commits into
mainfrom
feat/leaf-test-results
Jul 16, 2026
Merged

fix: show only test cases in Test Results#1888
wenytang-ms merged 3 commits into
mainfrom
feat/leaf-test-results

Conversation

@wenytang-ms

@wenytang-ms wenytang-ms commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Problem

VS Code's Test Results view flattens every TestItem that receives its own task state. The built-in Java runners queued parent containers and explicitly reported class states, so a single Java test could produce separate Class, Method, and Invocation rows.

Test Results also builds each leaf result's breadcrumb from its parent TestItem labels. Those labels previously included codicon markup such as $(symbol-class), which VS Code rendered as literal text in the breadcrumb instead of as an icon.

Change

  • Queue JUnit results only after %TSTTREE identifies a non-suite leaf.
  • Queue and report TestNG method cases without assigning states to their class containers.
  • Remove explicit class-state aggregation and let VS Code compute Test Explorer parent status from child results.
  • Suppress routine JUnit suite/container lifecycle states while preserving failed or errored containers, as well as skipped containers with no leaf test cases, so setup and assumption outcomes remain visible.
  • Use plain test item labels so Test Explorer and Test Results breadcrumbs show readable project, package, class, and method names without raw codicon markup.
  • Report TestNG runner-level errors on the discovered method cases instead of their selected class.

Scope / notes

  • The Test Explorer hierarchy remains unchanged; only the decorative codicon prefixes are removed from item labels.
  • Test Results uses the existing method/invocation items and their parent breadcrumb, avoiding synthetic result items and preserving rerun/reveal behavior.
  • Delegated test profiles retain their existing reporting because the external runner API does not currently expose reliable container/leaf metadata.
  • Test Results ordering remains controlled by VS Code: result state has priority, followed by result insertion order.

Validation

  • npm run compile
  • npm run lint
  • Targeted Extension Host tests: 18 passing (JUnitAnalyzer, TestNGAnalyzer)
  • Manual VSIX validation of Test Explorer labels and Test Results rows, breadcrumbs, output, and failure details
  • Full npm test: affected tests pass; 10 unrelated tests fail because the installed redhat.java pre-release does not register the legacy Java test delegate commands.

Copilot-Session: 66d94993-0cc9-4a2f-886b-99a1649e7051

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the built-in JUnit/TestNG result analyzers (and supporting controller logic/tests) so VS Code’s Test Results view only shows method/invocation test cases, avoiding extra suite/class rows caused by assigning task states to container items.

Changes:

  • JUnit: enqueue/report only non-suite leaf items from %TSTTREE, and suppress routine suite/container lifecycle state reporting.
  • TestNG: enqueue/report method cases without assigning result states to class containers; report runner-level errors on discovered method cases.
  • Controller/tests: adjust queuing behavior for delegated runners and add/adjust analyzer unit tests to verify container items don’t get result states.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/suite/TestNGAnalyzer.test.ts Adds coverage ensuring method results/error reporting doesn’t assign states to class containers.
test/suite/JUnitAnalyzer.test.ts Updates/adds tests to validate leaf-only enqueuing and suppression of suite reporting.
src/runners/testngRunner/TestNGRunnerResultAnalyzer.ts Enqueues method items and avoids propagating state to class containers; targets runner errors to method cases.
src/runners/junitRunner/JUnitRunnerResultAnalyzer.ts Tracks suite-vs-leaf items and suppresses suite lifecycle reporting while keeping failing containers visible.
src/runners/baseRunner/RunnerResultAnalyzer.ts Removes parent aggregation/state propagation helpers (now relying on VS Code parent computation).
src/controller/testController.ts Moves/enables pre-enqueueing only for delegated runners to preserve their existing reporting behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/runners/junitRunner/JUnitRunnerResultAnalyzer.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Comment thread src/runners/junitRunner/JUnitRunnerResultAnalyzer.ts
Comment thread test/suite/JUnitAnalyzer.test.ts Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 25c88712-87e4-4104-ad0e-2e8a9c195f7c

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@wenytang-ms

wenytang-ms commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author
image

before
image

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

Copilot-Session: 25c88712-87e4-4104-ad0e-2e8a9c195f7c
@wenytang-ms
wenytang-ms requested a review from Copilot July 16, 2026 07:47
@wenytang-ms
wenytang-ms marked this pull request as ready for review July 16, 2026 07:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@wenytang-ms
wenytang-ms merged commit ddddc9d into main Jul 16, 2026
6 checks passed
@wenytang-ms
wenytang-ms deleted the feat/leaf-test-results branch July 16, 2026 08:09
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