I'd like to start some documentation on why Kotlin...
# kotlintest
s
I'd like to start some documentation on why KotlinTest is a better choice than JUnit
m
I think you need to be VERY specific here as to version of JUnit. As you'll see in my other comments, Kotlintest brings less to the table when compared to JUnit5.
But don't get me wrong, I really like Kotlintest too.
s
When you say it brings less to the table, as an overall package I don’t believe it does less.
Or do you mean the advantage of KT over JUnit5 is not as great as it is over junit4
m
The latter. i.e. Kotlintest and JUnit5 are very close to each other. Kotlintest has better assertions built-in so I see it as almost JUnit5+AssertJ == Kotlintest.
s
Yes JUnit5 is much much closer to KT than JUnit4, but JUnit4 is all but dead on the back end now
I still maintain that KT is a better choice than J5, even if J5 is still a good product in itself
m
I still see lots of mention of JUnit4, and many aren't aware of the huge benefits of migrating to JUnit5. For Kotlin projects, JUnit5 only has one advantage. If you work on projects that are Kotlin, and projects that are Java, or migrating from Java, then sticking with JUnit5 reduces the learning curve.
But for a new project that's adopting Kotlin, then I lean towards Kotlintest too.
s
We introduced more annotations to mirror the ones in junit5 so it’s an easier migration curve
in fact changing a file over to kt should (in theory) be little more than extending the class and updating imports from org.junit.Annotation to io.kotlintest.Annotation
But I stress in theory
😁 1