- Loading...
...
OpenJFX contains many JUnit based unit tests that can be run using 'gradle test' as part of a build.
...
There are two primary locations to find the unit tests in the repository:
...
In the OpenJFX repository, the shims are any test class that does not reside in the test package.
It is best to keep these shim classes as simple as possible, retaining reserving as much of the test logic in the Unit test classes as possible. Sometimes however, it makes sense to add more than just an accessor method, adding utility routines that may be easier to write from within the protected package.In the OpenJFX repository, the shims are any test class that does not reside in the test package.
With modules, the shim classes must live in a package already referenced in the module-info for the class, even if the package is not public. The addExports option can be used to loosen module restrictions, but not expose a package that is not already listed.
...
The unit tests run with the application class loader, and not the extension class loader as the core classes are.
With modules, they usually are the unit tests run in the "unnamed" module by default (. OpenJFX does not create a "test" module containing the tests).
All unit tests must be:
Optional Tests with gradle toggles.
...
(mention @ignore ? unstable test pattern ?)
When creating a new unit test, think about some of the special cases listed above and talk to the team about any special needs.
Currently all of the Robot based tests are ing systemTests, and must live in the test.robot package.
There are times when a Unit test must be conditional or disabled. Here are some of the tricks for doing that.
@ignore(bug id) is used to disable a unit test on all platforms
Unstable tests can be toggled using the conditions from within the test:
assumeTrue(Boolean.getBoolean("unstable.test"));
Some tests are platform specific. These can be toggled with a line like this:
assumeTrue(PlatformUtil.isMac() || PlatformUtil.isWindows());Gradle configures the classpath for each of the test modules. This classpath includes
...
During the build test task, a an @argfile form of the test classpath is created for each of the modules. This can be used for reference or with manual command lines. An example of this file is: build/testing/classpath_graphics.txt.
...
In build.gradle, there is a toggle that can be used to create additional output on the command lines used to launch tests. This currently affects
GradleJUnitWorker.java and the system Sandbox tests. Modify this line (temporarily), and run tests with the gradle -info option. (The -info option to gradle enabled it to pass through stdout/stderr from the worker process).
systemProperties 'worker.debug': false
...