GIST logo

Using JUnit on MathLAN

The JUnit classes are contained in the archive file /usr/share/java/junit.jar. Add this file to the value of your CLASSPATH environment variable to access them.

Conventionally, the tests relating to class Foo are placed in a class called FooTest, and the individual test relating to a method called bar is called testBar. JUnit understands and relies on these conventions.

I was not successful in getting the GNU Java compiler gcj to work with JUnit. I recommend using the IBM compiler, at least until I can sort out the problems.

The short document JUnit cookbook gives another example showing how to assemble tests into test suites so that they can be run and re-run efficiently.