Class ScreenShotExtension

java.lang.Object
co.verisoft.fw.selenium.junit.extensions.ScreenShotExtension
All Implemented Interfaces:
org.junit.jupiter.api.extension.BeforeTestExecutionCallback, org.junit.jupiter.api.extension.Extension, org.junit.jupiter.api.extension.TestExecutionExceptionHandler

public class ScreenShotExtension extends Object implements org.junit.jupiter.api.extension.TestExecutionExceptionHandler, org.junit.jupiter.api.extension.BeforeTestExecutionCallback
  • Constructor Details

    • ScreenShotExtension

      public ScreenShotExtension()
  • Method Details

    • beforeTestExecution

      public void beforeTestExecution(org.junit.jupiter.api.extension.ExtensionContext context)
      Initializes the screenshot storage by creating a new HashMap and storing it in the local thread store, allowing for screenshot capture during test execution.
      Specified by:
      beforeTestExecution in interface org.junit.jupiter.api.extension.BeforeTestExecutionCallback
      Parameters:
      context -
    • handleTestExecutionException

      public void handleTestExecutionException(org.junit.jupiter.api.extension.ExtensionContext extensionContext, Throwable throwable) throws Throwable
      If test has failed, take a screenshot and put it in the store
      Specified by:
      handleTestExecutionException in interface org.junit.jupiter.api.extension.TestExecutionExceptionHandler
      Parameters:
      extensionContext -
      throwable -
      Throws:
      Throwable