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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8339515: [TestBug] Convert web tests to JUnit 5 #1567

Closed
wants to merge 11 commits into from

Conversation

jaybhaskar
Copy link
Member

@jaybhaskar jaybhaskar commented Sep 15, 2024

Successfully converted web tests from JUnit 4 to JUnit 5, ensuring all tests are fully compliant with the JUnit 5 framework.


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-8339515: [TestBug] Convert web tests to JUnit 5 (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 1567

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 15, 2024

👋 Welcome back jbhaskar! 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
Copy link

openjdk bot commented Sep 15, 2024

@jaybhaskar 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:

8339515: [TestBug] Convert web tests to JUnit 5

Reviewed-by: mhanl, arapte

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 1 new commit pushed to the master branch:

  • 5993c09: 8339513: [TestBug] Convert fxml tests to JUnit 5

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this 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 rfr Ready for review label Sep 15, 2024
@mlbridge
Copy link

mlbridge bot commented Sep 15, 2024

Copy link
Member

@Maran23 Maran23 left a comment

Choose a reason for hiding this comment

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

There is one major issue with the parameterized test as far as I can see. Some minor style guide things, looks good otherwise!

@Maran23
Copy link
Member

Maran23 commented Sep 15, 2024

Also one note: The copyright year was not updated, but this could also be done by the script afterwards I guess.

@openjdk
Copy link

openjdk bot commented Sep 15, 2024

@jaybhaskar this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout testsprint
git fetch https://git.openjdk.org/jfx.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Sep 15, 2024
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Sep 16, 2024
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.

You need to revert the copyright year change, since you've mistakenly removed the start year.

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Sep 16, 2024
@andy-goryachev-oracle
Copy link
Contributor

looks like there is a merge conflict label added

@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Sep 16, 2024
Copy link
Member

@arapte arapte left a comment

Choose a reason for hiding this comment

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

Suggesting a few minor changes.

@kevinrushforth
Copy link
Member

Note to reviewers: The GHA build compiles the web tests, but doesn't run them. Someone will need to do an offline test run with this patch.

Copy link
Member

@arapte arapte left a comment

Choose a reason for hiding this comment

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

Providing a few comments, majority are related to correcting indentation correction.

  1. Only space changes: Some indentation changes only add or remove spaces. I would suggest to avoid these changes. Or add only if the existing formatting is very bad. But would recommend to avoid.
  2. Some indentations are bad, which needs correction for example having ); on a separate line.

=> I have not pointed out all the indentation corrections. Please do look at other similar changes too.

Another comment is regarding Parameterized test: modules/javafx.web/src/test/java/test/javafx/scene/web/SubresourceIntegrityTest.java
Looks like the test is not converted correctly. The parameters are never assigned to the member variables. Hence never tested. Please take a look at the specific comment on the test. (please check my reply to previous discussion)

Copy link
Member

@arapte arapte left a comment

Choose a reason for hiding this comment

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

LGTM

@openjdk openjdk bot added the ready Ready to be integrated label Sep 18, 2024
Copy link
Member

@Maran23 Maran23 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 now

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.

  • query for old imports produces 0 hits (good)
  • left some minor comments, one (assertArrayEquals) might need a code change

assertEquals("/foo", CookieShim.defaultPath(uri("http://hostname/foo/bar")));
assertEquals("/foo", CookieShim.defaultPath(uri("http://hostname/foo/bar?")));
assertEquals("/foo", CookieShim.defaultPath(uri("http://hostname/foo/bar?query")));
assertEquals("/foo", CookieShim.defaultPath(uri("http://hostname/foo/bar?query=push")));
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: just wanted to say these formatting changes are probably unnecessary, and there is an added value of being able to set a breakpoint on the CookieShim method that was lost.

having said that, the changes are ok.

int actualLength = (Integer) obj.getMember("length");
String message = String.format("File at %s: Expected length %d but got %d",
filePath, expectedLength, actualLength);
assertEquals(expectedLength, actualLength, message);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think all this new code can be replaced by assertArrayEquals

public void testcheckJSPeerTostring() {
final JSObject doc = (JSObject) executeScript("document");
loadContent("<h1></h1>");
submit(() -> {
getEngine().executeScript(doc.toString());
assertThrows(NullPointerException.class, () -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is not an equivalent change:
before, the tests expected NPE to come from any statement within the test body,
after, it only expects from line 695

I don't know where the NPE actually comes from (probably from execute, so in theory the test might still be correct)

(this comment applies to multiple places)

@@ -150,7 +152,9 @@ public void start() {
submit(obj::start);
// Try accessing the resultObject created in JavaFX Application Thread
// from someother thread. It should throw an exception.
obj.resultObject.toString();
assertThrows(IllegalStateException.class, () -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

on second thought, I think this and the previous changes, even though not technically equivalent, are perfectly fine, in the spirit of the test.

@jaybhaskar
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented Sep 19, 2024

Going to push as commit e81b676.
Since your change was applied there have been 3 commits pushed to the master branch:

  • 6d1dd29: 8211234: Open-source simple test programs for FX / Swing interop
  • f8a2005: 8211247: Open-source simple test programs for FX / SWT interop
  • 5993c09: 8339513: [TestBug] Convert fxml tests to JUnit 5

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Sep 19, 2024

@jaybhaskar Pushed as commit e81b676.

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

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
Development

Successfully merging this pull request may close these issues.

5 participants