scalatest / scalatestplus-junit5

Apache License 2.0
4 stars 4 forks source link

Parallel suites/tests execution #13

Open SheliakLyr opened 6 months ago

SheliakLyr commented 6 months ago

Scalatest can run suites and individual tests in multiple threads.

Is it possible to achieve that using this integration?

cheeseng commented 4 months ago

@SheliakLyr Sorry for replying late, for some reason I just notice this message. If you are referring to the JUnit5 test engine implementation, then I think there's more a question for JUnit 5 runner, e.g. you may try https://www.baeldung.com/junit-5-parallel-tests . Afaik JUnit5 runner will call into ScalaTestEngine to execute JUnit5 platform, and JUnit5 runner may do that in parallal manner.

I'll investigate if ParallelTestExecution will work correct with this integration.

cheeseng commented 4 months ago

Ok seeing from this line here:

https://github.com/scalatest/scalatestplus-junit5/blob/main/src/main/scala/org/scalatestplus/junit5/ScalaTestEngine.scala#L282

None is being passed as distributor, so the tests in ParallelTestExecution won't be run in parallel, I'll try to see if I can make it to pass in a distributor to support parallel execution.

cheeseng commented 4 months ago

@SheliakLyr Fyi I submitted the following PR to support ParallelTestExecution:

https://github.com/scalatest/scalatestplus-junit5/pull/18

SheliakLyr commented 3 months ago

Hi @cheeseng

Sorry for the late reply, I am still very interested about this topic.

Running test cases in a single suite concurrently would be great, but I currently cannot event run separate suites in parallel. I have tried the link you provided, but tests still run in a single-threaded mode. For completeness, I did check your PR, but nothing changes.

I suspect, that your assumption about junit runner is false:

JUnit5 runner may do that in parallal manner

I think that the article you linked refers to a different TestEngine (JupiterTestEngine), which does, in fact, support parallel execution. The property junit.jupiter.execution.parallel.enabled is defined in interface org.junit.jupiter.engine.config.JupiterConfiguration.

My reasearch suggests, that TestEngine implementations are responsible for the parallelization of the executed suites.

A kind-of related issue: https://github.com/junit-team/junit5/issues/2229