When running all my tests in Eclipse (Eclipse 3.4 'Ganymede'), one test is listed under "Unrooted Tests". I'm using Junit 3.8 and this particular test extends TestCase. I do not see any difference between this test and the other tests. I don't remember seeing this occur in Eclipse 3.3 (Europa).
Clarification:
We haven't moved to JUnit 4.0 yet, so we are not using annotations. I also googled and it seemed like most people were having issues with JUnit 4, but I did not see any solutions. At this point the test passes both locally and in CruiseControl so I'm not overly concerned, but curious.
When I first saw this, though, it was on a failing test that only failed when run with other tests. This led me down the rabbit hole looking for a solution to the "Unrooted" issue that I never found. Eventually I found the culprit in another test that was not properly tearing down.
I agree, it does seem like an Eclipse issue.
These are the two scenarios that the Unrooted errors show up.
If you have missed the annotation @Test before the test.
@Test
public void foo(){ }
If it is a Gwt project and when two mock of the same object are defined. Lets say there is one class Class A and
@GwtMock private A atest;
@GwtMock private A a; Then this will also show a Unrooted test error.
You are using Hamcrest? or another library to help in your test?. You are not using
Check if in your test you use:
or other assert isn´t JUnit assert.
I was getting the "unrooted tests" error message as well and it went away magically. I believe it was due to the fact that I was using Eclipse with a Maven project. When I added a new method to my Test class and gave it the @Test annotation, it began getting the error message when I tried to run that one method using the "Run as Junit test" menu option; however, once I ran a maven build the unrooted tests message disappeared and I believe that is the solution to the problem in the future.
Run a maven build because it will refresh the class that JUnit is using.
It turned out to be that my build path had some error...some jars were missing. I reconfigured build path and it worked!
I've never seen this -- but as far as I can tell from skimming Google for a few minutes, this appears as though it could be a bug in Eclipse rather than a problem with your test. You don't have the @Test annotation on the test, I assume? Can you blow the test away and recreate it, and if so do you get the same error?
For me this problem was created by a real-time exception thrown in the
@AfterClass
method (take a look here for documentation):Basically all the test methods succeeded but at the end of the class this method was failing. Therefore all the tests seems fine but there was on my Eclipse an additional "unrooted test" failed.