IOIdlingCoroutineScope

fun IOIdlingCoroutineScope(job: Job = SupervisorJob(), dispatcherProvider: IdlingDispatcherProvider = IdlingDispatcherProvider()): IOIdlingCoroutineScope

Factory function for an IOIdlingCoroutineScope.

Samples

import dispatch.android.espresso.IOIdlingCoroutineScope
import dispatch.android.espresso.registerAllIdlingResources
import dispatch.internal.test.Sample4
import kotlinx.coroutines.Job
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
fun main() { 
   //sampleStart 
   val scope = IOIdlingCoroutineScope()

scope.idlingDispatcherProvider.registerAllIdlingResources() 
   //sampleEnd
}
import dispatch.android.espresso.IOIdlingCoroutineScope
import dispatch.android.espresso.registerAllIdlingResources
import dispatch.internal.test.Sample4
import kotlinx.coroutines.Job
import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
fun main() { 
   //sampleStart 
   val scope = IOIdlingCoroutineScope(
  job = Job(),
  dispatcherProvider = SomeCustomIdlingDispatcherProvider()
)

scope.idlingDispatcherProvider.registerAllIdlingResources() 
   //sampleEnd
}

See also

Parameters

job

optional The Job used in creation of the CoroutineContext. Uses SupervisorJob by default.

dispatcherProvider

The IdlingDispatcherProvider used in creation of the CoroutineContext. Uses the default IdlingDispatcherProvider factory by default.

Sources

Link copied to clipboard