Class RunUntilFailureRule
- java.lang.Object
-
- org.opendaylight.infrautils.testutils.RunUntilFailureRule
-
- All Implemented Interfaces:
org.junit.rules.TestRule
public class RunUntilFailureRule extends Object implements org.junit.rules.TestRule
JUnit Rule which allows to keep running tests indefinitely.This is useful to add locally, never commit, if you would like to keep running a "flaky" (sometimes passing, sometimes failing) test until it fails. Usage:
public static @ClassRule RunUntilFailureClassRule classRepeater = new RunUntilFailureClassRule(); public @Rule RunUntilFailureRule repeater = new RunUntilFailureRule(classRepeater); @Test ...
The two rules are necessary because a ClassRule alone cannot stop the test on a failure, and a normal Rule alone cannot keep running all @Test (it would indefinitely run only the first test). Alternatives to two rules would be to use a @RunWith with a custom TestRunner, or writing a test suite each time.
- Author:
- Michael Vorburger
-
-
Constructor Summary
Constructors Constructor Description RunUntilFailureRule(RunUntilFailureClassRule classRepeaterRule)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.junit.runners.model.Statement
apply(org.junit.runners.model.Statement statement, org.junit.runner.Description description)
-
-
-
Constructor Detail
-
RunUntilFailureRule
public RunUntilFailureRule(RunUntilFailureClassRule classRepeaterRule)
-
-