JUnit

Information

JUnit is an open source Java testing framework used to write and run repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks.

JUnit features include:

Current version in use: 3.8.1
Homepage: http://www.junit.org

Example

It runs each unit test and produces a report of the results. To use the junit target, you need to set the properties described in the Common Build Targets document.

<target name="junit"> <ant antfile="$" target="junit"> <property name="report.dir" value="C:\temp\myproject"/> <property name="test.source.dir" value="$\test"/> <property name="classes.dir" value="$\bin"/> </ant> </target> It will try to run any class that that matches *Test.java, at the same time excluding *TestCase.java and AllTests.java

The project classpath is also needed, but this is found out by the GetClasspath task. The common target will add the directory junit to the report dir you provided and create a report with the name index.html.


DeadEd.com
http://www.deaded.com/staticpages/index.php/junit