Fix reporting of @Ignored JUnit 3 test classes
#3427
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
If JUnit3 test cases are annotated w/
@Ignoreand run w/ JUnit Vintage engine, they will be reported twice: once as started and once as skipped.This is caused by inconsistent checking for the annotation presence.
DefensiveAllDefaultPossibilitiesBuilderwill check for the annotation presence on the Java class to create anIgnoringRunnerDecorator(ref), whileRunListenerAdapterwill look for the annotation on the runner'sDescriptionto actually ignore the class (ref).So, if the Java class is annotated w/
@Ignore, but the runner does no add it to the rootDescription, then the test class will be once reported as started by theRunListenerAdapterand once as skipped byIgnoringRunnerDecorator. And this is exactly the case forJUnit38ClassRunnerwhich does not include class-level annotation in the runner's description (ref).In this PR, I propose to explicilty add
@Ignoreannotation for the JUnit3 runner's description and warn creators of custom runners about the missing annotation. I open this PR as a draft proposal first to discuss the approach.I hereby agree to the terms of the JUnit Contributor License Agreement.
Definition of Done
@APIannotations