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

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


On Fri, 4 Apr 2025 21:42:39 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> One thing that happened recently (in the past 10 years or so) is that JSON became a frequently used format for logs.  It's not perfect, but it's easy to parse.  With that, json-oriented log viewers came.
>> 
>> We don't have a consistent way to log data (or show data in `.toString()`).  A good log viewer can pretty print an object in the log file, decode a hex- or base-64 encoded string, or even run a query on a log file.
>> 
>> We are not ready for JSON logs, I admit, but this was the rationale behind the design of this class:
>> 
>> - a low-level method that returns byte[]
>> - a base-64 encoding method that allows for custom prefix/suffix to be able to do a data url or a json
>> - a convenience method to use in tests
>> 
>> Also, considering what you said about gradle and stderr, perhaps `writeScreenshot()` should always emit to stderr.
>
> Not a "good" log viewer, but to illustrate:
> 
> ![Screenshot 2025-04-04 at 14 41 54](https://github.com/user-attachments/assets/241fe4da-ae03-44bb-9766-30c86d5af94c)

> We are not ready for JSON logs, I admit, but this was the rationale behind the design of this class:
> 
> * a low-level method that returns byte[]
> * a base-64 encoding method that allows for custom prefix/suffix to be able to do a data url or a json
> * a convenience method to use in tests

Are you saying that in a JSON image, you wouldn't have the `""data:image/png;base64,"` prefix?

> Also, considering what you said about gradle and stderr, perhaps `writeScreenshot()` should always emit to stderr.

That seems reasonable. We can always add an overload that takes a PrintStream if needed later.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1746#discussion_r2029469689


More information about the openjfx-dev mailing list