9

I'm working on a scala project which use Maven to build and maven-surefire-plugin to run the tests written in scalatest.

The tests are like:

import org.scalatest.ParallelTestExecution

@RunWith(classOf[org.scalatest.junit.JUnitRunner])
class MyTest extends FunSuite with ParallelTestExecution {
   // some tests
}

From some questions, I know that if we give a -P argument to scalatest, it will run the tests in parallel.

But I'm not sure how to configure it with maven-surefire-plugin, I tried to add -P, but which causes the JVM unable to start:

<plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <argLine>-P</argLine>
    </configuration>
</plugin>

Is there any way to do it? If we can't do it with maven surefire plugin, is it possible to configure it just in tests?

Freewind
  • 193,756
  • 157
  • 432
  • 708

1 Answers1

0

If all of your tests are written with scalatest, you should be using the scalatest maven plugin rather than surefire. There's

doc: http://www.scalatest.org/user_guide/using_the_scalatest_maven_plugin

source: https://github.com/scalatest/scalatest-maven-plugin

Jeff Fairley
  • 8,071
  • 7
  • 46
  • 55
  • 4
    Note that if you do use the scalatest maven plugin then you can't use java testing in your code. If you have mixed java/scala project then using surefire and decorating with @RunWith is the only way I know of – Assaf Mendelson Apr 19 '17 at 14:26
  • @AssafMendelson To be more clear, you still can test Java but using scalatest. – angelcervera Feb 08 '22 at 13:06