Gre*_*ire 8 maven-2 fork surefire parallel-testing
使用Maven surefire,我无法分叉并行测试执行.也就是说,我的每个测试用例都要在serapate JVM中运行,因此就是分叉.另外,我希望我的测试用例并行运行.第一部分工作没有问题:我能够在自己的JVM中运行每个测试用例.第二部分,对我来说仍然是一个挑战.我还没有设法让测试用例的并行执行工作.以下是我的插件声明的样子:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<parallel>methods</parallel>
<forkMode>always</forkMode>
<argLine>-Xms512m -Xmx512m</argLine>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我已经尝试了两种方法和类,但没有看到任何并行化.我的JUnit版本是4.7,如依赖性声明所示:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>compile</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
任何帮助都会得到很多批评.
格雷瓜尔.
我认为你应该threadCount在使用parallel模式时使用参数:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<forkMode>always</forkMode>
<argLine>-Xms512m -Xmx512m</argLine>
<parallel>methods</parallel>
<threadCount>4</threadCount>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)