RFR: 8328716: [TestBug] Screen capturing utility for failed tests
Andy Goryachev
angorya at openjdk.org
Mon Mar 31 15:01:40 UTC 2025
On Fri, 28 Mar 2025 21:04:00 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> Introduce a facility, in the form of JUnit5 annotation, to allow for capturing a desktop screenshot of a failed test.
>>
>> The primary intent is to be able to debug an intermittent test case, rather than wholesale addition of the new annotation to all the tests.
>>
>> A possible improvement could be to output a data URL
>>
>> `data:image/png;base64,iVBORw0KGgoAAAANSUhEU...`
>>
>> so it can be rendered in Safari (Chrome truncates the image possibly due to following a url length limit)
>
> tests/system/src/test/java/test/util/ScreenCaptureTestWatcher.java line 47:
>
>> 45: * <p>
>> 46: * This facility takes a screenshot of any failed test, then logs the base64-encoded screenshot
>> 47: * to {@code stderr}.
>
> This should not be on by default, but should be "opt in" on a System property. I recommend defining a gradle property to do this and map it to that System property, much like we do for "UNSTABLE_TEST" and others.
The intent is not to annotate each test, but rather to use this tool to debug the issues in an intermittently failing test.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1746#discussion_r2021218682
More information about the openjfx-dev
mailing list