8

我正在开发一个使用 Maven 构建和maven-surefire-plugin运行用 scalatest 编写的测试的 scala 项目。

测试如下:

import org.scalatest.ParallelTestExecution

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

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

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

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

有什么办法吗?如果我们不能使用 maven surefire 插件来做到这一点,是否可以仅在测试中配置它?

4

1 回答 1

0

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

文档: http ://www.scalatest.org/user_guide/using_the_scalatest_maven_plugin

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

于 2016-12-07T21:39:31.613 回答