1

我已经io.kotlintest用新的io.kotest依赖替换了旧的并将它导入到所有的测试中。它们在单独运行时通过,但 gradle 任务gradlew test冻结在testDebugUnitTest任务上。

> Task :myAppModule:testDebugUnitTest
Gradle Test Executor 1 -> ~~~ Kotest Configuration ~~~

Gradle Test Executor 1 -> -> Parallelism: 1 thread(s)

Gradle Test Executor 1 -> -> Default test timeout: 600000ms

Gradle Test Executor 1 -> -> Default test order: TestCaseOrder

Gradle Test Executor 1 -> -> Default isolation mode: IsolationMode

Gradle Test Executor 1 -> -> Global soft assertations: False

Gradle Test Executor 1 -> -> Write spec failure file: False

Gradle Test Executor 1 -> -> Fail on ignored tests: False

Gradle Test Executor 1 -> -> Spec execution order:     LexicographicSpecExecutionOrder

Gradle Test Executor 1 -> -> Extensions

Gradle Test Executor 1 ->   - io.kotest.core.extensions.SystemPropertyTagExtension

Gradle Test Executor 1 ->   - io.kotest.core.extensions.RuntimeTagExtension

Gradle Test Executor 1 -> 

如果我test在调试模式下运行 gradle 任务,代码MessageHub会在 Gradle (v5.4.1) 库中的类上停止。所以它看起来像多线程问题(因为测试只在一个线程上运行)。

我创建了 cutsom ProjectComfig 对象:

package io.kotest.provided

import io.kotest.core.config.AbstractProjectConfig

object ProjectConfig : AbstractProjectConfig() {

    private var started: Long = 0

    override fun beforeAll() {
        started = System.currentTimeMillis()
    }

    override fun afterAll() {
        val time = System.currentTimeMillis() - started
        println("overall time [ms]: $time")
    }

    override val parallelism: Int = 4
 }

但是 gradle 任务仍然使用 1 个线程运行。/src/test/kotlin/io/kotest/provided我已经在模块目录中添加了这个包。

PS 我无法使用或创建kotest标签,因为我没有 1500 声望。:-(

4

0 回答 0