Philipp Mayer
05/17/2021, 3:36 PMcommonMain
. I can't use kotlin.test.Test
.
I followed https://kotlinlang.org/docs/gradle.html#set-dependencies-on-test-libraries, which resulted in the following `build.gradle.kts`:
kotlin {
android()
jvm("desktop") {
compilations.all {
kotlinOptions.jvmTarget = "11"
}
}
sourceSets {
jvm {
testRuns["test"].executionTask.configure {
useJUnitPlatform()
}
}
...
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
implementation("io.kotest:kotest-assertions-core:${Versions.kotest}")
}
}
...
The project overall is pretty empty, as in there are only the basic build steps.
I looked up some other example repositories and also refreshed the dependencies, but it seems that I have missed something.
I would be more than happy if anyone has a heads up of what might be wrong. Thanks in advance!russhwolf
05/17/2021, 3:40 PMkotlin("test")
instead of kotlin("test-common")
Philipp Mayer
05/17/2021, 3:48 PMJavier
05/17/2021, 6:41 PMJavier
05/17/2021, 8:48 PMilya.gorbunov
05/17/2021, 10:01 PMJavier
05/17/2021, 10:06 PMPhilipp Mayer
05/18/2021, 7:08 AMval commonTest by getting {
dependencies {
implementation(kotlin("test"))
// implementation(kotlin("test-common"))
// implementation(kotlin("test-annotations-common"))
implementation(project(":backend"))
implementation("io.kotest:kotest-assertions-core:${Versions.kotest}")
}
}
If I import test-common
and test-annotations-common
I get the annotation, but can't run the test (I guess there is a missing gradle task?).
If I use kotlin("test")
I can't use the annotation (and ofc can't run the test therefore.
The deps seem to be there, but don't even include the @Test
annotation:
I already reinstalled/refreshed my gradle dependencies a few times, didn't solve it.
I could move from Kotlin 1.4.30 to 1.5 like @Javier proposed, but I was a little bit shy of that until now.Javier
05/18/2021, 7:24 AMJavier
05/18/2021, 7:25 AMJavier
05/18/2021, 7:25 AMJavier
05/18/2021, 7:25 AMPhilipp Mayer
05/18/2021, 7:45 AMimplementation(kotlin("test-multiplatform"))
it is!
Thanks for your patience, it finally runs.Javier
05/18/2021, 7:53 AMPhilipp Mayer
05/18/2021, 7:56 AMJavier
05/18/2021, 8:55 AMJavier
05/18/2021, 8:55 AM