I've some integration tests written in Scala sbt which uses Junit5. I want to run the tests within the suite in parallel, however unable to do so.
This is how my code looks like:
trait IntegrationTestBase extends AnyFunSpec with Matchers with OptionValues with Inside
with Inspectors with ScalaFutures with BeforeAndAfter with BeforeAndAfterAll with LazyLogging
@RunWith(classOf[JUnitRunner])
class TestClass extends IntegrationTestBase with ParallelTestExecution {
override protected def beforeAll(): Unit = {
super.beforeAll()
...
}
override protected def afterAll(): Unit = {
super.afterAll()
...
}
describe("Test Group 1") {
it("some test should pass") {
...
}
}
describe("Test Group 2") {
it("some different test should pass") {
...
}
}
}
Currently, Test Group 2 execution starts only after Test Group 1 is completed. I want the Test Group 1 and Test Group 2 to run in parallel. What am I missing here?
Tried adding this configuration in sbt file - Test / testForkedParallel := true
but no change in result.
Also tried to configure the parallel execution guide from junit5 by creating the junit-platform.properties
with configuration:
junit.jupiter.execution.parallel.enabled = true
junit.jupiter.execution.parallel.mode.default = concurrent
junit.jupiter.execution.parallel.mode.classes.default = concurrent
junit.jupiter.execution.parallel.config.strategy = fixed
junit.jupiter.execution.parallel.config.fixed.parallelism = 6
But this didn't work as well.