[英]“Unresolved reference:” errors with testCompile
Currently, I'm getting Unresolved reference: spek
and Unresolved reference: test
with testCompile / testRuntime
: 当前,我得到了
Unresolved reference: spek
和Unresolved reference: test
使用testCompile / testRuntime
Unresolved reference: test
:
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"
}
}
However, when I switch them with compile / runtime
, I can run the tests successfully! 但是,当我使用
compile / runtime
切换它们compile / runtime
,我可以成功运行测试!
Here's my spek test: 这是我的尖锐测试:
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)
}
}
})
Could someone please help me to debug this? 有人可以帮我调试一下吗?
Thank you 谢谢
I found out the cause. 我找到了原因。 My tests are inside my
Source Folder
. 我的测试位于“
Source Folder
。
To fix this, I moved my tests out, so Source Folder
will not overlap with Tests Source Folder
. 为了解决这个问题,我将测试移开了,因此
Source Folder
将不会与Tests Source Folder
重叠。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.