Currently, I'm getting Unresolved reference: spek
and Unresolved reference: test
with 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"
}
}
However, when I switch them with compile / runtime
, I can run the tests successfully!
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
.
To fix this, I moved my tests out, so Source Folder
will not overlap with Tests Source Folder
.