JUnit 2.1



02/28/98 Erich Gamma and Kent Beck

JUnit is a simple framework to write repeatable tests. JUnit can be used with JDK 1.1.* and JDK 1.2.

Summary of Changes

The focus of this release was to refactor parts of the framework and to make it more consistent. In addition, we have simplified the writing and running of tests.

Framework

TestRunner

Contents of the Release

README.html   this file
junit.jar a jar file with the JUnit framework and  tools 
junit the source code of the JUnit framework, tools and samples
    framework  the JUnit test framework
    textui a command line interface to run tests
    ui a graphical user interface to run tests
    samples sample test cases
    tests test cases for JUnit itself
        extensions some extensions for JUnit
javadoc javadoc generated documentation
doc documentation and articles
vaj Files for using JUnit with VisualAge for Java

Installation

Below are the installation steps for installing JUnit:
  1. unzip the junit.zip file
  2. add junit.jar to the CLASSPATH. For example: set classpath=%classpath%;INSTALL_DIR\junit2\junit.jar
  3. test the installation by using either the batch or the graphical TestRunner tool to run the tests that come with this release. All the tests should pass OK.
Refer to Installing JUnit in VisualAge for Java for VisualAge for notes about installing JUnit in VisualAge for Java.

Getting Started

To get started with unit testing and JUnit read the Java Report article: Test Infected - Programmers Love Writing Tests.
This article demonstrates the development process with JUnit in the context of multiple currency arithmetic. The corresponding source code is in junit\samples\money.

You find additional samples in the junit.samples package:

Documentation

JUnit Cookbook
    A cookbook for implementing tests with JUnit.
Test Infected - Programmers Love Writing Tests
    An article demonstrating the development process with JUnit.
Javadoc
    API documentation generated with javadoc.
Using JUnit with VisualAge for Java
    Hints about how to use JUnit in the VisualAge for Java environment.
Frequently asked questions
    Some frequently asked questions about using JUnit.

Extending JUnit

Examples of possible JUnit extensions can be found in the junit.extensions package:

Download

Junit2.1 can be downloaded from here.

Acknowledgments

Many people gave us feedback on JUnit 1. Here is a likely incomplete list: Martin Fowler, Marnix Klustner, Marcio Marchini, Nick Edgar, Michael C. Feathers, Gilbert Semmer.
André Weinand rewrote the graphical TestRunner and Carolyn MacLeod showed us how to do the VisualAge for Java tool integration.