-
Notifications
You must be signed in to change notification settings - Fork 0
Using TestCoroutineDispatcher
Devrath edited this page Jul 3, 2021
·
16 revisions
- This is a type of co-routine dispatcher that is used to test the coroutines.
class TestCoroutineDispatcher : CoroutineDispatcher, Delay, DelayController- As seen above the
testCoroutineDispatcherextends the classescoroutineDispatcher,delay,delayController. - It performs immediate and lazy execution of co-routines.
- By default
testCoroutineDispatcheris 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.
- Using this mechanism mentioned above we can
swap dispatchersinuse caseand thetest casefor the correspondinguse case