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");
}
}
Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.