JUnit is a small library supporting defining and running unit tests in Java, available at http://junit.org/. A test runner is responsible for identifying, loading, and running tests (usually defined as classes conforming to a certain informal interface). JUnit has two important distinct versions: JUnit 3, the traditional library with classes packaged in junit.framework
, etc.; and JUnit 4, a redesign that takes advantage of Java 5 language features, packaged in org.junit
. Tests defined using JUnit 3 can be recognized by JUnit 4 test runners, and tests defined with JUnit 4 can be slightly extended to be recognized by JUnit 3 test runners.
Each DrJava subtree uses lib/buildlib/junit.jar
to compile and run unit tests. These tests are written using the JUnit 3 framework; after compilation, they are moved into classes/test
to distinguish them from the main body of code (in classes/base
). The DrJava application also bundles JUnit as a library (located at lib/junit.jar
). This allows DrJava to define its own test runner (currently a JUnit 3 test runner), and also lets DrJava users write and compile JUnit tests without needing a separate copy of junit.jar
.