When running a suite in parallel, i sometimes get this error: "Received a completed event for test with unknown id"

When running my testNG suite in parallel (by tests), sometimes i get this error from the gradle:

Received a completed event for test with unknown id '1.13'. Registered test ids: '[1.1, 1.2, root]'
java.lang.IllegalArgumentException: Received a completed event for test with unknown id '1.13'. Registered test ids: '[1.1, 1.2, root]'
 at org.gradle.api.internal.tasks.testing.results.StateTrackingTestResultProcessor.completed(StateTrackingTestResultProcessor.java:48)
 at org.gradle.api.internal.tasks.testing.results.AttachParentTestResultProcessor.completed(AttachParentTestResultProcessor.java:52)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:606)
 at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
 at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
 at org.gradle.messaging.dispatch.FailureHandlingDispatch.dispatch(FailureHandlingDispatch.java:29)
 at org.gradle.messaging.dispatch.AsyncDispatch.dispatchMessages(AsyncDispatch.java:132)
 at org.gradle.messaging.dispatch.AsyncDispatch.access$000(AsyncDispatch.java:33)
 at org.gradle.messaging.dispatch.AsyncDispatch$1.run(AsyncDispatch.java:72)
 at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
 at java.lang.Thread.run(Thread.java:745)
Gradle Test Executor 1 finished executing tests.
:test FAILED

Strange thing is that it fails 2 out of 3 times. Sometimes is does work. When i run the same tests straight from intellij, i never get this problem. Is this a bug in the gradle test runner? How can I work around this?

The code is pretty minimalistic. The suite definition looks somewhat like this:

<suite name="mysuite" verbose="1" parallel="tests" thread-count="3" time-out="10">
      <test name="test1">
        <parameter name="a" value="b"/>
        <classes>
            <class name="MyTest" />
        </classes>
    </test>
      <test name="test2">
        <parameter name="a" value="c"/>
        <classes>
            <class name="MyTest" />
        </classes>
    </test>
      <test name="test3">
        <parameter name="a" value="d"/>
        <classes>
            <class name="MyTest" />
        </classes>
    </test>
  </suite>

the code looks somewhat like this:

public class MyTest {
          @Parameters("a")
    @BeforeMethod
    public void before(String a)
{
...
    }
      @AfterMethod
    public void after(){
...
    }
      @Test
    public void test1() {
  ...
    }
      @Test
    public void test2() {
...
    }
      @Test
    public void test3()
{
...
    }
    }

Total amount of test being run is 3x3=9 tests, the 3 tests are supposed to run in parallel.

I use gradle (wrapper) version 2.1

Regards, Paul

Maybe I am doing something wrong? Is it possible to define the tests in a different way to prevent this problem? Maybe a workaround even? Or is the entire parallel execution of test just broken in gradle?