Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A programmer-oriented testing framework for Java.
Java Shell

This branch is 13 commits ahead, 1871 commits behind junit-team:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
   <meta name="Author" content="Erich Gamma, Kent Beck, and David Saff">
   <title>JUnit 4.1</title>

<b><font color="#00CC00">J</font><font color="#FF0000">U</font><font color="#000000">nit
<br>Brought to you by <a href="">Kent Beck</a>, Erich 

Gamma, and <a href="">David Saff</a>. 
<br>FAQ edited by <a href="">Mike Clark</a>. Web mastering by Erik 

<br>(see also <a href=""></a>)

<hr WIDTH="100%">
<br>27 April 2006
<p>JUnit is a simple framework to write repeatable tests. It is an instance
of the xUnit architecture for unit testing frameworks.
<a href="#Summary of">Summary of Changes</a></li>

<a href="#Contents">Contents</a></li>

<a href="#Installation">Installation</a></li>

<a href="#Getting">Getting Started</a></li>

<a href="#Documentation">Documentation</a></li>
<a href="#Known Defects">Known Defects</a></li>

<a NAME="Summary of"></a>Summary of Changes with version 4.1</h2>
<li>Bug fix: listeners now get a correct test running time, rather than always being told 0 secs.
<li>The @RunWith annotation is now inherited by subclasses: 
all subclasses of an abstract test class will be run by the same runner.
<li>The build script fails if the JUnit unit tests fail
<li>The faq has been updated
<li>Javadoc has been improved, with more internal links, and package descriptions added (Thanks, Matthias Schmidt!)
<li>An acknowledgements.txt file has been created to credit outside contributions
<li>The <tt>Enclosed</tt> runner, which runs all of the static inner classes of a given class, has been added
to <tt>org.junit.runners</tt>.

<h2>Summary of Changes with version 4.0</h2>
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.

<a NAME="Contents"></a>Contents of the Release</h2>


<td>this file</td>


<td>a jar file with the JUnit framework</td>


<td>a jar file with the source code of the JUnit framework</td>


<td>the source code of the basic JUnit annotations and classes</td>

<td><tt>&nbsp;&nbsp;&nbsp; samples</tt></td>

<td>sample test cases</td>

<td><tt>&nbsp;&nbsp;&nbsp; tests</tt></td>

<td>test cases for JUnit itself</td>


<td>javadoc generated documentation</td>


<td>documentation and articles</td>

<a NAME="Installation"></a>Installation</h2>
Below are the installation steps for installing JUnit:
unzip the file</li>

add<i> </i><b>junit-4.1.jar</b> to the CLASSPATH. For example: 
<tt> set classpath=%classpath%;INSTALL_DIR\junit-4.1.jar;INSTALL_DIR</tt></li>

test the installation by running <tt>java org.junit.runner.JUnitCore org.junit.tests.AllTests.</tt></li>

<br><b><font color="#FF0000">Notice</font></b>: 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
<b><font color="#FF0000">Important</font></b>: 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.
<a NAME="Getting"></a>Getting Started</h2>
To get started with unit testing and JUnit read the article:
<a href="doc/cookbook/cookbook.htm">JUnit Cookbook</a>.
<br>This article describes basic test writing using JUnit 4.
<p>You find additional samples in the org.junit.samples package:
<li> - some simple test cases</li>

<li> - test cases for java.util.Vector</li>

<a NAME="Documentation"></a>Documentation</h2>

<blockquote><a href="doc/cookbook/cookbook.htm">JUnit Cookbook</a>
<br>&nbsp;&nbsp;&nbsp; A cookbook for implementing tests with JUnit.
<br><a href="javadoc/index.html">Javadoc</a>
<br>&nbsp;&nbsp;&nbsp; API documentation generated with javadoc.
<br><a href="doc/faq/faq.htm">Frequently asked questions</a>
<br>&nbsp;&nbsp;&nbsp; Some frequently asked questions about using JUnit.
<br><a href="cpl-v10.html">License</a>
<br>&nbsp;&nbsp;&nbsp; The terms of the common public license used for JUnit.<br>
The following documents still describe JUnit 3.8.
<br><a href="doc/testinfected/testing.htm">Test Infected - Programmers
Love Writing Tests</a>
<br>&nbsp;&nbsp;&nbsp; An article demonstrating the development process
with JUnit.
<br><a href="doc/cookstour/cookstour.htm">JUnit - A cooks tour</a>

<h2><a NAME="Known Defects"></a>Known Defects</h2>
<li>Multi-dimensional arrays are not processed correctly by assertEquals.</li>

<hr WIDTH="100%">
<!--webbot bot="HTMLMarkup" startspan --><a href=""><IMG
                  width="88" height="31" border="0" alt="SourceForge Logo"></a><!--webbot
bot="HTMLMarkup" endspan -->
Something went wrong with that request. Please try again.