DefaultIdlingCoroutineScope
fun DefaultIdlingCoroutineScope(job: Job = SupervisorJob(), dispatcherProvider: IdlingDispatcherProvider = IdlingDispatcherProvider()): DefaultIdlingCoroutineScope
Content copied to clipboard
Factory function for a DefaultIdlingCoroutineScope.
Samples
import dispatch.android.espresso.DefaultIdlingCoroutineScope
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 = DefaultIdlingCoroutineScope()
scope.idlingDispatcherProvider.registerAllIdlingResources()
//sampleEnd
}
import dispatch.android.espresso.DefaultIdlingCoroutineScope
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 = DefaultIdlingCoroutineScope(
job = Job(),
dispatcherProvider = SomeCustomIdlingDispatcherProvider()
)
scope.idlingDispatcherProvider.registerAllIdlingResources()
//sampleEnd
}
See also
androidx.test.espresso.IdlingResource
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.