-
Enhancement
-
Resolution: Fixed
-
P4
-
jfx20
-
b16
Running "gradle test" will run all tests in all projects. Other options are to run all tests, a set of tests, or a single tests in one project. For example:
gradle :base:test // runs all tests in javafx.base
gradle :base:test --tests BooleanPropertyTest // runs the "BooleanPropertyTest" in javafx.base
If the test passes, then running it again will do nothing, because gradle considers the test to be "up to date".
This is surprising behavior, especially for UI toolkit tests where there might be many reasons to want to run the tests again, even if none of that tests "inputs" have changed.
The most common reason is to ensure that a test you are running is stable on the platform you are testing on. Other reasons might include a test that has randomness (which is generally undesirable, but there are some limited cases where it might be used).
I propose to change build.gradle such that the tests tasks are never considered "up to date" so they are run even if nothing has changed since you last ran them.
This change was proposed shortly after we switched our build to gradle nearly 10 years ago inJDK-8098173. At that time it was felt that the current default was fine and that developers could use "cleanTest" if they wanted to rerun them. I no longer think that gradle's default is a good choice.
it is too easy to forget cleanTest, and is always surprising when you do forget. I am not aware of any other test runner that doesn't run tests when you ask it to.
We could possibly add a flag to restore the current behavior, but I see little value in doing that, so I don't plan to qualify this change with a property.
gradle :base:test // runs all tests in javafx.base
gradle :base:test --tests BooleanPropertyTest // runs the "BooleanPropertyTest" in javafx.base
If the test passes, then running it again will do nothing, because gradle considers the test to be "up to date".
This is surprising behavior, especially for UI toolkit tests where there might be many reasons to want to run the tests again, even if none of that tests "inputs" have changed.
The most common reason is to ensure that a test you are running is stable on the platform you are testing on. Other reasons might include a test that has randomness (which is generally undesirable, but there are some limited cases where it might be used).
I propose to change build.gradle such that the tests tasks are never considered "up to date" so they are run even if nothing has changed since you last ran them.
This change was proposed shortly after we switched our build to gradle nearly 10 years ago in
it is too easy to forget cleanTest, and is always surprising when you do forget. I am not aware of any other test runner that doesn't run tests when you ask it to.
We could possibly add a flag to restore the current behavior, but I see little value in doing that, so I don't plan to qualify this change with a property.
- relates to
-
JDK-8098173 gradle: provide option to always run tests (force up-to-date = false)
- Closed