Skip to content

Using TestCoroutineDispatcher

Devrath edited this page Jul 3, 2021 · 16 revisions

What is TestCoroutineDispatcher

  • This is a type of co-routine dispatcher that is used to test the coroutines.
class TestCoroutineDispatcher : CoroutineDispatcher, Delay, DelayController
  • As seen above the testCoroutineDispatcher extends the classes coroutineDispatcher, delay, delayController.
  • It performs immediate and lazy execution of co-routines.
  • By default testCoroutineDispatcher is immediate meaning any tasks that are scheduled to run immediately is executed immediately
  • If there is a delay the virtual clock is advanced by the amount of delay involved.

Clone this wiki locally