https://kotlinlang.org logo
Title
c

Cody Engel

03/14/2020, 6:25 PM
Hey everyone, I’m trying to run a sample test with kotest but it never gets past the
Extensions
step, when I stop the execution it ends saying
Test events were not received
. This is the sample test I’m trying to run…
class SimpleTest : FunSpec({
    test("just a simple test") {
        1 + 1 shouldBe 2
    }
})
Here’s the log output I see prior to cancelling the execution (it didn’t report any new progress for ~5 minutes).
Testing started at 1:21 PM ...
Starting Gradle Daemon...
Gradle Daemon started in 674 ms
> Task :cleanTest
> Task :compileKotlin UP-TO-DATE
> Task :compileJava NO-SOURCE
> Task :processResources NO-SOURCE
> Task :classes UP-TO-DATE
> Task :compileTestKotlin
> Task :compileTestJava NO-SOURCE
> Task :processTestResources NO-SOURCE
> Task :testClasses UP-TO-DATE
> Task :test
~~~ Kotest Configuration ~~~
-> Parallelism: 1 thread(s)
-> Default test timeout: 600000ms
-> Default test order: TestCaseOrder
-> Default isolation mode: IsolationMode
-> Global soft assertations: False
-> Write spec failure file: False
-> Fail on ignored tests: False
-> Spec execution order: LexicographicSpecExecutionOrder
-> Extensions
  - io.kotest.core.extensions.SystemPropertyTagExtension
  - io.kotest.core.extensions.RuntimeTagExtension
s

sam

03/14/2020, 7:27 PM
Did you enable junit5 in your gradle build ?
What version of kotest ?
l

LeoColman

03/14/2020, 8:02 PM
What version of Gradle?
c

Cody Engel

03/15/2020, 2:41 PM
I have
useJUnitPlatform
set in my gradle script. I’m using
4.0.0-BETA2
and my gradle version is
5.2.1
. This is the full build config, it’s for a project I put down for a few months and am coming back to so I’m going to update a few things (such as the kotlin version).
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
    kotlin("jvm") version "1.3.61"
}

group = "dev.engel.fakek"
version = "0.1-SNAPSHOT"

repositories {
    mavenCentral()
}

dependencies {
    implementation(kotlin("stdlib-jdk8"))
    implementation("com.github.javafaker:javafaker:1.0.2")

    testImplementation("io.kotest:kotest-runner-junit5-jvm:4.0.0-BETA2")
}

tasks.withType<KotlinCompile> {
    kotlinOptions.jvmTarget = "1.8"
}

tasks.withType<Test> {
    useJUnitPlatform()
}
Hmmm it looks like the readme and reference are out of sync. On the readme (which I was using) it suggests to use
-jvm
for the kotest dependency while the reference suggests dropping
-jvm
. When I remove the
-jvm
dependency the tests don’t run as they are unable to resolve the following dependencies:
import io.kotest.core.spec.style.FunSpec
import io.kotest.matchers.shouldBe