-
Notifications
You must be signed in to change notification settings - Fork 555
8254013: gradle test should run all test classes even if they don't end with "Test" #329
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
Conversation
|
👋 Welcome back kcr! A progress list of the required criteria for merging this PR into |
arapte
left a comment
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.
Looks good to me, verified that tests in files which are not suffixed with Test get executed now.
buildSrc/build.gradle file also has the code that we are changing here,
scanForTestClasses = false
include "**/*Test.*"
I think it won't affect as there are no tests there.
|
@kevinrushforth 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: 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 7 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
|
/integrate |
|
@kevinrushforth Since your change was applied there have been 7 commits pushed to the
Your commit was automatically rebased without conflicts. Pushed as commit 4f1eb7d. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
The test targets in
build.gradleare set up to run only classes whose name ends with exactlyTest. A test class namedRunMyTest.javawill be run, but a test calledCheckSomething.javawill not be. This was done because gradle's built-in scanner for test classes was buggy in earlier versions of gradle. It seems to have been fixed in the gradle 3.x time frame from what I can tell.The current approach leads to two problems. The first is that gradle will try to execute all classes named
XxxxxTest.javawhether or not it should. Attempting to execute utility classes without test methods (meaning without at least one method annotated with@Test) orabstractclasses (whether or not there are any test methods) will fail.The second is that a test class that isn't named
XxxxxTest.javawill not be run, even if it contains@Testmethods. This can (and has) lead to tests being skipped when they should be run.The solution is to enable gradle's built-in scanning for test classes which works exactly like you would expect it to: it runs any concrete class that has at least one
@Testmethod or whose parent class has such a method. This means that a class with no test methods that subclasses an abstract class with@Testmethods will be run correctly.I ran a full test on all three platforms. The following test classes which were formerly not run are now run:
modules/javafx.base: test.javafx.collections.ObservableListWithExtractor : 52 tests
modules/javafx.base: test.javafx.event.EventSerializationEventExists 0 tests (*)
modules/javafx.controls:. test.javafx.scene.control.MiscellaneousTests : 3 tests
tests/system: test.com.sun.javafx.application.SwingNoExit : 1 test
They pass on all three platforms.
(*) - There is only one test in this class and it is currently
@IgnoredProgress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jfx pull/329/head:pull/329$ git checkout pull/329