JUnit test, Unrooted Tests: initializationError

11,149

Solution 1

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.

Solution 2

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.

Share:
11,149
Richard
Author by

Richard

Updated on July 24, 2022

Comments

  • Richard
    Richard almost 2 years

    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

    • Iłya Bursov
      Iłya Bursov about 10 years
      can you post whole test class?
    • s_bei
      s_bei about 10 years
      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
  • wchargin
    wchargin over 9 years
    Thanks for this. I'm not using Maven, but Project → Clean… worked for me.