CoroutineTimeout¶
data class CoroutineTimeout(val duration: Duration) : TestConfig.Element
Defines for how long nothing is allowed to happen before the test is automatically stopped.
Note that this only applies to nothing happening in the coroutine dispatcher managed by the Coroutines system: launch, launchInBackground, etc.
For example, this test never finishes, but will not be stopped by this timeout, because coroutines are still being executed:
Constructors¶
CoroutineTimeout¶
constructor(duration: Duration)
Types¶
Companion¶
object Companion : TestConfig.Key.Unique<CoroutineTimeout>
Properties¶
coroutineContext¶
The coroutine context configured for this test through the Context configuration.
Note that this is different from the coroutine context actually used to run tests; the value returned by this method contains the context declared in the config, whereas more elements are injected by the test machinery when the test actually starts.
duration¶
key¶
open override val key: CoroutineTimeout.Companion
The identifier for this test configuration element.
Functions¶
get¶
operator fun <E : TestConfig.Element> TestConfig.get(key: TestConfig.Key<E, TestConfig.Uniqueness.Unique>): E?
Finds the Element identified by key in the current TestConfig.
It's not possible for multiple elements to share a key marked with Uniqueness.Unique, so this function can never return multiple results. However, no elements may be identified by a key, in which case null is returned.
operator fun <E : TestConfig.Element> TestConfig.get(key: TestConfig.Key<E, TestConfig.Uniqueness.Multi>): List<E>
Finds the elements identified by key in the current TestConfig.
Keys marked with Uniqueness.Multi allow multiple elements of the same type, so this function returns a list. If no elements are found, the returned list is empty.
plus¶
operator fun TestConfig.plus(other: TestConfig): TestConfig
Combines two TestConfig instances.
The elements of other always override or combine with the elements with the same key from the receiver (depending on the Key.uniqueness).