首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >“未解析引用:”使用testCompile的错误

“未解析引用:”使用testCompile的错误
EN

Stack Overflow用户
提问于 2018-03-19 17:00:17
回答 1查看 1.4K关注 0票数 0

目前,我得到了Unresolved reference: spekUnresolved reference: testtestCompile / testRuntime

代码语言:javascript
复制
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切换它们时,我可以成功地运行测试!

这是我的测试:

代码语言:javascript
复制
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)
        }
    }
})

有人能帮我调试一下吗?

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-03-28 23:45:45

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

为了解决这个问题,我将测试移出,这样Source Folder就不会与Tests Source Folder重叠。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49368490

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档