无论我为Maven +尽力而为使用了什么设置,在我的流程管理器中,我从未见过超过一个JVM。我有一台Windows 7电脑,有8个物理内核。我正在运行最新的Maven / Surefire / JUnit和JDK8 (32位)。
我试着把所有的测试分解成每个测试类的一个测试。(我读到JVM只产生于测试类,而不是测试方法。)不过,我在流程管理器中从未见过超过一个JVM。
理想情况下,我希望每个测试类并行运行单独的JVM -- 8(每个内核一个/不要反悔JVM)。
所需的Maven安全设置是什么?
以下几点对我不适用:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<includes>
<include>${default.test.suite}</include>
</includes>
<reuseForks>false</reuseForks>
<forkCount>1.0C</forkCount>
<parallel>classes</parallel>
<threadCount>1</threadCount>
<!--
<useUnlimitedThreads>true</useUnlimitedThreads>
<parallelOptimized>false</parallelOptimized>
-->
</configuration>
</plugin>(我尝试了reuseForks、forkCount、parallel、threadCount、useUnlimitedThreads和parallelOptimized的各种组合。)
发布于 2015-03-06 18:56:56
如果您使用的是JUnit,那么首先“并行”只适用于TestNG,其他一些属性也是如此,因此它们对您没有帮助/兴趣:
下面是在JUnit设置中对我们有用的内容(对于TestNG不太管用,就像刚刚在这里发布的:Running test in parallel with surefire and displaying them properly with the TestNG Jenkins plugin):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<reuseForks>false</reuseForks>
<forkCount>2.5C</forkCount>
</configuration>
</plugin>因此,我认为您需要增加您的forkCount (使用forkCount = 1.0,您不会得到并行的东西)。
作为参考,这里有一些关于并行运行测试时的小打印的更多信息(包括。forkCount解释和示例):
https://stackoverflow.com/questions/28784366
复制相似问题