目前,我得到了Unresolved reference: spek和Unresolved reference: test与testCompile / testRuntime
project(":core") {
apply plugin: "kotlin"
dependencies {
// ... other dependencies
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion"
testCompile "org.jetbrains.spek:spek-api:$spekVersion"
testRuntime "org.jetbrains.spek:spek-junit-platform-engine:$spekVersion"
testCompile "com.nhaarman:mockito-kotlin:$mockitoVersion"
testCompile "com.natpryce:hamkrest:$hamkrestVersion"
}
}但是,当我用compile / runtime切换它们时,我可以成功地运行测试!
这是我的测试:
package com.mysampleapp
import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.describe
import org.jetbrains.spek.api.dsl.it
import kotlin.test.assertEquals
class DummySpec : Spek({
describe("a dummy") {
it("contains a number") {
val dummy = Dummy(1)
assertEquals(1, dummy.number)
}
}
})有人能帮我调试一下吗?
谢谢
发布于 2018-03-28 23:45:45
我找到原因了。我的测试在我的Source Folder里。
为了解决这个问题,我将测试移出,这样Source Folder就不会与Tests Source Folder重叠。
https://stackoverflow.com/questions/49368490
复制相似问题