Maven + Surefire/Failsafe - forkMode="perthread" is not working ... a workaround?
Asked Answered
F

1

2

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

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>

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 { ... }

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

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

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

Feints answered 19/6, 2012 at 9:23 Comment(3)
I found out the problem with the maven-surefire-plugin! Go to the jira bug in codehous to check the solution!Feints
You should post the answer and accept it, there's no point in leaving the question unanswered.Culbreth
I found the problem with the maven-surefire-plugin, that does not mean that I fix it (I'm not a commiter in the surefire project). For this reason I think that the workaround might be helpfulFeints
F
3

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

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

Feints answered 20/6, 2012 at 7:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.