Repository navigation
fix: warn when matching test classes have no provider - #3567
Conversation
|
|
||
| TestClassPath testClasspath = generateTestClasspath(); | ||
| List<ProviderInfo> providers = createProviders(testClasspath); | ||
| if (providers.isEmpty()) { |
There was a problem hiding this comment.
Is this skipped if there are no test classes?
There was a problem hiding this comment.
Yes. When the test scan is empty, Surefire returns before reaching the provider check, so this warning is skipped.
I added an integration test using -Dtest=DoesNotExist with surefire.failIfNoSpecifiedTests=false to verify this behavior. Both integration tests pass.
| */ | ||
| package demo; | ||
|
|
||
| public class CalculatorTest { |
There was a problem hiding this comment.
Did this ever work? I'm surprised if we ever ran something like this.
There was a problem hiding this comment.
Yes. I reproduced this behavior using the same POJO test fixture.
Surefire 3.5.4 discovers and executes the test through JUnit3Provider and PojoTestSetExecutor, resulting in one expected test failure.
With Surefire 3.6.1, the same project completes successfully without executing the test.
This confirms the behavior reported in #3566 and explains why the warning is useful.
|
Summary
Fixes #3566.
Since Surefire 3.6.0, projects containing plain Java test classes (POJO tests) can complete successfully without executing those tests or displaying a warning.
I added a warning to make this behavior more visible and help developers identify missing test framework dependencies.
Changes
The warning is only displayed when test classes are discovered but no provider is available. It is skipped when the test scan is empty.
Behavior Verification
I reproduced the behavior using the same POJO test fixture across different Surefire versions.
JUnit3ProviderandPojoTestSetExecutor. The build fails as expected because the fixture contains a failing assertion.These results confirm the behavior reported in #3566.
Testing
Regression Tests
Before the fix:
After the fix:
The integration tests verify:
Test Command
Additional Validation
Contribution Declaration
Contribution Declaration