I wrote a failing Spek test because I made an incorrect assumption about execution order involving multiple coroutines and it
functions:
given("a test") {
runBlocking { print("a") }
it("block 1") {
runBlocking { print("b") }
}
runBlocking { print("c") }
it("block 2") {
runBlocking { print("d") }
}
}
I expected abcd
to be printed, but acbd
actually printed.
How should I write this test so that it both visually reads and executes in the intended order?