title: JUnit: initializationError : No runnable methods
body: <p>I wrote a eclipse plugin that as part of its job, it reads all test cases of the current active projects and run them. The problem is when it wants to run test cases I get the error <strong>initializationError : No runnable methods</strong>. </p>
  
  <p>Extra information that may help:
  Unit test code is running JUnit4.11. All test cases are annotated with @Test. Test are all public and not static. And tests are working correctly when I run them directly. Therefore, there is no problem with tests, and it is probably because of below code that I am using to load test class and then run that. </p>
  
  <p>The code that I used to load class and then run test cases: (Suppose the active project open in eclipse is ExampleProject). </p>
  
  <pre><code>//Load class contains test cases
  File root = new File("c:\ExampleProject\bin")
  classLoader = URLClassLoader.newInstance(new URL[] {root.toURI().toURL()});
  
  cls = Class.forName(testClassName, true, classLoader);
  //Above lines work and I have test class determined with testClassName
  
  //create a request    
  Request request = Request.aClass(cls);
  
  //run the request
  Result result = new JUnitCore().run(request);
  for (Failure failure : result.getFailures()) {
    System.out.println(failure.toString());    
  }
  </code></pre>
  
  <p>It prints <strong>initializationError(testClassName): No runnable methods</strong>. </p>
  
  <p>Please let me know if any one knows what is the problem and how can I fix that. </p>
  
  <p>PS: Note that when I run a test case from my plugin (C:\myplugin\bin), then above code works fine and it runs the test case exist in plugin, but when I want to run a test from current project then get the above run time error. Probably, some tings is wrong about classPath?</p>