Package com.codeborne.selenide.junit
Class ScreenShooter
java.lang.Object
org.junit.rules.TestWatcher
com.codeborne.selenide.junit.ScreenShooter
- All Implemented Interfaces:
org.junit.rules.TestRule
@ParametersAreNonnullByDefault
public class ScreenShooter
extends org.junit.rules.TestWatcher
Usage:
@Rule public ScreenShooter makeScreenshotOnFailure = ScreenShooter.failedTests();or
@Rule public ScreenShooter makeScreenshotOnEveryTest = ScreenShooter.failedTests().succeededTests();or
@Rule public ScreenShooter makeScreenshotOnEveryTest = ScreenShooter.failedTests().to("test-results/img/");
Restrictions:
This rule can only take screenshots for "static" webdriver managed by Selenide.
It doesn't take screenshots for webdrivers created by your code, e.g. using new SelenideDriver()
.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
static ScreenShooter
protected void
finished
(org.junit.runner.Description description) protected void
starting
(org.junit.runner.Description test) protected void
succeeded
(org.junit.runner.Description test) One-liner to configure Configuration.reportsFolder propertyMethods inherited from class org.junit.rules.TestWatcher
apply, skipped, skipped
-
Field Details
-
captureSuccessfulTests
public boolean captureSuccessfulTests
-
-
Method Details
-
failedTests
-
succeededTests
-
starting
protected void starting(org.junit.runner.Description test) - Overrides:
starting
in classorg.junit.rules.TestWatcher
-
succeeded
protected void succeeded(org.junit.runner.Description test) - Overrides:
succeeded
in classorg.junit.rules.TestWatcher
-
failed
- Overrides:
failed
in classorg.junit.rules.TestWatcher
-
finished
protected void finished(org.junit.runner.Description description) - Overrides:
finished
in classorg.junit.rules.TestWatcher
-
to
One-liner to configure Configuration.reportsFolder property- Parameters:
folderWithScreenshots
- Folder to put screenshots to
-