IdlingCoroutineScope

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

Factory function for an IdlingCoroutineScope.

Samples

import dispatch.android.espresso.IdlingCoroutineScope
import dispatch.android.espresso.IdlingDispatcherProvider
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 = IdlingCoroutineScope()

scope.idlingDispatcherProvider.registerAllIdlingResources() 
   //sampleEnd
}
import dispatch.android.espresso.IdlingCoroutineScope
import dispatch.android.espresso.IdlingDispatcherProvider
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 = IdlingCoroutineScope(
  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