Package io.klib.swtbot.junit4
Class ScreenshotRule
java.lang.Object
org.junit.rules.TestWatcher
io.klib.swtbot.junit4.ScreenshotRule
- All Implemented Interfaces:
org.junit.rules.TestRule
public final class ScreenshotRule
extends org.junit.rules.TestWatcher
JUnit 4 failure screenshots without replacing the original test failure.
TestWatcher runs after ordinary teardown; retain UI or use
Screenshots.guard(String, Supplier, Screenshots.Action) for early evidence.-
Constructor Summary
ConstructorsConstructorDescriptionScreenshotRule(Supplier<Screenshots> screenshots, Supplier<org.eclipse.swt.widgets.Shell> shell) Creates a rule using application-owned screenshot support and shell. -
Method Summary
Methods inherited from class org.junit.rules.TestWatcher
apply, finished, skipped, skipped, starting, succeeded
-
Constructor Details
-
ScreenshotRule
public ScreenshotRule(Supplier<Screenshots> screenshots, Supplier<org.eclipse.swt.widgets.Shell> shell) Creates a rule using application-owned screenshot support and shell.- Parameters:
screenshots- non-null supplier evaluated during failure handling; null result skips captureshell- non-null shell supplier evaluated on the application UI thread- Throws:
NullPointerException- if either supplier is null
-
-
Method Details
-
failed
Captures a failed test after cleanup, attaching diagnostic errors as suppressed.- Overrides:
failedin classorg.junit.rules.TestWatcher- Parameters:
original- test failure, never replaced by capture errorsdescription- failed test identity used in the artifact label
-