0

目前,我正在Unresolved reference: spek接受:Unresolved reference: testtestCompile / 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,我可以成功运行测试!

这是我的 spek 测试:

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)
        }
    }
})

有人可以帮我调试吗?

谢谢

4

1 回答 1

0

我找到了原因。我的测试在我的Source Folder.

为了解决这个问题,我将测试移出,因此Source Folder不会与Tests Source Folder.

于 2018-03-28T23:45:45.497 回答