为什么这个Spek on action没有运行?

时间:2017-09-15 14:58:06

标签: android kotlin spek

当我运行此示例代码时,“on”操作中的所有代码都不会在Android Studio中运行。你知道为什么吗?缺少什么?

import org.jetbrains.spek.api.Spek  
import org.jetbrains.spek.api.dsl.describe  
import org.jetbrains.spek.api.dsl.given  
import org.jetbrains.spek.api.dsl.it 
import org.jetbrains.spek.api.dsl.on

@RunWith(JUnitPlatform::class) class SpekTest : Spek({
    val x = 2
    val y = 3

    given("x = $x and y = $y") {
        val sum = x + y

        on ("why does this not run?") {
            it("should be that x + y = 5") {
                assertEquals(5, sum)
            }

            it("should be that x - y = -1") {
                val subtract = x - y
                assertEquals(-111, subtract)
            }
        }

    } })

1 个答案:

答案 0 :(得分:0)

确保将规格版本更新为

testCompile group: 'org.jetbrains.spek', name: 'spek-api', version: '1.1.4'
testCompile group: 'org.jetbrains.spek', name: 'spek-junit-platform-engine', version: '1.1.4'