【发布时间】:2021-12-30 11:59:50
【问题描述】:
代码
我有以下三个测试:
import io.kotest.core.spec.style.BehaviorSpec
import io.kotest.matchers.shouldBe
class Example {
fun blah(number: Int): Int {
if (number == 1) {
throw IllegalArgumentException()
} else {
return number
}
}
}
class ExampleTest : BehaviorSpec({
Given("example") {
val example = Example()
When("calling blah(0)") {
val result = example.blah(0)
Then("it returns 0") {
result shouldBe 0
}
}
When("calling blah(1)") {
val result = example.blah(1)
Then("it returns 1") {
result shouldBe 1
}
}
When("calling blah(2)") {
val result = example.blah(2)
Then("it returns 2") {
result shouldBe 2
}
}
}
})
问题
中间测试抛出了一个意外的异常。我希望看到 3 个测试运行,其中 1 个失败,但 IntelliJ 和 Kotest 插件向我展示的是 2 个测试中有 2 个通过了。我可以在“测试结果”侧面板中看到有问题,但没有任何有用的信息。
如果我导航到带有测试结果的index.html,我可以正确查看所有内容。我想在 IntelliJ 中看到相同的数据。
截图
- 左侧缺少数字 1 的测试
- 在顶部显示“测试通过:2 个,共 2 个”
- 左侧有黄色叉号直到“Given”,但“Given”中的所有测试都是绿色的
其他信息
- Kotest 版本:4.6.3
- IntelliJ Kotest 插件版本:1.1.49-IC-2021.2.3
【问题讨论】:
-
kotest 的哪个版本
-
kotest 版本 4.6.3
标签: kotlin intellij-idea kotest