Index of /~cappello/50-2007-Winter/projects/cappello/testlib/junit4.1
JUnit 4.1
JUnit
4.1
Brought to you by Kent Beck, Erich
Gamma, and David Saff.
FAQ edited by Mike Clark. Web mastering by Erik
Meade.
(see also JUnit.org)
27 April 2006
JUnit is a simple framework to write repeatable tests. It is an instance
of the xUnit architecture for unit testing frameworks.
Summary of Changes with version 4.1
- Bug fix: listeners now get a correct test running time, rather than always being told 0 secs.
- The @RunWith annotation is now inherited by subclasses:
all subclasses of an abstract test class will be run by the same runner.
- The build script fails if the JUnit unit tests fail
- The faq has been updated
- Javadoc has been improved, with more internal links, and package descriptions added (Thanks, Matthias Schmidt!)
- An acknowledgements.txt file has been created to credit outside contributions
- The Enclosed runner, which runs all of the static inner classes of a given class, has been added
to org.junit.runners.
Summary of Changes with version 4.0
The architecture of JUnit 4.0 is a substantial departure from that of earlier releases.
Instead of
tagging test classes by subclassing junit.framework.TestCase and tagging test methods by
starting their name with "test", you now tag test methods with the @Test annotation.
Contents of the Release
README.html |
this file |
junit-4.1.jar |
a jar file with the JUnit framework |
junit-4.1-src.jar |
a jar file with the source code of the JUnit framework |
org/junit |
the source code of the basic JUnit annotations and classes |
samples |
sample test cases |
tests |
test cases for JUnit itself |
javadoc |
javadoc generated documentation |
doc |
documentation and articles |
Installation
Below are the installation steps for installing JUnit:
-
unzip the junit4.1.zip file
-
add junit-4.1.jar to the CLASSPATH. For example:
set classpath=%classpath%;INSTALL_DIR\junit-4.1.jar;INSTALL_DIR
-
test the installation by running java org.junit.runner.JUnitCore org.junit.tests.AllTests.
Notice: that the tests are not
contained in the junit-4.1.jar but in the installation directory directly.
Therefore make sure that the installation directory is on the class path
Important: don't install junit-4.1.jar
into the extension directory of your JDK installation. If you do so the
test class on the files system will not be found.
Getting Started
To get started with unit testing and JUnit read the article:
JUnit Cookbook.
This article describes basic test writing using JUnit 4.
You find additional samples in the org.junit.samples package:
-
SimpleTest.java - some simple test cases
-
VectorTest.java - test cases for java.util.Vector
Documentation
JUnit Cookbook
A cookbook for implementing tests with JUnit.
Javadoc
API documentation generated with javadoc.
Frequently asked questions
Some frequently asked questions about using JUnit.
License
The terms of the common public license used for JUnit.
The following documents still describe JUnit 3.8.
Test Infected - Programmers
Love Writing Tests
An article demonstrating the development process
with JUnit.
JUnit - A cooks tour
Known Defects
- Multi-dimensional arrays are not processed correctly by assertEquals.