(Submitted by: Eric Armstrong)
To run your JUnit tests, you'll need the following elemements in your CLASSPATH:
- JUnit class files
- Your class files, including your JUnit test classes
- Libraries your class files depend on
If attempting to run your tests results in a NoClassDefFoundError, then something is missing from your CLASSPATH.
Windows Example:
set CLASSPATH=%JUNIT_HOME%\junit.jar;c:\myproject\classes;c:\myproject\lib\something.jar
Unix (bash) Example:
export CLASSPATH=$JUNIT_HOME/junit.jar:/myproject/classes:/myproject/lib/something.jar
2. run command
java org.junit.runner.JUnitCore org.junit.tests.AllTests
example: java org.junit.runner.JUnitCore com.google.example.LoginGoogle