Skip to content

Add --scan-dryrun-results for Maven subset to honor pom.xml test filtering - #1363

Closed
ItIsUday wants to merge 1 commit into
mainfrom
feat/scan-dryrun-results
Closed

Add --scan-dryrun-results for Maven subset to honor pom.xml test filtering#1363
ItIsUday wants to merge 1 commit into
mainfrom
feat/scan-dryrun-results

Conversation

@ItIsUday

@ItIsUday ItIsUday commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Why

The Maven subset command scans every *Test.java under the source roots and sends them all to the backend. But Surefire filters tests at runtime via pom.xml<excludedGroups> / <includedGroups> (JUnit 5 @Tag), <excludes> / <includes> (class globs), and profiles. The subset never sees that filtering, so it includes tests Maven will never run. At record time those tests have no matching report, which produces "missing test report" warnings and skews subset accuracy.

This is the customer-reported case behind LCHIB-693: @Tag("IntegrationTest") / @Tag("SmokeTest") tests excluded via <excludedGroups>IntegrationTest,SmokeTest</excludedGroups> still get sent to the subset.

What

New --scan-dryrun-results flag on subset ... maven. Instead of scanning source files, it parses **/target/surefire-reports/TEST-*.xml and sends the fully-qualified class name from each report's root name attribute.

The workflow is to run a JUnit 5 dry run first:

mvn test -Djunit.platform.execution.dryRun.enabled=true
smart-tests subset ... maven --scan-dryrun-results

Limitations

  • JUnit 5 only. The dry-run parameter is a JUnit Platform feature; JUnit 4 @Category and TestNG groups are not covered.

…ering

The Maven subset command scans all *Test.java files and sends them to the
backend, ignoring Surefire filtering (excludedGroups, excludes, profiles).
Excluded tests then have no matching report at record time, producing
"missing test report" warnings and skewing subset accuracy.

--scan-dryrun-results parses target/surefire-reports/TEST-*.xml instead of
scanning source files. Run `mvn test -Djunit.platform.execution.dryRun.enabled=true`
first: Surefire applies all its filtering before the JUnit 5 dry run, so only
the classes Maven would actually run get a report. JUnit 5 only.

Hard-fails when no reports are found rather than silently sending an empty
subset.
@ItIsUday ItIsUday self-assigned this Aug 24, 2026

@Konboi Konboi 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.

My understanding is that this is basically the same as this PR, but it emphasizes that the scope is limited to JUnit 5. Is that correct?

Also, since the target tenant is using the Launchable commands (V1), please create the branch from v1 rather than main. After merging the changes into v1, please merge v1 into main.

@ItIsUday

Copy link
Copy Markdown
Contributor Author

The main difference compared to that PR is the use of -Djunit.platform.execution.dryRun.enabled=true instead of -DdryRun=true.

Sure I'll update the PR to point to v1

@ItIsUday

ItIsUday commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

v1 counterpart is #1368. These land independently — not merging v1 → main, since main has diverged a lot with v1

@ItIsUday
ItIsUday marked this pull request as draft August 27, 2026 08:59
@ItIsUday

Copy link
Copy Markdown
Contributor Author

Putting this in draft. Per the v1 → v2 forward-porting guide, the sanctioned path is to land the v1 change (#1368) first, then forward-port it into main via git merge v1 (resolving the launchable/smart_tests/ rename conflict as the guide describes). So main will receive this change through that merge rather than by merging this PR independently. Keeping the branch around as reference until #1368 lands.

@ItIsUday

Copy link
Copy Markdown
Contributor Author

Superseded by #1370, which forward-ports the change from v1 via git merge v1.

@ItIsUday ItIsUday closed this Aug 27, 2026
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.

2 participants