Carlos Daniel, I’m wondering what the difference is between runBlocking and the MainCoroutineRule strategy. Both are outlined in the Android Testing Codelab, Unit Testing with Coroutines section.

Also, both appear to make the method run synchronously, whereas the MainCoroutineRule pauses and resumes the coroutine to control the flow.

Perhaps withrunBlocking the code runs synchronously by default, whereas with MainCoroutineRule, it runs synchronously with manual control. 🤔



Open Sourcer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store