Package-level declarations

Types

Link copied to clipboard
data class TestCase<T>(val data: T, val retry: Int)

Represents a test case with associated data and retry attempt information.

Link copied to clipboard
sealed interface TestExecutionResult<T>

The result of a test execution. Can be TestFailure or TestSuccess.

Link copied to clipboard
data class TestFailure<T>(val testCase: TestCase<T>, val cause: Throwable, val duration: Duration) : TestExecutionResult<T>

Represents a failed test execution with the cause of failure.

Link copied to clipboard
data class TestSuccess<T>(val testCase: TestCase<T>, val duration: Duration) : TestExecutionResult<T>

Represents a successful test execution.

Properties

Link copied to clipboard

Defaults to 1 on all platforms except for JVM. On JVM retries are disabled as we use test-retry Gradle plugin instead.

Functions

Link copied to clipboard
expect inline fun TestResult.andThen(crossinline block: () -> Any): TestResult

Executes the provided block after the test. It is the only way to execute something after test on JS/WasmJS targets.

actual inline fun TestResult.andThen(crossinline block: () -> Any): TestResult
actual inline fun TestResult.andThen(block: () -> Any): TestResult
actual inline fun TestResult.andThen(crossinline block: () -> Any): TestResult
Link copied to clipboard
expect inline fun retryTest(retries: Int, crossinline test: (Int) -> TestResult): TestResult

Executes a test function with retry capabilities.

actual inline fun retryTest(retries: Int, crossinline test: (Int) -> TestResult): TestResult
actual inline fun retryTest(retries: Int, test: (Int) -> TestResult): TestResult
Link copied to clipboard
fun <T> runTestWithData(    testCases: Iterable<T>,     context: CoroutineContext = EmptyCoroutineContext,     timeout: Duration = 1.minutes,     retries: Int = 1,     afterEach: (TestExecutionResult<T>) -> Unit = {},     handleFailures: (List<TestFailure<T>>) -> Unit = ::defaultAggregatedError,     afterAll: () -> Unit = {},     test: suspend TestScope.(TestCase<T>) -> Unit): TestResult

Executes multiple test cases with retry capabilities and timeout control. Timeout is independent for each attempt in each test case.