试着和kotlin一起工作但遇到了一些问题。我有一个最简单的测试:
object TestSpec : Spek({
describe("A greeter") {
it("should fail") {
"hello" shouldEqual "somethingelse"
}
}
})但不起作用。我尝试了以下几种变体:
object TestSpec : Spek({
describe("A greeter") {
it("should fail") {
"hello" shouldEqual "somethingelse"
}
}
})这个测试是绿色的,显然是不应该的。
object TestSpec : Spek({
describe("A greeter") {
on("something") {
it("should fail") {
"hello" shouldEqual "hellosdf"
}
}
}
})这个测试甚至没有运行。当我执行时,我只会得到
测试框架意外退出
下列变化也是如此:
object TestSpec : Spek({
given("A greeter") {
on("something") {
it("should fail") {
"hello" shouldEqual "hellosdf"
}
}
}
})我的maven依赖关系:
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jre8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.spek</groupId>
<artifactId>spek-api</artifactId>
<version>1.1.2</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jetbrains.spek</groupId>
<artifactId>spek-junit-platform-engine</artifactId>
<version>1.1.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.amshove.kluent</groupId>
<artifactId>kluent</artifactId>
<version>1.24</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>1.0.0-M5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.0.0-M5</version>
<scope>test</scope>
</dependency>如果我现在运行测试,我只会得到没有任何其他信息的Test framework quit unexpectedly。
还将代码放在github上,如果有人想检查链接,可能会更容易
发布于 2017-07-11 16:41:09
似乎您缺少一个依赖项(http://spekframework.org/docs/latest/#setting-up-legacy)。检查一下你有没有这些:
org.jetbrains.spek:spek-api:1.1.2
org.jetbrains.spek:spek-junit-platform-engine:1.1.2
org.junit.platform:junit-platform-runner:1.0.0-M4
// this one too if you use IntelliJ
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.0.0-M4'https://stackoverflow.com/questions/45037238
复制相似问题