JDK-8239822 : Intermittent unit test failures in RegionCSSTest
  • Type: Bug
  • Component: javafx
  • Sub-Component: controls
  • Affected Version: jfx15
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-02-22
  • Updated: 2020-11-24
  • Resolved: 2020-02-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
jfx11.0.10Fixed
Related Reports
Relates :  
Relates :  
Description
I am seeing intermittent unit test failures in test.javafx.scene.layout.RegionCSSTest, both in our nightly job and on my local Windows machine (although this is a platform-independent issue). When it fails, 78 of the tests in RegionCSSTest fail. I will attach the complete test log. Here is a sample of two of the failures:

test.javafx.scene.layout.RegionCSSTest > borderImageSourceIsNull FAILED
    java.lang.AssertionError: 
        at org.junit.Assert.fail(Assert.java:91)
        at org.junit.Assert.assertTrue(Assert.java:43)
        at org.junit.Assert.assertNull(Assert.java:549)
        at org.junit.Assert.assertNull(Assert.java:560)
        at test.javafx.scene.layout.RegionCSSTest.borderImageSourceIsNull(RegionCSSTest.java:3082)

test.javafx.scene.layout.RegionCSSTest > backgroundSize_auto_length FAILED
    java.lang.AssertionError: expected:<0.0> but was:<1.0>
        at org.junit.Assert.fail(Assert.java:91)
        at org.junit.Assert.failNotEquals(Assert.java:645)
        at org.junit.Assert.assertEquals(Assert.java:441)
        at org.junit.Assert.assertEquals(Assert.java:510)
        at test.javafx.scene.layout.RegionCSSTest.backgroundSize_auto_length(RegionCSSTest.java:1352)

...

23001 tests completed, 78 failed, 274 skipped

Comments
We might want to backport this to openjfx11, since I just ran into this in a nightly Jenkins test build of 11-dev/rt.
11-11-2020

Changeset: c3ee1a30 Author: Kevin Rushforth <kcr@openjdk.org> Date: 2020-02-25 14:01:57 +0000 URL: https://git.openjdk.java.net/jfx/commit/c3ee1a30
25-02-2020

This turns out to be a test bug in test.javafx.scene.CssStyleHelperTest, which was added as part of JDK-8237469. RegionCSSTest is a victim of this bug. Except for the systemTests project, all unit tests are run in the same JVM, so each test class must ensure that any modified global state is restored after the tests are run. The CssStyleHelperTest leaves a userAgentStyleSheet set, which is a global (per Application) attribute, so any subsequent tests will be run with that stylesheet set. If the last test that is run in CssStyleHelperTest sets a style sheet with "-fx-background" then it will cause assertion failures in 78 of the tests in RegionCSSTest. Note that the test classes are run in an unpredictable order, and within each test class, the test methods are run in an unpredictable order, which is why this failure is intermittent. I am able to reliably reproduce this bug if I edit CssStyleHelperTest and `@Ignore` all tests except testMovedNodeGetsCorrectPseudoClassState (which is a test that sets a user agent style sheet with an "-fx-background"), and then run the following command, which will execute CssStyleHelperTest and then RegionCSSTest: gradle --info :graphics:cleanTest :graphics:test --tests test.javafx.scene.CssStyleHelperTest --tests test.javafx.scene.layout.RegionCSSTest I have a fix that I will sent out for review shortly.
22-02-2020