Or normal annotated tests (with uses junit on the jvm):
Copy code
class Testing {
@kotlin.test.Test
fun testing() {
kotlin.test.assertEquals(1, 1)
}
}
hfhbd
07/05/2022, 3:06 PM
But yes, the docs should contain a sample š
r
reactormonk
07/05/2022, 3:08 PM
What do I need to add in terms of dependency for
import kotlin.test.*
to work?
h
hfhbd
07/05/2022, 3:08 PM
implementation(kotlin("test")) in commonTest or testImplementation(kotlin("test-junit")) on jvm only projects
k
Klitos Kyriacou
07/05/2022, 5:17 PM
This is a helpful guide, albeit a bit dated: https://resources.jetbrains.com/storage/products/kotlinconf2018/slides/4_Best%20Practices%20for%20Unit%20Testing%20in%20Kotlin.pdf
My current personal choices are:
⢠Framework: JUnit 5. Because it seems more mature than kotlin.test (for example, unless I'm mistaken, kotlin.test doesn't have parameterized tests yet)
⢠Mocking: MockK (when used in Kotlin, it's nicer than Mockito)
⢠Assertions: Kotest (although I may be persuaded by AssertK)
⢠Property-based testing: jqwik-kotlin