There are at least three test frameworks with specific Kotlin support, and I wonder which one to choose:
Spek - “A Kotlin Specification Framework for the JVM”
- Though Spek is not an official JetBrains project, it is hosted on the JetBrains GitHub account and has contributors from JetBrains.
- 814 GitHub stars
KotlinTest - “Kotlin test framework based on the excellent Scalatest”
- 471 GitHub stars
JUnit + HamKrest - “Hamcrest for Kotlin”
- While there is no Kotlin-specific version of JUnit itself, there is HamKrest.
- It appears to me that the Kotlin standard library is tested with JUnit.
- 142 GitHub stars (HamKrest)
All these options and also TestNG are approved of in the book Kotlin in Action.
So I wonder which of these frameworks I should pick for a new Kotlin project - Spek, KotlinTest or JUnit5 + HamKrest? I have experience with JUnit4 + Hamcrest in Java and I know Spek offers “BDD-style” tests. But I have no idea which of these frameworks is best/state-of-the-art, the most future-proof or the most “idiomatic” for Kotlin. Maybe the ideal framework even depends on the kind of test, e.g. unit test vs. end-to-end test?