https://kotlinlang.org logo
#coroutines
Title
# coroutines
s

spand

05/18/2018, 8:11 AM
Can I use coroutines to speed up unit tests of sleep/delay code versus a blocking approach ? If so are there any resources on this? The coroutines guide doesnt really mention anything.
l

louiscad

05/18/2018, 8:26 AM
@spand Make a
runBlocking
test method thats runs all the tests that can be parallelized concurrently
s

spand

05/18/2018, 8:30 AM
Say I have some code that sleeps / calls delay with 30 seconds. It would be nice if that could be sped up somehow
I have not used coroutines before but figured it might have some test tools for this case
d

dave08

05/18/2018, 10:47 AM
There's currently an open pull request for that
v

Vsevolod Tolstopyatov [JB]

05/18/2018, 10:49 AM
We have
TestCoroutineContext
in develop branch with artificial time which can be moved forward. Will be available in the next release. https://github.com/Kotlin/kotlinx.coroutines/pull/297/files
👏 1
🎉 4
d

dave08

05/18/2018, 10:52 AM
When is the next release planned for? It's been a while and alot of issues and pull requests are open... I'm sure it's not easy juggling all the different projects at JB, but this seems like one that's constantly increasing in popularity... 😃
s

spand

05/18/2018, 11:39 AM
Sweet. Looks like what I had in mind
s

streetsofboston

05/18/2018, 12:32 PM
I hope it can help you out. It works well for us for writing unit-test using coroutines.
s

spand

05/18/2018, 12:34 PM
Whats the easiest way to start using it atm ?
l

louiscad

05/18/2018, 1:05 PM
@spand Probably copy pasting into your project
2 Views