问题描述
考虑以下Suites
,其中包含几个嵌套的Suite
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
中的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
的{{1}}和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.
Selecting suites and tests记录nestedSuite1:
nestedSuite2:
- B
Run completed ...
,-s
和-i
运行者参数,如下所示
-t
将用于指定ScalaTest可以实例化的类 直接包含包含一个无参数公共构造函数的套件, 和-s
将用于选择所需的嵌套套件...-i
参数允许通过其(完整的)测试名称选择测试... 如果-t
或-t
之后的-s
,则仅适用于 确定套件。
请注意,我正在使用由-i
插入的Test/runMain org.scalatest.tools.Runner
,因为当前它与testOnly
批注一起not工作。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)