Hi guys, I want to know what is the difference bet...
# getting-started
k
Hi guys, I want to know what is the difference between
runBlocking
and
runTest
?
t
Based on the documentation,
runTest
does the same as
runBlocking
, but skips all
delay()
.
k
Thanks for guidance..
j
Also,
runTest
is multiplatform and can be used in Kotlin/JS tests
👍 1
Also, the test dispatcher allows you to control time, advance until all nested coroutines are idle, etc. A bunch of nice features you might need in tests
k
Okk thanks for gudiance
j
But be aware that skipping delays is not necessarily desirable, and may bite you if you interact with external systems, or code that use a "real" dispatcher with real time. For instance, you may notice that
withTimeout
instantly times out in those cases.
👍 1