Contentious question... What should I be using for testing & why?
j
Contentious question... What should I be using for testing & why?
r
I use kotlin.test over JUnit 5 and it works fine for me
r
kotest has worked best for me so far.
Tests are objects registered by a method, which makes it very flexible and easy to generate tests programmatically. Active project, nice set of assertions.
j
What @randomcat said plus mockk
g
I found that unfortunately Junit 5 is only mature and complete solution. All test libraries for Kotlin which I checked have too strange api (language abuse all around) or too simplistic (kotlin.test, which has even less features then Junit 4) or just never left proof of concept stage. I had big hopes for Spek, but development of it very slow, many bugs and looks that it doesn't scale properly But maybe I will do one more attempt to find something (mostly for mpp, don't see for now reason to use something except Junit on JVM), or hope that one day it will be full featured library for testa by Kotlin team (Kotlin.test 2.0)