Package com.codeborne.selenide.junit5
Class ScreenShooterExtension
- java.lang.Object
-
- com.codeborne.selenide.junit5.ScreenShooterExtension
-
- All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterEachCallback,org.junit.jupiter.api.extension.BeforeEachCallback,org.junit.jupiter.api.extension.Extension
public class ScreenShooterExtension extends java.lang.Object implements org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.AfterEachCallbackUse this class to automatically take screenshots in case of ANY errors in tests (not only Selenide errors).How to use in Java:
@ExtendWith({ScreenShooterExtension.class})public class MyTest {...}How to use in Java (with customization):
public class MyTest {@RegisterExtensionstatic ScreenShooterExtension screenshotEmAll = new ScreenShooterExtension(true); ... }How to use in Kotlin:
@ExtendWith(ScreenShooterExtension::class)public class MyTest {...}How to use in Kotlin (with customization):
public class MyTest { companion object {@JvmField@RegisterExtensionval screenshotEmAll: ScreenShooterExtension = ScreenShooterExtension(true); } ... }- Since:
- 4.12.2
-
-
Constructor Summary
Constructors Constructor Description ScreenShooterExtension()ScreenShooterExtension(boolean captureSuccessfulTests)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidafterEach(org.junit.jupiter.api.extension.ExtensionContext context)voidbeforeEach(org.junit.jupiter.api.extension.ExtensionContext context)ScreenShooterExtensionto(java.lang.String folderWithScreenshots)One-liner to configure Configuration.reportsFolder property.
-
-
-
Method Detail
-
to
public ScreenShooterExtension to(java.lang.String folderWithScreenshots)
One-liner to configure Configuration.reportsFolder property.- Parameters:
folderWithScreenshots- Folder to put screenshots to- Returns:
- current extension instance
-
beforeEach
public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context)
- Specified by:
beforeEachin interfaceorg.junit.jupiter.api.extension.BeforeEachCallback
-
afterEach
public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context)
- Specified by:
afterEachin interfaceorg.junit.jupiter.api.extension.AfterEachCallback
-
-