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.
maven-surefire-plugin
! Go to the jira bug in codehous to check the solution! – Feints