You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "tstangenberg (via GitHub)" <gi...@apache.org> on 2026/09/16 12:55:42 UTC
[I] Surefire 3.6.0 silently reports zero tests for all `%regex[...]`-included classes when one matched class has no discoverable tests [maven-surefire]
tstangenberg opened a new issue, #3474:
URL: https://github.com/apache/maven-surefire/issues/3474
### Affected version
3.6.0
### Bug description
## Summary
When `<includes>` on `maven-surefire-plugin` uses a `%regex[...]` pattern, if *any* class matched by that pattern has zero discoverable JUnit 5 tests, Surefire 3.6.0 silently reports **zero tests for every matched class** — including unrelated classes with real, passing `@Test` methods. No error, no warning, `BUILD SUCCESS`.
This works correctly on Surefire 3.5.6 with the exact same configuration — only the plugin version differs.
## Reproduction
Minimal repo: https://github.com/42talents/surefire-3.6.0-regex-include-regression
Two test classes:
- `EmptyTest.java` — a class with no test methods at all (matches the include pattern only by name)
- `PlainTest.java` — a normal class with one passing `@Test`
pom.xml:
```xml
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.6.0</version>
<configuration>
<includes>
<include>%regex[.*Test.class]</include>
</includes>
</configuration>
</plugin>
```
```
mvn test # Surefire 3.6.0 (default): Tests run: 0
mvn test -Dsurefire.version=3.5.6 # Surefire 3.5.6: Tests run: 1, PlainTest passes
```
A GitHub Actions matrix build in the repo (`.github/workflows/repro.yml`) demonstrates this automatically — the 3.5.6 job passes, the 3.6.0 job fails an assertion that `PlainTest` actually ran.
## Expected
`PlainTest`'s single test runs and passes, regardless of `EmptyTest`'s presence — matching 3.5.6 behavior.
## Actual
`Tests run: 0, Failures: 0, Errors: 0, Skipped: 0`, `BUILD SUCCESS`. `target/surefire-reports/repro.PlainTest.txt` is never created.
## Environment
- Maven Surefire 3.6.0 (broken) / 3.5.6 (working)
- JUnit Jupiter 5.14.4, JUnit Platform 1.14.4
- JDK 21 (Temurin)
- Provider: `org.apache.maven.surefire.junitplatform.JUnitPlatformProvider` (auto-detected)
- Reproduces both forked (`forkCount=1`) and in-process (`forkCount=0`)
## Notes
This was discovered as a real-world regression affecting a much larger project (thousands of tests), where it manifested as a partial truncation — some classes ran, later-discovered ones silently didn't. The attached minimal repro isolates the actual trigger to a single empty class breaking the whole batch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Surefire 3.6.0 silently reports zero tests for all `%regex[...]`-included classes when one matched class has no discoverable tests [maven-surefire]
Posted by "olamy (via GitHub)" <gi...@apache.org>.
olamy closed issue #3474: Surefire 3.6.0 silently reports zero tests for all `%regex[...]`-included classes when one matched class has no discoverable tests
URL: https://github.com/apache/maven-surefire/issues/3474
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Surefire 3.6.0 silently reports zero tests for all `%regex[...]`-included classes when one matched class has no discoverable tests [maven-surefire]
Posted by "orion0616 (via GitHub)" <gi...@apache.org>.
orion0616 commented on issue #3474:
URL: https://github.com/apache/maven-surefire/issues/3474#issuecomment-5723114426
This looks like the same root cause as #3465, fixed by #3466 (milestone 3.6.1): the provider matched `%regex[...]` includes against the dot-separated class name instead of the `.class` path, so they never matched.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org