2

So I edited the name of a JUnit test and now it wont work. Instead I get Unrooted Tests: initializationError.

This is a simple test. Infact it is a test for JUnit tests as I am just starting to use it.

@Test
public void testRun()
    String s = null;
    assertNull(s);

}

and all i did was change it to testRun2(). Also when I run the file not the individual test, it still runs the old testRun(), not testRun2().

My project has Maven not sure if that is a factor. And I have updated the project

2
  • can you post whole test class? Commented Apr 22, 2014 at 20:32
  • 1
    I bet you try to run it via junit view. This view still holds the old test method name. Just right click on the class in the package explorer and debug as junit. Then the view will be refreshed and your test will be executed Commented Apr 22, 2014 at 20:52

3 Answers 3

4

So it turned out that I needed to rebuild using Maven to update the classes. Now it works fine and I can add/modify test cases.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for this. I'm not using Maven, but Project → Clean… worked for me.
3

In my case, i changed the method name and it didn't update it automatically, so the above solution of Project> Clean worked well for me.

Comments

0

Another way this error would occur is forgetting the Test annotation. Encountered when right click method name in Eclipse and Run As -> Junit Test.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.