I'm currently using the assertions library, but no...
# kotest
I'm currently using the assertions library, but not the test framework. I used to use the older version of
, which looked like this:
fun <T> eventually(duration: Duration, f: () -> T): T = eventually(duration, Exception::class.java, f)
The current implementation looks like this:
suspend fun <T> eventually(duration: Duration, f: suspend () -> T): T
A couple questions around this: 1. In the past I've typically just sprinkled
into test coroutine-related functions. It looks like kotest's test framework puts everything being tested in a coroutine context via the
. Are there any design docs or articles on that? I'm curious about why that is. 2. For a project that's not using coroutines, are there any suggested idioms/examples on how to be able to cleanly use things like
in a junit 5 oriented test framework?
For point 1, I believe it's to make testing easier, without having to have runblocking everywhere. As it's very usual to use coroutines, the framework aims to solve this common issue
👍 1
A couple years ago when I first started using kotlintest, there were some IDE issues, like running single tests. I should take another look at the test framework...hoping a lot of the initial kinks are worked out by now.
In JUnit5 there is TestCoroutineContext from Jetbrains and of course runBlocking. KotlinTest was definitely lightyears behind Kotest as the team have had 18 months further development on the project.
🙏 1