Dear colleagues:

What do you think of the following idea:




The Problem
===========

Automated headful tests might fail intermittently or on specific platform(s).  
After the fact, it's nearly impossible to understand why this happened.



Solution
========

Implement a JUnit5 TestWatcher which captures the primary screen pixels and 
dumps them as base64-encoded PNG images in stderr (or stdout).  The logs are 
typically preserved, so the screenshots can be analyzed after the fact.

As far as I know, there is no way to configure JUnit to apply this to each test 
using command line option, so each test needs to have the following annotation 
added:

@ExtendWith(ScreenCaptureTestWatcher.class)

For more details please see this ticket [0] and the draft PR [1].



Possible Issues
===============


  *   the size of the image can be quite large, for example retina mac 
increases the size of the log by approximately 4MB (for each image).
  *   a misconfiguration might cause every test to fail, resulting in very 
large logs



References
==========

[0] https://bugs.openjdk.org/browse/JDK-8328716

[1] https://github.com/openjdk/jfx/pull/1415




What do you think?

Cheerio,
-andy


Reply via email to