Having a bit of an issue with using Spek 2 with the Gradle Kotlin DSL. When I right click on my tests folder and hit run all tests
I get this error: WARNING: TestEngine with ID 'spek2' failed to discover tests
. Am I doing the build script incorrectly? This is within a subproject.
//subproject build.gradle.kts
plugins {
kotlin("jvm")
java
}
dependencies {
testImplementation(kotlin("reflect", Vof.kotlin))
testImplementation(kotlin("test", Vof.kotlin))
testImplementation(group = "org.spekframework.spek2", name = "spek-dsl-jvm", version = Vof.spek) {
exclude(group = "org.jetbrains.kotlin")
}
testRuntimeOnly(group = "org.spekframework.spek2", name = "spek-runner-junit5", version = Vof.spek) {
exclude(group = "org.jetbrains.kotlin")
exclude(group = "org.junit.platform")
}
testRuntimeOnly("org.junit.platform:junit-platform-launcher:${Vof.junitPlatform}")
testImplementation(gradleTestKit())
}
tasks {
named<Test>("test") {
useJUnitPlatform {
includeEngines("spek2")
}
}
}
I tried it using the format from the tutorial as well:
tasks {
test {
useJUnitPlatform {
includeEngines("spek2")
}
}
}
but it has the same error. Spek is not able to find the tests for some reason. Any ideas?
edit: here is the full stacktrace
Feb 24, 2019 9:41:07 PM org.junit.platform.launcher.core.DefaultLauncher handleThrowable
WARNING: TestEngine with ID 'spek2' failed to discover tests
java.lang.IllegalStateException: clz.java.`package` must not be null
at org.spekframework.spek2.runtime.scope.PathBuilder$Companion.from(Path.kt:86)
at org.spekframework.spek2.runtime.SpekRuntime.discover(SpekJvmRuntime.kt:30)
at org.spekframework.spek2.junit.SpekTestEngine.discover(SpekTestEngine.kt:76)
at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:177)
at org.junit.platform.launcher.core.DefaultLauncher.discoverRoot(DefaultLauncher.java:164)
at org.junit.platform.launcher.core.DefaultLauncher.discover(DefaultLauncher.java:120)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:52)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)