如何与maven surefire插件并行运行scalatest?

时间:2015-09-22 07:47:58

标签: maven scalatest maven-surefire-plugin parallel-testing

我正在使用一个scala项目,该项目使用Maven构建并maven-surefire-plugin运行以scalatest编写的测试。

测试如下:

import org.scalatest.ParallelTestExecution

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

从一些问题来看,我知道如果我们给scalatest一个-P参数,它将并行运行测试。

但我不确定如何使用maven-surefire-plugin配置它,我尝试添加-P,但这会导致JVM无法启动:

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

有什么办法吗?如果我们无法使用maven surefire插件,是否可以在测试中配置它?

1 个答案:

答案 0 :(得分:0)

如果你的所有测试都是使用scalatest编写的,那么你应该使用scalatest maven插件而不是surefire。有

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

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

相关问题