RFR: 8328716: [TestBug] Screen capturing utility for failed tests
Andy Goryachev
angorya at openjdk.org
Mon Mar 31 16:48:23 UTC 2025
On Fri, 28 Mar 2025 21:31:45 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> tests/system/src/test/java/test/util/ScreenCaptureTestWatcher.java line 77:
>>
>>> 75: public void testFailed(ExtensionContext extensionContext, Throwable err) {
>>> 76: err.printStackTrace();
>>> 77: System.err.println(generateScreenshot("Screenshot:{", "}"));
>>
>> When does the `testFailed` method run? After a failing `@Test` method that throws the exception? What if there is more than one failing test? Ideally what we want is something that runs after all failing tests, but before the `@AfterEach` method.
>
> Or... maybe we really do want to take a screen dump for each failing test in a test class.
>
> Also, what happens if one of the lifecycle methods is the one that throws the error (e.g., `Before` `After`, etc)?
good question! A quick test indicates that `@BeforeAll` and `@AfterAll` are treated as the framework errors and not handled by the watcher, but the failures in `@Test`, `@BeforeEach`, and `@AfterEach` are sent to the test watcher.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1746#discussion_r2021388320
More information about the openjfx-dev
mailing list