首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >为什么IntelliJ Kotest插件不能很好地工作?

为什么IntelliJ Kotest插件不能很好地工作?
EN

Stack Overflow用户
提问于 2020-12-18 06:27:54
回答 1查看 607关注 0票数 0

我已经为IntelliJ (2020.3)安装了Kotest插件(1.1.22-IC-2020.3)。它允许我为我的Kotlin类创建Kotest测试,但这些测试不能从测试类运行。

如果我创建了一个新的Kotest运行配置,我可以运行测试类,但是总是抛出这个异常:

代码语言:javascript
运行
复制
java.lang.NoClassDefFoundError: Could not initialize class io.kotest.core.test.TestResult
    at io.kotest.core.runtime.TestCaseExecutor.executeActiveTest(TestCaseExecutor.kt:127)
    at io.kotest.core.runtime.TestCaseExecutor$intercept$2.invokeSuspend(TestCaseExecutor.kt:75)
    at io.kotest.core.runtime.TestCaseExecutor$intercept$2.invoke(TestCaseExecutor.kt)
    at io.kotest.core.runtime.TestCaseExecutor.executeIfActive(TestCaseExecutor.kt:89)
    at io.kotest.core.runtime.TestCaseExecutor.intercept(TestCaseExecutor.kt:75)
    at io.kotest.core.runtime.TestCaseExecutor.execute(TestCaseExecutor.kt:56)
    at io.kotest.core.engine.SingleInstanceSpecRunner.runTest(SingleInstanceSpecRunner.kt:60)
    at io.kotest.core.engine.SingleInstanceSpecRunner$execute$2$invokeSuspend$$inlined$invoke$lambda$1.invokeSuspend(SingleInstanceSpecRunner.kt:70)
    at io.kotest.core.engine.SingleInstanceSpecRunner$execute$2$invokeSuspend$$inlined$invoke$lambda$1.invoke(SingleInstanceSpecRunner.kt)
    at io.kotest.core.engine.SpecRunner$runParallel$$inlined$map$lambda$1$1.invokeSuspend(SpecRunner.kt:51)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
    at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
    at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:79)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:54)
    at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:36)
    at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
    at io.kotest.core.engine.SpecRunner$runParallel$$inlined$map$lambda$1.run(SpecRunner.kt:50)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

测试类被编译,jar kotest-core-jvm-4.1.1.jar被包含为外部库。

有人能在这方面给点建议吗?

EN

回答 1

Stack Overflow用户

发布于 2020-12-18 23:35:28

根据docs的说法,你需要4.2或更高版本,而你使用的是4.1.1。我建议你使用4.3.2。

要使用intellij插件,您需要将kotest-framework-engine-jvm依赖项添加到构建中。如果您也在使用gradle支持(例如CI或在命令行运行),并且您已经添加了kotest-runner-junit5-jvm,那么这将传递地引入所需的依赖项。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65349223

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档