Package at.willhaben.willtest.rule
Class TestFailureAwareRule
- java.lang.Object
-
- at.willhaben.willtest.rule.TestFailureAwareRule
-
- All Implemented Interfaces:
org.junit.rules.TestRule
- Direct Known Subclasses:
AbstractSeleniumProvider,JavascriptAlert,LogContext,PageSource,ResourceHelper,ScreenshotRule,WebDriverLog
@Deprecated public class TestFailureAwareRule extends java.lang.Object implements org.junit.rules.TestRuleDeprecated.Similar toExternalResource, but gives possibility to do something in case of errors. Also if there is a test error, this class takes care, that errors from its implementations are added as suppressed exceptions to the test error to avoid loosing that original problem. If the test was successful, butafter(Description, Throwable)throws an error, then the test will fail.
-
-
Constructor Summary
Constructors Constructor Description TestFailureAwareRule()Deprecated.Just to make sure, that this class will not be instantiated, only its children
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected voidafter(org.junit.runner.Description description, java.lang.Throwable testFailure)Deprecated.Called after all tests always.org.junit.runners.model.Statementapply(org.junit.runners.model.Statement base, org.junit.runner.Description description)Deprecated.protected voidbefore(org.junit.runner.Description description)Deprecated.Can do something before a test.protected voidonError(org.junit.runner.Description description, java.lang.Throwable testFailure)Deprecated.Called if the test has thrown an error.
-
-
-
Method Detail
-
before
protected void before(org.junit.runner.Description description) throws java.lang.ThrowableDeprecated.Can do something before a test. By default it does nothing.- Parameters:
description- junit test description object- Throws:
java.lang.Throwable- any error from the test
-
after
protected void after(org.junit.runner.Description description, java.lang.Throwable testFailure) throws java.lang.ThrowableDeprecated.Called after all tests always. By default it does nothing.- Parameters:
description- junit test description objecttestFailure- in case of failed test it contains an exception. Otherwise null- Throws:
java.lang.Throwable- iftestFailureis null, it will fly, iftestFailureis not null, it will be added to that as suppressed exception. SeeThrowable.addSuppressed(Throwable)
-
onError
protected void onError(org.junit.runner.Description description, java.lang.Throwable testFailure) throws java.lang.ThrowableDeprecated.Called if the test has thrown an error. By default it does nothing.- Parameters:
description- junit test description objecttestFailure- any error from the test- Throws:
java.lang.Throwable- this will be added totestFailureas suppressed exception. SeeThrowable.addSuppressed(Throwable)
-
apply
public org.junit.runners.model.Statement apply(org.junit.runners.model.Statement base, org.junit.runner.Description description)Deprecated.- Specified by:
applyin interfaceorg.junit.rules.TestRule
-
-