tags:

views:

96

answers:

1

Hi. I'm having a little trouble getting started with JUnit tests. This should be pretty basic. I downloaded junit-4.8.2.jar from JUnit.org and placed it in my home directory.

If I try to test my setup in a TCSH terminal with the following command:

java -cp ~/junit-4.8.2.jar org.junit.runner.JUnitCore org.junit.tests.AllTests

I receive the following output

JUnit version 4.8.2
Could not find class: org.junit.tests.AllTests

Time: 0.003

OK (0 tests)

Any help would be greatly appreciated. Thanks.

+1  A: 

Check out: the junit faq specifically this item, bolding mine:

Test the installation by running the sample tests distributed with JUnit. Note that the sample tests are located in the installation directory directly, not the junit.jar file. Therefore, make sure that the JUnit installation directory is on your CLASSPATH. Then simply type:

java org.junit.runner.JUnitCore org.junit.tests.AllTests

If you only downloaded the jar you can't run the sample tests. You need to get the src package and follow the instructions for that.

David Koski