[英]How to run a single test in a context using kotest/kotlintest
I have the following test suite:我有以下测试套件:
class FooTest : FunSpec() {
init {
context("a context") {
test("first test") {
true shouldBe false
}
test("f:second test") {
true shouldBe true
}
}
}
}
I try to execute it in IntelliJ Idea.我尝试在 IntelliJ Idea 中执行它。 Unfortunately it executes both test in the suite.不幸的是,它在套件中执行了两个测试。 It works well if I don't nest the test in context()
.如果我不在context()
嵌套测试,它会很好地工作。
There is an IntelliJ plugin which provide features to run a single test and many more features.有一个IntelliJ 插件,它提供运行单个测试的功能和更多功能。
Using this plugin, if you click the run/play icon on line 3 (context) it will run the context + the nested tests.使用此插件,如果您单击第 3 行(上下文)上的运行/播放图标,它将运行上下文 + 嵌套测试。 If you click run on line 4 or line 8 it will run context + the test you clicked on.如果您在第 4 行或第 8 行单击运行,它将运行上下文 + 您单击的测试。 Focus does not work on nested tests as per the docs 根据文档,焦点不适用于嵌套测试
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.