retryTest

expect inline fun retryTest(retries: Int, crossinline test: (Int) -> TestResult): TestResult

Executes a test function with retry capabilities.

retryTest(retires = 2) { retry ->
    runTest {
        println("This test passes only on second retry. Current retry is $retry")
        assertEquals(2, retry)
    }
}

Report a problem

Return

A TestResult representing the outcome of the test after all attempts.

Parameters

retries

The number of retries to attempt after an initial failure. Must be a non-negative integer.

test

A test to execute, which accepts the current retry attempt (starting at 0) as an argument.

actual inline fun retryTest(retries: Int, crossinline test: (Int) -> TestResult): TestResult
actual inline fun retryTest(retries: Int, test: (Int) -> TestResult): TestResult