【发布时间】:2021-11-23 18:33:28
【问题描述】:
我在 kotest 中使用了 Funspec 测试风格,我得到了一个由框架自动注入的 coroutineScope,如下所示。
class MyTestSpec: FunSpec() {
init {
test("test event loop") {
mySuspendedFunction() // a coroutineScope is already injected by the test framework here
}
}
}
如何配置 Kotest 框架以在我的测试中使用 kotlinx.coroutines.test.TestCoroutineScope 的实例而不是 kotlinx.coroutines.CoroutineScope?还是有什么理由让这没有意义?
【问题讨论】:
标签: kotlin-coroutines kotlintest kotest