CoroutinesTest

interface CoroutinesTest

An interface meant to be implemented by a Test Suite that uses Complex Concurrency via Coroutines. Example:

class MyClassTest : CoroutinesTest {

@Test
fun `some test`() = coroutinesTest {
// testing structured concurrency here!
}
}

It provides a CoroutinesTestRule and alternative dispatchers.

Author

Davide Farella

Functions

coroutinesTest
Link copied to clipboard
open fun coroutinesTest(context: CoroutineContext = dispatchers.Main, block: suspend TestCoroutineScope.() -> Unit)
Use this for ensure that the test block is running on the provided dispatcher and avoid errors like Job has not completed yet
equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
hashCode
Link copied to clipboard
open fun hashCode(): Int
toString
Link copied to clipboard
open fun toString(): String

Properties

compDispatcher
Link copied to clipboard
open val compDispatcher: CoroutineDispatcher
coroutinesRule
Link copied to clipboard
open val coroutinesRule: CoroutinesTestRule
dispatchers
Link copied to clipboard
open val dispatchers: DispatcherProvider
ioDispatcher
Link copied to clipboard
open val ioDispatcher: CoroutineDispatcher
mainDispatcher
Link copied to clipboard
open val mainDispatcher: CoroutineDispatcher