public class RunUntilFailureRule extends Object implements org.junit.rules.TestRule
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.
Constructor and Description |
---|
RunUntilFailureRule(RunUntilFailureClassRule classRepeaterRule) |
Modifier and Type | Method and Description |
---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement statement,
org.junit.runner.Description description) |
public RunUntilFailureRule(RunUntilFailureClassRule classRepeaterRule)
Copyright © 2019 OpenDaylight. All rights reserved.