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 dedicated quality assurance professional with a true passion for ensuring product quality and driving efficient testing processes. Throughout my career, I have gained extensive expertise in various testing domains, showcasing my versatility in testing diverse applications such as CRM, Web, Mobile, Database, and Machine Learning-based applications. What sets me apart is my ability to develop robust test scripts, ensure comprehensive test coverage, and efficiently report defects. With experience in managing teams and leading testing-related activities, I foster collaboration and drive efficiency within projects. Proficient in tools like Selenium, Appium, Mechanize, Requests, Postman, Runscope, Gatling, Locust, Jenkins, CircleCI, Docker, and Grafana, I stay up-to-date with the latest advancements in the field to deliver exceptional software products. Outside of work, I find joy and inspiration in sports, maintaining a balanced lifestyle.
Thanks, that actually worked for me. I don’t know why this did not work right out of the box.
This helps me