【发布时间】:2021-01-04 10:36:29
【问题描述】:
我正在尝试在 KMM 项目的 shared 模块中编写测试。在共享模块的 build.gradle.kts 文件中,我有以下内容:
sourceSets {
val commonMain by getting
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
//TODO: Hamcrest
//implementation("junit:junit:4.12")
//implementation("org.hamcrest:hamcrest-library:1.3")
//TODO: Mockk
//implementation("io.mockk:mockk:1.10.4")
}
}
//...
}
我也试过了:
implementation(kotlin("[library]"))
结果相同:IDE 不再识别测试,我无法运行它们。
【问题讨论】:
-
我认为 hamcrest 和 mockk ref 都不是 kotlin 多平台库。
-
天哪,我认为测试中的那些至少可以是标准的 kotlin 库,因为它们没有被部署......我在这里看到了同样的情况:stackoverflow.com/questions/58320492/… 谢谢!
标签: kotlin kotlin-multiplatform kotlin-multiplatform-mobile