JUnit repeat rule
Description
A simple JUnit repeat rule written in Java 5+ along with concurrency support.
Usage
For Maven, add the following dependency:
<dependency>
<groupId>com.github.cbismuth</groupId>
<artifactId>junit-repeat-rule</artifactId>
<version>1.1.2</version>
</dependency>
For Gradle, use:
compile 'com.github.cbismuth:junit-repeat-rule:1.1.2'
Add the RepeatRule
to your test class and annotate your test case with @Repeat
as shown below.
/** A test class containing a repeated test case. */
public class RepeatedTest {
/** The rule to enable test repetition. */
@Rule
public RepeatRule rule = new RepeatRule();
/** A repeated test case. */
@Test
@Repeat(times = 3, threads = 4)
public void testRepetition() {
// do something
}
}
Credits
Written by Christophe Bismuth, licensed under the The MIT License (MIT). Original design by Frank Appel. Thanks to Kisty for its contributions.