I have a test case using _`runBlocking`_ that cal...
# getting-started
b
I have a test case using
runBlocking
that calls a
suspend fun
method. Prior to converting the method under test to using
suspend
it would run forever as I had a while(true) statement in it to sit there consuming Kafka messages indefinitely. My idea was to use _CoroutineScope_(Dispatchers.Default) and then a Job so I could expose that and run Job.cancel() when my test finished. But now I'm seeing my test case intermittently fail as the method I'm testing is halted prematurely. (With no call to Job.cancle())