Package kotlinx.coroutines.test

Platform and version requirements: JVM

Obsolete and deprecated module to test coroutines. Replaced with kotlinx-coroutines-test module.

Types

TestCoroutineContext

class TestCoroutineContext : CoroutineContext

This CoroutineContext dispatcher can be used to simulate virtual time to speed up code, especially tests, that deal with delays and timeouts in Coroutines.

Functions

withTestContext

fun withTestContext(
    testContext: TestCoroutineContext = TestCoroutineContext(),
    testBody: TestCoroutineContext.() -> Unit
): Unit

Executes a block of code in which a unit-test can be written using the provided TestCoroutineContext. The provided TestCoroutineContext is available in the testBody as the this receiver.