Hi! I'm learning Kotlin, I came from Javascript/Py...
# getting-started
g
Hi! I'm learning Kotlin, I came from Javascript/Python and I'm focusing now in Kotlin in JVM to backend development. And now at my learning path, I'm learning how to create tests for my projects, should I start to learn JUnit or Spek? Both frameworks are very different. I appreciate Speak, using BDD, but I'm facing a little difficult to setup with IntelliJ. JUnit has a bigger community and the resources to learn look much better. What are you guys are using? Which one do you prefer? PS: I learn Kotlin because I'm moving to a new company and the squad I'm going to work use Kotlin.
d
I personally use JUnit.
p
We use JUnit for unit tests, integration tests and the BDD style “UAT” tests. I’d go with that, personally.
p
We use Spek. Regarding what you should learn, either works. The best is, of course, to use whatever your new team is using, but even if you make the “wrong” choice, most of those tools have a very shallow learning curve. Since you are moving from dynamically typed languages I would concentrate on figuring out how to deal with errors being found so much earlier now rather than on the test tools
t
Just to mix it up, we use Spock for ordinary testing and Serenity/Cucumber for BDD testing , written in Kotlin. I wouldn’t recommend this route unless you’re already familiar with Groovy
m
I'd suggest either JUnit Jupiter if you also want/have to do Java code, combined with AssertJ for assertions. Alternatively, I'd strongly suggest Kotest over Spek. Kotest is far ahead of Spek, has a very strong assertion library, and a very active team. Supports boh data-driven and property based tests. See #kotest (Used o be KotlinTest, but recently renamed to reduce confusion with standard library kotlin.test)
g
thanks guys. I talked with my future team and they are using JUnit, so I'm going to use it. But when I have free time I will use spek/kotest in my projects in the future