I'm using the scalatest-maven-plugin latest 1.0 version, with source code here. Trying to run my suites in parallel and using the following configuration:
<build><plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>WDF TestSuite.txt</filereports>
<htmlreporters>${project.build.directory}/html/scalatest</htmlreporters>
<parallel>true</parallel>
</configuration>
<executions>
<execution>
<id>test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin></build>
leads to the following Maven build error:
[INFO]
[INFO] --- scalatest-maven-plugin:1.0:test (test) @ myproject ---
Exception in thread "ScalaTest-main" java.lang.IllegalArgumentException: ERROR: -c has been deprecated for a very long time and is no longer supported, to prepare for reusing it for a different purpos
e in the near future. Please change all uses of -c to -P.
at org.scalatest.tools.ArgsParser$.checkArgsForValidity(ArgsParser.scala:46)
at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:857)
at org.scalatest.tools.Runner$.main(Runner.scala:827)
at org.scalatest.tools.Runner.main(Runner.scala)
Basically the scalatest-maven-plugin is passing -c
to the scalatest CLI instead of the correct -P
.. or even better -P10
i.e. the number of threads to use.
How can I pass the -P10
to the scalatest process via Maven? I have tried setting it in the MAVEN_OPTS
environment variable or in the Maven CLI directly but it doesn't get picked up.
I have also tried configuring the scalatest-maven-plugin like this:
<configuration>
<argLine>-P10</argLine>
</configuration>
but this parameter is passed to the java process and not to the Scalatest so it fails too.
I created my own fork of the scalatest-maven-plugin, fixed the parallel issue and versioned it as 1.1-SNAPSHOT I had to also fix the build etc it was all broken. I included a directly downloadable compiled tarball version scalatest-maven-plugin_1.1-SNAPSHOT.tar.gz
Then to test it, forked my own version of a scala-maven-example that uses my own fork of the scalatest-maven-plugin and modified the scalatest sample code to display the Thread Id that loads each Suite and the Thread Id that executes the first test of each Suite. I also make the current thread sleep in each of those points for a random time up to 10s to see what's going on. All scalatest Suites are loaded by a single thread and executed in parallel if parallel is enabled.
This is the result using
<parallel>false</parallel>
:and this is the result using
<parallel>true</parallel>
and<parallelThreads>10</parallelThreads>
: