Maven Surefire:无法分叉并行测试执行 [英] Maven Surefire: Unable to fork parallel test execution

查看:212
本文介绍了Maven Surefire:无法分叉并行测试执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Maven surefire,我无法派生并行测试执行.也就是说,我的每个测试用例都可以在一个独立的JVM中运行,因此是派生的.另外,我希望我的测试用例可以并行运行.第一部分工作没有问题:我能够在自己的JVM中运行每个测试用例.第二部分对我来说仍然是一个挑战.我没有设法使测试用例的并行执行有效.这是我的插件声明的样子:

using Maven surefire, I'm unable to fork parallel test execution. That is, each of my test cases hs to run in a serapate JVM, hence the forking. In addition, I want my test cases to run in parallel. the first part is working without problem: I'm able to run each test case in its own JVM. the second part, however is still a challene for me. I haven't managed to get the paralle execution of test cases working. Here is how my plugin declaration look like:

    <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>

我尝试了方法和类,但没有看到任何并行化. 我的JUnit版本是4.7,如Depency声明所示:

I've tried both methods and classes but haven't see any parallelization. My JUnit version is 4.7 as shown by the depency declaration:

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.7</version>
        <scope>compile</scope>
    </dependency>            

任何帮助都非常有用.

古怪的人.

推荐答案

我认为您应该使用

I think that you are supposed to use the threadCount parameter when using the parallel mode:

  <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>

这篇关于Maven Surefire:无法分叉并行测试执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆