I hit the following issue while trying to run a JUnit test in Eclipse:
The Failure Trace displayed a message stating java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing
I made sure that I had JUnit 4 and org.hamcrest.core along with the Java library in my project but still faced this issue.
After analyzing quite a bit, I noticed that my JRE System Library also has JUnit files associated. I added the org.hamcrest.core_1xx.jar to my JRE path as shown below.
I ran the test again. This time the test run was successful.
Other links which may help you to solve this issue
I had to Google around quite a bit to find the solution. I noticed there are multiple causes for this issue. If the solution outlined in this blog did not help you, try one of these helpful links:
1. http://stackoverflow.com/questions/14539072/java-lang-noclassdeffounderror-org-hamcrest-selfdescribing
2. http://stackoverflow.com/questions/15190699/eclipse-junit-possible-causes-of-seeing-initializationerror-in-eclipse-windo
I am a software tester with over 14 years of experience in software testing. Currently, I am working at Qxf2 Services Bangalore. As a student of the context-driven approach to software testing, I feel there is a lot to learn out there which keeps me very excited. My work has helped me gain good experience in different areas of testing like CRM, Web, Mobile and Database testing. I have good knowledge of building test scripts using Automation tools like Selenium and Appium using Java and Python. Besides testing, I am a “Sports Fanatic” and love watching and playing sports.
Thanks, that actually worked for me. I don’t know why this did not work right out of the box.