public class RetryRule extends Object implements org.junit.rules.TestRule
Add the RetryRule to your test and annotate tests with RetryOnFailure.
public class YourTest {
@Rule
public RetryRule retryRule = new RetryRule();
@Test
@RetryOnFailure(times=1)
public void yourTest() {
// This will be retried 1 time (total runs 2) before failing the test.
throw new Exception("Failing test");
}
}
| Modifier and Type | Field and Description |
|---|---|
static org.slf4j.Logger |
LOG |
| Constructor and Description |
|---|
RetryRule() |
| Modifier and Type | Method and Description |
|---|---|
org.junit.runners.model.Statement |
apply(org.junit.runners.model.Statement statement,
org.junit.runner.Description description) |
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.