Maven + Surefire/Failsafe-forkMode ="perthread"是行不通的...解决方法? [英] Maven + Surefire/Failsafe - forkMode="perthread" is not working ... a workaround?

查看:153
本文介绍了Maven + Surefire/Failsafe-forkMode ="perthread"是行不通的...解决方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在开发基于嵌入式Infinispan数据网格集群的应用程序.在我们应用程序的目标环境中,数据网格的每个成员都将在独立的JVM中运行,并使用jgroup形成集群(实际上是由Infinispan完成).

We are developing an application based in an Embedded Infinispan Data-grid cluster. In the targeted environment of our application, each member of the data-grid will run in a independent JVM and using jgroup the cluster will be formed (this is done by Infinispan actually).

要对此数据网格进行一些自动化测试,我们正在使用maven-surefire-plugin(或maven-failsafe-plugin)和以下配置进行操作:

For do some automated testing over this data-grid we were working with maven-surefire-plugin (or maven-failsafe-plugin) with this configuration:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
      <forkMode>perthread</forkMode>
      <threadCount>4</threadCount>
    </configuration>
</plugin>

因为此配置应为每个测试用例类(使用4个并行过程)创建一个fork,所以我们创建了4个测试类,其中每个测试类将模拟一个集群成员.在每个测试用例类中,借助TestNG,我们将有多个线程并行运行测试方法:

Because this configuration should create a fork per each testcase class (using 4 parallel process) we create 4 test classes, where each one of them will simulate one cluster member. Inside each testcase class we will have several threads running in parallel the test methods thanks to TestNG like this:

@Test(threadPoolSize = 3, invocationCount = 2,  timeOut = 10000, testName="Test 1")
public void testSomething() throws Throwable { ... }

问题是maven-surefire-pluginforkMode="perthread"threadCount=4有问题:它不会为每个类创建一个fork,而是多次创建相同类的fork.因此,在我的场景中,它需要一个测试用例并并行运行4次!!!

The problem is that the maven-surefire-plugin forkMode="perthread" and threadCount=4 is buggy: It do not create one fork per class but a fork of the same class several times. So, in my scenario it takes one of the testcases and run it 4 times in parallel!!!

注意:请在此处中检查jira错误. 请投票!!!

NOTE: check the jira bug here. Please vote!!!!

有人知道解决方法吗?我们正在使用ant进行一些努力,但变得非常混乱.

Do someone knows a workaround for this? We are doing some efforts using ant but is getting very messy.

推荐答案

maven-surefire-plugin错误已解决,它将在2.13版中发布!

The maven-surefire-plugin bug was resolved and it will be released in the version 2.13!

有关更多信息,请查看吉拉机票: http://jira.codehaus.org/browse/SUREFIRE-869

Check the Jira ticket for more info: http://jira.codehaus.org/browse/SUREFIRE-869

这篇关于Maven + Surefire/Failsafe-forkMode ="perthread"是行不通的...解决方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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