kotest: Tests have huge delay, and "Default test timeout: 600000ms" shows

I’m trying Kotest for the first time (version 4.0.2). I created a new project in Android Studio 3.6.2, using Gradle 5.6.4. I added the basic example tests:

class MyTests : StringSpec({
    "length should return size of string" {
        "hello".length shouldBe 5
    }
    "startsWith should test for a prefix" {
        "world" should startWith("wor")
    }
})

I ran the tests, and they passed, but they took several seconds to run. The following was printed in the Android Studio ‘Run’ window:

~~~ 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
  - io.kotest.core.extensions.IgnoredSpecDiscoveryExtension
  - io.kotest.core.extensions.TagFilteredDiscoveryExtension

There is no exception message; just the above. I get the same output if I run gradlew test from the command line.

I tried both the JUnit 5 runner and the JUnit 4 runner, with the same results each time. I also tried Gradle 6.3, with the same results.

The following SO question seems to be the same issue:

https://stackoverflow.com/questions/60351366/kotest-freezes-after-migrating-to-4-0-0-beta1-on-testdebugunittest-task

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 55 (28 by maintainers)

Commits related to this issue

Most upvoted comments

I experience similar issue, although with non-Android, plain Kotlin/JVM project. From running the test task to executing first test it takes around 12 seconds, where it takes 6 seconds before it starts executing spec and then another 6 seconds before running the first test in the spec. The last number is surely affected by starting a Postgres container using TestContainers. I experience the problem with Kotest 4.0.2 and it is still there after upgrading to Kotest 4.1.1.

OS: Windows 10 x64 JVM: 14 Gradle: 6.3 Kotlin: 1.3.71 Kotest: 4.1.1

Here is a recording from test run: kotest-slow-init

You can also see I set KOTEST_DEBUG env var, but I don’t see any additional output. I tried the same in IntelliJ also without result. Any ideas how can I gather more details on the problem?