Skip to content

Enhancement/lchib 614 fix nested maven test scenario cli v2 - #1415

Merged
jothikumar-CB merged 5 commits into
mainfrom
enhancement/LCHIB-614-fix-nested-maven-test-scenario-cli-v2
Oct 26, 2026
Merged

jothikumar-CB merged 5 commits into
mainfrom
enhancement/LCHIB-614-fix-nested-maven-test-scenario-cli-v2

Conversation

@jothikumar-CB

@jothikumar-CB jothikumar-CB commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor
  • Fixes two correctness bugs flagged in code review on enhancement/LCHIB-614: utilize surefire report extended by rerunFailingTests feature #1404 (the original Surefire rerun/flaky feature): the post-run "Tests found / passed / failed" summary could silently merge two different tests into one entry, or crash with a KeyError.
  • Nested-class collision: Maven's $-stripping for @nested JUnit5 classes meant two independent tests (e.g. Outer$Failing.sameName and Outer$Passing.sameName) shared the same normalized testPath, so a pass and a fail were reported as a single test instead of two.
  • Raw-runner collision/crash: TestPathComponent is an arbitrary bag of string attributes and isn't required to have type/name. The raw runner accepts such paths, which made the summary either raise KeyError (after results were already uploaded) or silently merge paths that only differed in some other attribute.
  • Both are fixed by tagging every event derived from the same original with an internal-only UUID (BATCH_ID_KEY), set in CaseEvent.from_case_and_suite. summarize_case_events groups by this id directly for JUnit-based events, and falls back to the full sorted attribute set of each testPath component (not just type/name) for events from runners that never set this key (raw, pytest, nunit, etc.).
  • The tag is internal-only and stripped in payload() before upload — it never reaches the server, and CaseEvent.create() itself (called directly by 9 other runners) is untouched.

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.

🟡 Changes recommended

The central counting correction needs regression tests that distinguish separate testcases with identical paths from retries of one testcase.

1 open issue
What changed in this PR

This PR corrects CLI test-summary counting for nested Maven tests whose canonical paths collide, while keeping retry attempts grouped as one test.

Changes:

  • Assign an internal batch ID to events from each original JUnit testcase.
  • Group summaries by batch ID, falling back to complete path attributes for other runners.
  • Remove internal batch IDs before uploading events.
File Description
smart_tests/​commands/​record/​tests.py Updates summary grouping and strips batch IDs from upload payloads.
smart_tests/​commands/​record/​case_event.py Assigns a shared batch ID to each testcase’s attempt events.

Review effort: Balanced

Comment thread smart_tests/commands/record/tests.py Resolved
@jothikumar-CB
jothikumar-CB merged commit f44c680 into main Oct 26, 2026
4 checks passed
@jothikumar-CB
jothikumar-CB deleted the enhancement/LCHIB-614-fix-nested-maven-test-scenario-cli-v2 branch October 26, 2026 09:31
@github-actions github-actions Bot mentioned this pull request Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Smart Tests CLI The next gen CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants