Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

8296283: JUnit5 tests using Params API fails to compile #939

Closed
wants to merge 3 commits into from

Conversation

arapte
Copy link
Member

@arapte arapte commented Nov 7, 2022

This issue was uncovered when running the test added in PR: #910
The JUnit5 tests using Params API fails to compile.

Fix:
Change dependency of junit-jupiter-params from runtime to compile time.
From: https://junit.org/junit5/docs/current/user-guide/#overview-what-is-junit-5: it can be understood that packages of JUnit Jupiter other than TestEngine are required for test compilation and
JUnit Platform serves as a foundation for launching testing frameworks

It seems that changing dependency of this one package is sufficient for this fix.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8296283: JUnit5 tests using Params API fails to compile

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jfx pull/939/head:pull/939
$ git checkout pull/939

Update a local copy of the PR:
$ git checkout pull/939
$ git pull https://git.openjdk.org/jfx pull/939/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 939

View PR using the GUI difftool:
$ git pr show -t 939

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jfx/pull/939.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 7, 2022

馃憢 Welcome back arapte! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Ready for review label Nov 7, 2022
@mlbridge
Copy link

mlbridge bot commented Nov 7, 2022

Webrevs

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

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

Looks good, pending my question about junit-platform-commons.

build.gradle Show resolved Hide resolved
@openjdk
Copy link

openjdk bot commented Nov 7, 2022

@arapte This change now passes all automated pre-integration checks.

鈩癸笍 This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8296283: JUnit5 tests using Params API fails to compile

Reviewed-by: kcr

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential automatic rebasing, please check the documentation for the /integrate command for further details.

鉃★笍 To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Ready to be integrated label Nov 7, 2022
@openjdk openjdk bot removed the ready Ready to be integrated label Nov 7, 2022
@arapte
Copy link
Member Author

arapte commented Nov 7, 2022

@kevinrushforth
Added a test as you suggested offline.
The checks inside test may not be required, please suggest if any modifications required.

@andy-goryachev-oracle
Copy link
Contributor

We have other tests which use @RunWith(Parameterized.class) just fine (for example, SkinMemoryLeakTest). Is this about mixing junit4 and junit5 classes?

Do we need to make changes in other tests?

@nlisker
Copy link
Collaborator

nlisker commented Nov 7, 2022

It could be a good idea in a follow-up PR to move the version numbers to a constant so that we don't need to update each separately, like the Junit "5.8.1" version.

@arapte
Copy link
Member Author

arapte commented Nov 7, 2022

We have other tests which use @RunWith(Parameterized.class) just fine (for example, SkinMemoryLeakTest). Is this about mixing junit4 and junit5 classes?

It is not about mixing. The JUnit5 test added in PR #910 which uses annotations from org.junit.jupiter.params failed to compile on my local machine throwing following errors:

error: package org.junit.jupiter.params does not exist
error: package org.junit.jupiter.params.provider does not exist
error: cannot find symbol @ValueSource
error: cannot find symbol @ParameterizedTest 

This PR fixes that compilation error.
I am not sure how it worked on GHA.

Do we need to make changes in other tests?

It won't need any changes in existing tests.

Copy link
Member

@kevinrushforth kevinrushforth left a comment

Choose a reason for hiding this comment

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

The test looks good. I left a couple minor comments.

Copy link
Contributor

@andy-goryachev-oracle andy-goryachev-oracle left a comment

Choose a reason for hiding this comment

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

thank you for clarifications.

@openjdk openjdk bot added the ready Ready to be integrated label Nov 7, 2022
@kevinrushforth
Copy link
Member

kevinrushforth commented Nov 7, 2022

We have other tests which use @RunWith(Parameterized.class) just fine (for example, SkinMemoryLeakTest). Is this about mixing junit4 and junit5 classes?

Do we need to make changes in other tests?

No, this bug is about specific APIs that are part of the junit-jupiter-params jar file. Specifically, the ValueSource and ParameterizedTest annotations not being available at compile time in all cases. It works accidentally without the build.gradle fix for open builds (e.g., GHA) and fails in our CI build without this change.

@kevinrushforth
Copy link
Member

It could be a good idea in a follow-up PR to move the version numbers to a constant so that we don't need to update each separately, like the Junit "5.8.1" version.

Yes, this is a good idea. @arapte can you file a follow-on issue?

@openjdk openjdk bot removed the ready Ready to be integrated label Nov 7, 2022
@openjdk openjdk bot added the ready Ready to be integrated label Nov 7, 2022
@arapte
Copy link
Member Author

arapte commented Nov 8, 2022

/integrate

@openjdk
Copy link

openjdk bot commented Nov 8, 2022

Going to push as commit b08f135.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 8, 2022
@openjdk openjdk bot closed this Nov 8, 2022
@openjdk openjdk bot removed ready Ready to be integrated rfr Ready for review labels Nov 8, 2022
@openjdk
Copy link

openjdk bot commented Nov 8, 2022

@arapte Pushed as commit b08f135.

馃挕 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@arapte arapte deleted the junit5-test-compilation branch February 2, 2023 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated
4 participants