UnconfinedIdlingCoroutineScope

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

Factory function for an UnconfinedIdlingCoroutineScope.

Samples

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

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