I downloaded JUnit 4.7 and put junit-4.7.jar in my build path (instead of the older version). That solved it. I didn't touch ant.
add also hamcrest.jar to your testing classpath
I found the reason to an identical problem, but only when running the test with Ant on the commandline.
You might want to run Ant in debug mode (ant -d
) and watch out for this statement:
[junit] Implicitly adding /usr/share/ant/lib/junit4.jar:...
Im my case, this JAR was added to the end of my classpath when running the test and overrode my JUnit reference in my Ant script.
It turned out that my Ant installation was bundled with a set of older JUnit libs. I had to remove the junit4.jar above in order to make my Ant classpath ref to take effect.
Faced exactly the same problem in eclipse but resolved it following the given steps
Voila... the problem is gone..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With