RFR: 8328716: [TestBug] Screen capturing utility for failed tests [v8]

Kevin Rushforth kcr at openjdk.org
Fri Apr 4 22:11:58 UTC 2025


On Fri, 4 Apr 2025 21:55:09 GMT, Andy Goryachev <angorya 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.
>> 
>> The log contains a base-64 encoded screenshot (like this: `data:image/png;base64,iVBORw0KGgoAAAANSUhEU...` )
>> so it can be rendered in Safari (Chrome truncates the image possibly due to following a url length limit)
>> 
>> Additionally, provided a utility class to capture the screenshots at the specific point in a test and write it to stdout/stderr:
>> 
>> 
>> // write a base-64 encoded screenshot to stderr
>> ScreenshotCapture.writeScreenshot(System.err);
>> 
>> 
>> Example:
>> 
>> ![jenkins-screenshot](https://github.com/user-attachments/assets/abebd76f-747a-4d6d-a9a6-63c6e9426830)
>
> Andy Goryachev has updated the pull request incrementally with one additional commit since the last revision:
> 
>   stderr

LGTM with one very minor comment on a comment. I'll reapprove if you fix.

tests/system/src/test/java/test/util/ScreenCaptureTestWatcher.java line 45:

> 43:     @Override
> 44:     public void testFailed(ExtensionContext extensionContext, Throwable err) {
> 45:         // the data url can be pasted into Safari address bar to view the screenshot

Minor: "Safari" --> "a browser".

-------------

Marked as reviewed by kcr (Lead).

PR Review: https://git.openjdk.org/jfx/pull/1746#pullrequestreview-2744166071
PR Review Comment: https://git.openjdk.org/jfx/pull/1746#discussion_r2029475138


More information about the openjfx-dev mailing list