wasyl
04/03/2020, 4:06 PM@Test fun someTest = testScope.runBlockingTest { }
. Is there some well-established pattern for running specs in a test scope? For example, do you wrap topmost test block, or maybe each smaller scope separately?
Would it make sense if Kotest facilitated (or maybe it does?) running tests with coroutines in a test scope, by allowing injecting it or providing. I don’t think there’s any configuration regarding that though, is there?sam
04/03/2020, 4:14 PMsam
04/03/2020, 4:14 PMtest("some test") {
delay(1000)
}
sam
04/03/2020, 4:15 PMtest("some test") {
delay(100)
launch(<http://Dispatchers.IO|Dispatchers.IO>) {
delay(200)
}
}
wasyl
04/03/2020, 4:17 PMtestCoroutineDispatcher
if I’m testing code that launches another coroutine inside — to check that all jobs complete etc. For example this intro video about corutines suggests running test on the same dispatcher that’s injected to the tested class:wasyl
04/03/2020, 4:17 PMwasyl
04/03/2020, 4:18 PMwasyl
04/03/2020, 4:18 PMtestDispatcher.runBlockingTest
will do some verifications regarding leaking/uncompleted coroutines/jobssam
04/03/2020, 4:21 PMwasyl
04/03/2020, 4:24 PMsam
04/03/2020, 4:28 PMsam
04/03/2020, 4:28 PM