问题描述
我正在使用其中包含多个TestSuite的套件(Scalatest版本:3.2.2):
class SuiteMixedSequentialParallel
extends Stepwise(
new TestInParallel,new TestSequentially
)
现在,我希望TestInParallel
中的所有测试应并行执行,TestSequentially
中的所有测试应依次执行。
因此,我从TestInParallel
扩展了ParallelTestExecution
class TestInParallel extends AnyFunSuite with ParallelTestExecution {
(0 to 10).foreach(i =>
test(s"$i") {
Thread.sleep(500)
println(s"TestInParallel $i")
}
)
}
class TestSequentially extends AnyFunSuite {
(0 to 10).foreach(i =>
test(s"$i") {
Thread.sleep(200)
println(s"TestSequentially $i")
}
)
}
当我运行sbt testOnly TestInParallel
时,所有测试都是并行执行的。
但:
当我运行sbt testOnly SuiteMixedSequentialParallel
时,所有测试都按顺序执行。
有人暗示我如何在运行TestInParallel
时在SuiteMixedSequentialParallel
中进行测试吗?
套件TestInParallel
和TestSequentially
仍应顺序运行。只是TestInParallel
中的测试应该并行运行。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)