I know this question is pretty general but I haven\'t found any hints on why this error may show up. What are possible causes of seeing initalizationError in Eclips
I just had the same problem and the same message. I was able to get it fixed by importing to the Java Building Path the hamcrest-all-1.3.jar
archive. I'm using a JUnit 4.12 version.
In my case I have changed project name in pom.xml so the new target directory was generated and junit was searching classes in old directory. You need to change directory for JUnit also in Eclipse
Properties -> Java Build Path -> Source (Default output folder)
And also check because some of source folders listed in the same window may have former directory name. You need to change them too.
I had naively added junit-4.12.jar from poi.apache.org to my Build Path in Eclipse. I deleted it (Project, Properties, Java Build Path, Libraries, junit-4.12.jar, Remove) then in my test class allowed Eclipse to "Fix Project Setup" after pressing Ctrl-1. No more problems! :-)
For me, I mistakenly added a parameter to the test method which caused initialization error.
Also make sure you have all @Before
-, @After
- and whatever-JUnit-annotated methods declared as public
. I had mine declared as private
which caused the issue.
I got another failure trace, but for future visitors using their favorite search engine:
For me the problem was that eclipse somehow decided to execute only a single method in my test class (I couldn't figure out why, though). Especially if you did not change anything in your setup, check your run configuration.