RepeatTest

annotation class RepeatTest(val times: Int = 2)

Annotates either a test class or a test method for total executions of 1 + times. This is extremely useful for checking if a test is flaky, but otherwise dangerous.

If this annotation is used in the same class and test methods, the annotation of the method takes precedence.

Example:

@RepeatTest(times = 1000)
class SampleTest() {

@RepeatTest(times = 10)
@Test
fun testSomething() {
// This test will be executed 10x or until it fails
}

@Test
fun testAnotherThing() {
// This test will be executed 1000x or until it fails,
// because of the class configuration
}
}

Properties

Link copied to clipboard
val times: Int = 2

The number of times a test should be executed. Minimum is 2