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

Kevin Rushforth kcr at openjdk.org
Fri Apr 4 21:55:09 UTC 2025


On Fri, 4 Apr 2025 21:15:37 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 with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 17 additional commits since the last revision:
> 
>  - review comments
>  - Merge remote-tracking branch 'origin/master' into 8328716.screenshots
>  - javadoc
>  - removed watchers
>  - cleanup
>  - screen capture
>  - data url
>  - testing: inject a failure
>  - review comments
>  - prefix
>  - ... and 7 more: https://git.openjdk.org/jfx/compare/30e49d53...8668ebb1

I'll do a quick re-test then approve.

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

PR Comment: https://git.openjdk.org/jfx/pull/1746#issuecomment-2779787527


More information about the openjfx-dev mailing list