用kotlin spek和kluent运行测试
试图让科特林工作,但遇到一些问题。 我有最简单的测试:
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依赖:
org.jetbrains.kotlin kotlin-stdlib-jre8 ${kotlin.version} org.jetbrains.spek spek-api 1.1.2 pom org.jetbrains.spek spek-junit-platform-engine 1.1.2 test org.amshove.kluent kluent 1.24 test org.junit.platform junit-platform-runner 1.0.0-M5 test org.junit.jupiter junit-jupiter-api 5.0.0-M5 test
如果我现在运行测试,我只是得到Test framework quit unexpectedly
没有任何其他信息。
另外把代码放在github上,如果有人想检查链接可能会更容易
看起来你有一个缺失的依赖( 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'