03/04/2019, 3:29 AM
Hello eveyone, I had a question with how to approach unit testing. Right now I am working on a small multiplatform library with 98% of the code in the common source set with the rest being some platform-specific implementations in jvm and native. I have all the unit tests in the common-test source-set but now I need some add some junit unit tests for code that will trigger coroutines. The recommendations online to handle coroutines in UT is to wrap them in runBlocking, but this is only available in native/JVM. Is there any other way to have my Unit Tests remain in the common package while also calling into coroutines?

Jurriaan Mous

03/04/2019, 6:10 AM
I use the workaround detailed in:


03/04/2019, 4:57 PM
Thanks @Jurriaan Mous, that looks like a good approach.