Skip to content


Subversion checkout URL

You can clone with
Download ZIP
A programmer-oriented testing framework for Java.
Java Perl Shell
Pull request Compare This branch is 170 commits ahead, 1911 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">
   <title>JUnit 3.8</title>

<b><font color="#00CC00">J</font><font color="#FF0000">U</font><font color="#000000">nit

<hr WIDTH="100%">
<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 NAME="Summary of"></a>Summary of Changes with version 4.0</h2>

  <li>Backed out setting the testing Thread's context class loader (see <a href=";aid=598200&amp;group_id=15278&amp;atid=115278">JUnit
        not setting ClassLoader</a>). It has caused problems in tests that
    worked OK before. See the bug report for more details.</li>
      <li><a href=";aid=601326&amp;group_id=15278&amp;atid=115278">NPE
        in ComparisonFailure</a></li>
      <li><a href=";aid=602948&amp;group_id=15278&amp;atid=115278">Swing
        UI: NoSuchMethodError on JDK 1.3</a></li>

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


<td>this file</td>


<td>a jar file with the JUnit framework and&nbsp; tools&nbsp;</td>


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


<td>the source code of the JUnit samples</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.jar</b> to the CLASSPATH. For example: <tt>set classpath=%classpath%;INSTALL_DIR\junit3\junit.jar</tt></li>

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.</li>

<br><b><font color="#FF0000">Notice</font></b>: that the tests are not
contained in the junit.jar but in the installation directory directly.
Therefore make sure that the installation directory is on the class path
for the batch TestRunner type:</li>

<br><tt>&nbsp;&nbsp;&nbsp; java junit.textui.TestRunner junit.samples.AllTests</tt>
for the graphical TestRunner type:</li>

<br><tt>&nbsp;&nbsp;&nbsp; java junit.awtui.TestRunner junit.samples.AllTests</tt>
for the Swing based graphical TestRunner type:</li>

<br><tt>&nbsp;&nbsp;&nbsp; java junit.swingui.TestRunner junit.samples.AllTests</tt></ul>
<b><font color="#FF0000">Important</font></b>: don't install the junit.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 Java Report article:
<a href="doc/testinfected/testing.htm">Test
Infected - Programmers Love Writing Tests</a>.
<br>This article demonstrates the development process with JUnit in the
context of multiple currency arithmetic. The corresponding source code
is in junit\samples\money.
<p>You find additional samples in the 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="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>
<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="doc/JUnitProperties.html">TestRunner Preference settings</a>
<br>&nbsp;&nbsp;&nbsp; Describes the preferences settings that can be configured
for the JUnit TestRunners.<br>
  <a href="cpl-v10.html">License</a>
<br>&nbsp;&nbsp;&nbsp; The terms of the common public license used for JUnit.</blockquote>

<a NAME="Extending"></a>Extending JUnit</h2>
Examples of possible JUnit extensions can be found in the <tt>junit.extensions</tt>
<a href="javadoc/junit/extensions/TestDecorator.html">TestDecorator</a>
- A decorator for Test. You can use it as the base class for implementing
decorators to extend test cases.</li>

<a href="javadoc/junit/extensions/ActiveTestSuite.html">ActiveTestSuite</a>
- A TestSuite which runs each test in a separate thread and waits until
they are all terminated.</li>

<a href="javadoc/junit/extensions/TestSetup.html">TestSetup</a> - A Decorator
to set up and tear down additional fixture state. Subclass TestSetup and
insert it into your tests when you want to set up additional state once
before the tests are run.</li>

<a href="javadoc/junit/extensions/ExceptionTestCase.html">ExceptionTestCase</a>
- A TestCase that expects a particular Exception to be thrown.</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.