More on Testing Kotlin Coroutines
Learn about UnconfinedTestDispatcher, how to use mocks in testing, and the use of test functions that change a dispatcher.
We'll cover the following
UnconfinedTestDispatcher
Aside from StandardTestDispatcher
, we also have UnconfinedTestDispatcher
. The most significant difference is that StandardTestDispatcher
does not invoke any operations until we use its scheduler. The UnconfinedTestDispatcher
function immediately invokes all the operations before the first delay on started coroutines, which is why the code below prints “C.”
Get hands-on with 1200+ tech skills courses.