MainIdlingCoroutineScope

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

Factory function for a MainIdlingCoroutineScope.

Samples

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

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