Class ScreenshotAfterTestFailExtension

  • All Implemented Interfaces:
    org.junit.jupiter.api.extension.AfterTestExecutionCallback, org.junit.jupiter.api.extension.Extension

    public class ScreenshotAfterTestFailExtension
    extends java.lang.Object
    implements org.junit.jupiter.api.extension.AfterTestExecutionCallback
    ScreenshotAfterTestFailExtension takes screenshot immediately after test has failed and perform a clean up to ensure no dialog or windows is opened
    USAGE: Add the following annotation before every class with JUnit tests: @ExtendWith(ScreenshotAfterTestFailExtension.class)
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterTestExecution​(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
      Take screenshot right after a test has failed and perform a clean up to ensure no dialog or window is opened
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ScreenshotAfterTestFailExtension

        public ScreenshotAfterTestFailExtension()
    • Method Detail

      • afterTestExecution

        public void afterTestExecution​(org.junit.jupiter.api.extension.ExtensionContext extensionContext)
        Take screenshot right after a test has failed and perform a clean up to ensure no dialog or window is opened
        Specified by:
        afterTestExecution in interface org.junit.jupiter.api.extension.AfterTestExecutionCallback
        Parameters:
        extensionContext - test run data