RFR: 8367915: [TestBug] Add system property to ScreenCaptureTestWatcher
Jayathirth D V
jdv at openjdk.org
Thu Sep 18 13:50:02 UTC 2025
On Thu, 18 Sep 2025 12:17:05 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> tests/system/src/test/java/test/util/ScreenCaptureTestWatcher.java line 52:
>>
>>> 50:
>>> 51: @Override
>>> 52: public void testFailed(ExtensionContext extensionContext, Throwable err) {
>>
>> If i induce failure in `test.robot.javafx.scene.layout.RegionBackgroundFillUITest.basicFill_Radius4` and run it with `@ExtendWith(ScreenCaptureTestWatcher.class)` annotation on RegionBackgroundFillUITest class. I see that screen capture happens after the test window in closed.
>>
>> May be in such cases, its better to call `ScreenshotCapture.writeScreenshot()` directly before we throw AssertionError on failure?
>
> That would be one option; if we do this, we would need to move the property check to `writeScreenshot` (or provide a utility method for that purpose).
>
> Another option would be to modify the tests to which you plan to add `ScreenshotCapture` to not hide the stage in their `@AfterEach` method (perhaps moving it to `@BeforeEach` instead).
Thanks for the suggestion. Second option seems better, with some refactoring moving stage closing logic to `@BeforeEach` method works and it takes proper screen capture of test window also.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1910#discussion_r2359405174
More information about the openjfx-dev
mailing list