GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix reporting of `@Ignored` JUnit 3 test classes by pshevche · Pull Request #3427 · junit-team/junit-framework

Conversation

@pshevche

@pshevche pshevche commented Aug 15, 2023

Copy link
Copy Markdown
Contributor

Overview

If JUnit3 test cases are annotated w/ @Ignore and 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. DefensiveAllDefaultPossibilitiesBuilder will check for the annotation presence on the Java class to create an IgnoringRunnerDecorator (ref), while RunListenerAdapter will look for the annotation on the runner's Description to actually ignore the class (ref).

So, if the Java class is annotated w/ @Ignore, but the runner does no add it to the root Description, then the test class will be once reported as started by the RunListenerAdapter and once as skipped by IgnoringRunnerDecorator. And this is exactly the case for JUnit38ClassRunner which does not include class-level annotation in the runner's description (ref).

In this PR, I propose to explicilty add @Ignore annotation 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

  • There are no TODOs left in the code
  • Method preconditions are checked and documented in the method's Javadoc
  • Coding conventions (e.g. for logging) have been followed
  • Change is covered by automated tests including corner cases, errors, and exception handling
  • Public API has Javadoc and @API annotations
  • Change is documented in the User Guide and Release Notes

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@marcphilipp marcphilipp self-assigned this Aug 28, 2023
@marcphilipp
marcphilipp self-requested a review August 28, 2023 12:31
@marcphilipp marcphilipp added this to the 5.10.1 milestone Sep 1, 2023
pshevche and others added 6 commits September 5, 2023 13:51
@pshevche @marcphilipp
Add test for wrong reporting of skipped JUnit3 test cases
5f47dae
@pshevche @marcphilipp
Manually add @Ignore annotation to the JUnit38ClassRunner root de…
5d68ad5
…scription
@marcphilipp
Revert "Manually add @Ignore annotation to the JUnit38ClassRunner…
5bf067f
… root description"

This reverts commit ea3e7df.
@marcphilipp
Track skip reason in RunnerTestDescriptor
25ca326
@marcphilipp
Add another test case
37bb89e
@marcphilipp
Fall back to read Ignore annotation from test class
103b29d
@marcphilipp
marcphilipp marked this pull request as ready for review September 5, 2023 11:52
@marcphilipp

marcphilipp commented Sep 5, 2023

Copy link
Copy Markdown
Member

@pshevche Thanks for the PR! I had some qualms about decorating Description so went a slight different route. Instead of looking for the annotation in IgnoringRunnerDecorator that's now done in RunListenerAdapter.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

marcphilipp
marcphilipp approved these changes Sep 5, 2023
View reviewed changes
@marcphilipp marcphilipp added type: bug theme: reporting component: Vintage labels Sep 5, 2023
@marcphilipp
Add entry to release notes
2d50bbd
pshevche
pshevche commented Sep 5, 2023
View reviewed changes

@pshevche pshevche left a comment

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcphilipp , looks good from my side, thank you for getting it over the finish line 👍

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@marcphilipp marcphilipp changed the title Fix wrong reporting of ignored JUnit3 test cases when using vintage engine Fix reporting of ignored JUnit 3 test classes Sep 5, 2023
@marcphilipp
marcphilipp merged commit cb34452 into junit-team:main Sep 5, 2023
sbrannen pushed a commit that referenced this pull request Sep 14, 2023
@pshevche @marcphilipp @sbrannen
Fix reporting of ignored JUnit 3 test classes (#3427)
b8bf295
Prior to this commit, `@Ignore`-annotated JUnit 3 test classes where
reported as started and then as skipped due to their `Description` not
including class-level annotations in some case.

Co-authored-by: Marc Philipp <[email protected]>
@sbrannen sbrannen changed the title Fix reporting of ignored JUnit 3 test classes Fix reporting of @Ignored JUnit 3 test classes Sep 16, 2023
@pshevche
pshevche deleted the pshevche/vintage-engine-wrong-reporting-ignored-junit3 branch November 16, 2023 07:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@marcphilipp marcphilipp marcphilipp approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@marcphilipp marcphilipp

Labels

component: Vintage theme: reporting type: bug

Projects

None yet

Milestone

5.10.1

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@pshevche @marcphilipp
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.