"Received a failure event for test with unknown id" when running dynamically created tests


(Pelle Wielinga) #1

At some point in our set of tests we try to dynamically generate some tests and run them in parallel. The test fails with the following error message:

Received a completed event for test with unknown id '30.936'. Registered test ids: '[root, 30.925, 30.969, 30.2, 30.1]'

While I cannot share that code, it seems to be the exact same issue reported here: http://forums.gradle.org/gradle/topics/received_a_failure_event_for_test_with_unknown_id. This was linked to a gradle issue (GRADLE-2005) which is set to fixed in 1.4. However, I am still able to reproduce it in 1.11 using the example provided by that topic (just wrap a minimal gradle java project around it). Note that I’m currently working on windows, although I doubt that makes a difference in this case.

For reference, the test case that reproduces the problem:

package foo;
  import junit.framework.Test;
  import junit.framework.TestCase;
  import junit.extensions.ActiveTestSuite;
  public class ExampleTest extends TestCase
  {
      public ExampleTest(String testName)
      {
          super(testName);
      }
      public void testA() {
      }
      public static Test suite() {
          ActiveTestSuite suite = new ActiveTestSuite();
          for(int i=0; i < 100; i++) {
              suite.addTest(new ExampleTest("testA"));
          }
          return suite;
      }
  }

Since the previous topics are over 2 years old, I decided to create this new topic.