I would like to run JUnit test cases from the command line. How can I do this?
With JUnit 4.12 the following didn't work for me:
java -cp .:/usr/share/java/junit.jar org.junit.runner.JUnitCore [test class name]
Apparently, from JUnit 4.11 onwards you should also include hamcrest-core.jar
in your classpath:
java -cp .:/usr/share/java/junit.jar:/usr/share/java/hamcrest-core.jar org.junit.runner.JUnitCore [test class name]