scala - 从嵌套套件运行特定测试
问题描述
考虑以下Suites
包含几个嵌套Suite
s
package example
import org.scalatest.{DoNotDiscover, Suites}
import org.scalatest.funsuite.AnyFunSuite
@DoNotDiscover
class NestedSuite1 extends AnyFunSuite {
test("A") {}
test("B") {}
}
@DoNotDiscover
class NestedSuite2 extends AnyFunSuite {
test("A") {}
test("B") {}
}
class ContainingSuite extends Suites(
new NestedSuite1,
new NestedSuite2
)
如何具体执行,比如B
测试NestedSuite2
via ContainingSuite
?注意我不是说
Test/runMain org.scalatest.tools.Runner -o -s example.NestedSuite2 -t B
因为那绕过了ContainingSuite
。相反,我追求的是
Test/runMain org.scalatest.tools.Runner -o -s example.ContainingSuite -i example.NestedSuite2 -t B
然而,它同时执行A
和B
的NestedSuite2
sbt:scalatest-seed-3.2.0> Test/runMain org.scalatest.tools.Runner -o -s example.ContainingSuite -i example.NestedSuite2 -t B
[info] running org.scalatest.tools.Runner -o -s example.ContainingSuite -i example.NestedSuite2 -t B
Run starting. Expected test count is: 2
NestedSuite1:
NestedSuite2:
- A
- B
Run completed in 72 milliseconds.
Total number of tests run: 2
Suites: completed 3, aborted 0
Tests: succeeded 2, failed 0, canceled 0, ignored 0, pending 0
All tests passed.
与类似的预期输出相反
NestedSuite1:
NestedSuite2:
- B
Run completed ...
选择套件和测试记录-s
,-i
和-t
runner 参数如下
-s
将用于指定 ScalaTest 可以直接实例化的类,包含具有公共、无参数构造函数的套件,-i
并将用于选择所需的嵌套套件...该-t
参数允许通过其选择测试(完整) 测试名称...如果 a-t
跟在-s
或-i
之后,则它仅适用于标识的套件。
注意我使用的是Test/runMain org.scalatest.tools.Runner
insted of,testOnly
因为目前它不适用于注释DoNotDiscover
。
解决方案
推荐阅读
- python - 加载先前训练的模型时奇怪的损失波动
- r - 在 R 中为每组添加缺失的行
- python - 在python中动态生成URL
- javascript - 从对象数组创建选项元素
- ios - 持久存储协调器核心数据错误:NSSQLiteErrorDomain = 522
- angular - Angular FormArray 绑定错误:找不到带有路径的控件:'addressess -> 0 -> street'
- google-cloud-platform - 使用 gcsfuse --implicit-dirs 从 VM 挂载的 Google 云存储桶的高延迟
- swagger - Swagger 在请求正文中显示额外的参数
- javascript - 使用本机 JS 将日期从毫秒格式化为以下格式:DD/MM/YYYY hh:mm:ss (US time locale)
- bixby - 如何在 bixby 中将价值从一个意图传递到另一个意图