https://kotlinlang.org logo
s

surreal.analysis

09/03/2016, 3:58 AM
Running into a small tooling issue while trying out Kotlin. I have a very simple Spek file, but when I right click it in Intellij, no option to run the test comes up. I’ve confirmed the tests are run with
gradle test
. Spek File:
Copy code
import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.describe
import <http://org.jetbrains.spek.api.dsl.it|org.jetbrains.spek.api.dsl.it>
import kotlin.test.assertEquals

class SimpleSpec: Spek({
    describe("a calculator") {

        it("should return the result of adding the first number to the second number") {
            val sum = 2 + 4
            assertEquals(6, sum)
        }

        it("should return the result of subtracting the second number from the first number") {
            val subtract = 4 - 2
            assertEquals(2, subtract)
        }
    }
})
Minimum Gradle File (should have just the relevant bits)
Copy code
buildscript {
	repositories {
		mavenCentral()
	}
	dependencies {
		classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
                classpath("org.junit.platform:junit-platform-gradle-plugin:1.0.0-M2")
    }
}

apply plugin: 'org.junit.platform.gradle.plugin'

junitPlatform {
    engines {
        include 'spek'
    }
}

dependencies {
	compile('org.springframework.boot:spring-boot-starter-data-redis')
	compile('org.springframework.boot:spring-boot-starter-web')
	compile("org.jetbrains.kotlin:kotlin-stdlib:${kotlinVersion}")
	testCompile('org.springframework.boot:spring-boot-starter-test')
    testCompile "org.jetbrains.kotlin:kotlin-test:${kotlinVersion}"
    testCompile "org.jetbrains.kotlin:kotlin-test-junit:${kotlinVersion}"
    testCompile 'org.jetbrains.spek:spek-api:1.0.89'
	testRuntime 'org.jetbrains.spek:spek-junit-platform-engine:1.0.89'

}