I am using a Suite (Scalatest-version: 3.2.2) which has several TestSuites inside:
class SuiteMixedSequentialParallel
extends Stepwise(
new TestInParallel,
new TestSequentially
)
Now, I want, that all tests in TestInParallel should be executed in parallel, all tests in TestSequentially should be executed sequentially.
Therefore I extended TestInParallel from 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")
}
)
}
When I run sbt testOnly TestInParallel, all tests are executed in parallel.
But:
When I run sbt testOnly SuiteMixedSequentialParallel, all tests are executed sequentially.
Does anybody have a hint, how to achieve, that my tests in TestInParallel will run in parallel, when I run SuiteMixedSequentialParallel?
The suites TestInParallel and TestSequentially should still run sequentially. Just the tests in TestInParallel should run in parallel.