Class TakeScreenshotOnError

java.lang.Object
com.onenetwork.platform.tools.test.ui.rule.TakeScreenshotOnError
All Implemented Interfaces:
org.junit.rules.MethodRule

public class TakeScreenshotOnError
extends java.lang.Object
implements org.junit.rules.MethodRule
JUnit Method Rule which will take screenshot whenever a test fails.
By default, Assumption violations are not considered test "failures", so no screenshot will be taken.
If you want to take screenshots on failed assumptions, construct this rule using:
{@code TakeScreenshotOnError.{@link #includingAssumptionViolations()};
Since:
20.0
  • Constructor Summary

    Constructors 
    Constructor Description
    TakeScreenshotOnError()  
  • Method Summary

    Modifier and Type Method Description
    org.junit.runners.model.Statement apply​(org.junit.runners.model.Statement base, org.junit.runners.model.FrameworkMethod method, java.lang.Object target)  
    static TakeScreenshotOnError includingAssumptionViolations()
    Creates a method rule which will take screenshot when assumption violated as well as when test fails.

    Methods inherited from class java.lang.Object

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

  • Method Details

    • includingAssumptionViolations

      public static TakeScreenshotOnError includingAssumptionViolations()
      Creates a method rule which will take screenshot when assumption violated as well as when test fails.
      Returns:
    • apply

      public org.junit.runners.model.Statement apply​(org.junit.runners.model.Statement base, org.junit.runners.model.FrameworkMethod method, java.lang.Object target)
      Specified by:
      apply in interface org.junit.rules.MethodRule
      See Also:
      MethodRule.apply(org.junit.runners.model.Statement, org.junit.runners.model.FrameworkMethod, java.lang.Object)