[英]maven-surefire-plugin doesn't run parallel tests
I have a project Serenity+Java+JUnit and I try to run my tests in parallel. 我有一个项目Serenity + Java + JUnit,我尝试并行运行我的测试。 I paste this into my pom and after
mvn integration-test
, it is still run in a chain :( What I have done wrong? 我将它粘贴到我的pom中并在
mvn integration-test
,它仍然在链中运行:(我做错了什么?
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<parallel>all</parallel>
<forkMode>perthread</forkMode>
<threadCount>4</threadCount>
</configuration>
</plugin>
Have resolved it by adding another plugin instead of surefire-plugin 通过添加另一个插件而不是surefire-plugin解决了它
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<forkCount>5</forkCount>
<reuseForks>true</reuseForks>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
<systemPropertyVariables>
<databaseSchema>MY_TEST_SCHEMA_5</databaseSchema>
</systemPropertyVariables>
<workingDirectory>FORK_DIRECTORY_5</workingDirectory>
</configuration>
</plugin>
Not really sure if what your answer suggests is correct. 不确定你的答案是否正确。 You have placed concurrency configuration in Maven Failsafe, a plugin which is responsible for safely terminating the test execution once an exception has occurred therein.
您已在Maven Failsafe中放置了并发配置,这是一个插件,负责在其中发生异常时安全地终止测试执行。 Although, as you claim it this has resolved your issue, it might impact your project in the long run.
虽然,正如您声称这已解决了您的问题,但从长远来看,它可能会影响您的项目。
According to Maven's website , the below code should be placed under Maven Surefire configuration. 根据Maven的网站 ,下面的代码应该放在Maven Surefire配置下。
<forkCount>5</forkCount>
<reuseForks>true</reuseForks>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
Having followed these guidelines, I was able to successfully run tests in parallel with only updating Surefire plugin. 遵循这些指导原则,我能够成功运行测试,只更新Surefire插件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.