Skip to content

Commit

Permalink
Merge pull request #34 from artsok/optional-cooldown
Browse files Browse the repository at this point in the history
fix readme
  • Loading branch information
artsok authored May 24, 2019
2 parents 693a411 + 81f4aac commit 6c4b349
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,34 @@ In order to include *rerunner-jupiter* in a Maven project, first add the followi
arguments("lemon", 2, Arrays.asList("x", "y"))
);
}


/**
* it's often caused by some infrastructure problems: network congestion, garbage collection etc.
* These problems usually pass after some time. Use suspend option
*/
@RepeatedIfExceptionsTest(repeats = 3, exceptions = IOException.class, suspend = 5000L)
void reRunTestWithSuspendOption() throws IOException {
throw new IOException("Exception in I/O operation");
}


/**
* Example with suspend option for Parameterized Test
* It matters, when you get some infrastructure problems and you want to run your tests through timeout.
*
* Set break to 5 seconds. If exception appeared for any arguments, repeating extension would runs tests with break.
* If one result failed and other passed, does not matter we would wait 5 seconds throught each arguments of the repeated tests.
*
*/
@DisplayName("Example of parameterized repeated with exception")
@ParameterizedRepeatedIfExceptionsTest(suspend = 5000L, minSuccess = 2, repeats = 3)
@ValueSource(strings = {"Hi", "Hello", "Bonjour", "Privet"})
void errorParameterizedTestWithSuspendOption(String argument) {
if (random.nextInt() % 2 == 0) {
throw new RuntimeException(argument);
}
}
```
More examples you can find [here].

Expand Down
2 changes: 1 addition & 1 deletion src/test/java/io/github/artsok/ReRunnerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ void errorParameterizedTestWithMultiArgMethodSource(String str, int num, List<St
* It matters, when you get some infrastructure problems and you want to run your tests through timeout.
*
* Set break to 5 seconds. If exception appeared for any arguments, repeating extension would runs tests with break.
* If one result failed and other passed, "все равно" we would wait 5 seconds throught each arguments of the repeated tests.
* If one result failed and other passed, does not matter we would wait 5 seconds throught each arguments of the repeated tests.
*
*/
@Disabled
Expand Down

0 comments on commit 6c4b349

Please sign in to comment.