Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8234110

SwingFXUtilsTest is unsuitable for unit test framework

XMLWordPrintable

      To reproduce this problem, make a copy of the existing SwingFXUtilsTest test class, which is in modules/javafx.swing/src/test/java/test/javafx/embed/swing, and run the swing tests as following:

      $ gradle -PFULL_TEST=true :swing:test

      One of the two will fail.

      This bug was discovered during the review of JDK-8200224. The problem with the existing SwingFXUtilsTest class is that gradle runs multiple tests in the same VM and in an undefined, and unpredictable, order. This means that tests need to take care not to alter or rely on global state such as threads, static fields, global JavaFX state, and the running (or lack thereof) of the JavaFX runtime. The swing tests violate this rule and are therefore inherently unstable. The only reason this hasn't been a problem up to now is that the javafx.swing module contains a single test class, SwingFXUtilsTest.

      As written, the test should be moved to the systemTests project, in the tests/system/src/test/java/test/javafx/embed/swing/ directory, which contains similar tests.

            kcr Kevin Rushforth
            kcr Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: