|
@@ -8,10 +8,14 @@ |
|
|
<h3>Description</h3> |
|
|
<h3>Description</h3> |
|
|
|
|
|
|
|
|
<p>This task runs tests from the JUnit testing framework. The latest |
|
|
<p>This task runs tests from the JUnit testing framework. The latest |
|
|
version of the framework can be found at |
|
|
|
|
|
|
|
|
version of the framework can be found at |
|
|
<a href="http://www.junit.org">http://www.junit.org</a>. |
|
|
<a href="http://www.junit.org">http://www.junit.org</a>. |
|
|
This task has been tested with JUnit 3.0 up to JUnit 3.7, it won't |
|
|
This task has been tested with JUnit 3.0 up to JUnit 3.7, it won't |
|
|
work with versions prior to JUnit 3.0.</p> |
|
|
work with versions prior to JUnit 3.0.</p> |
|
|
|
|
|
<p><strong>Note:</strong> This task depends on external libraries not included |
|
|
|
|
|
in the Ant distribution. See <a href="../install.html#librarydependencies"> |
|
|
|
|
|
Library Dependencies</a> for more information. |
|
|
|
|
|
</p> |
|
|
|
|
|
|
|
|
<p>Tests are defined by nested <code>test</code> or |
|
|
<p>Tests are defined by nested <code>test</code> or |
|
|
<code>batchtest</code> tags, see <a href="#nested">nested |
|
|
<code>batchtest</code> tags, see <a href="#nested">nested |
|
@@ -25,7 +29,7 @@ elements</a>.</p> |
|
|
<td width="10%" valign="top"><b>Required</b></td> |
|
|
<td width="10%" valign="top"><b>Required</b></td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">printsummary</td> |
|
|
|
|
|
|
|
|
<td valign="top">printsummary</td> |
|
|
<td valign="top">Print one line statistics for each testcase. Can |
|
|
<td valign="top">Print one line statistics for each testcase. Can |
|
|
take the values "on", "off" and |
|
|
take the values "on", "off" and |
|
|
"withOutAndErr" - "withOutAndErr" is the same |
|
|
"withOutAndErr" - "withOutAndErr" is the same |
|
@@ -34,43 +38,43 @@ elements</a>.</p> |
|
|
<td align="center" valign="top">No, default is "off"</td> |
|
|
<td align="center" valign="top">No, default is "off"</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">fork</td> |
|
|
|
|
|
|
|
|
<td valign="top">fork</td> |
|
|
<td valign="top">Run the tests in a separate VM.</td> |
|
|
<td valign="top">Run the tests in a separate VM.</td> |
|
|
<td align="center" valign="top">No, default is "off"</td> |
|
|
<td align="center" valign="top">No, default is "off"</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">haltonerror</td> |
|
|
|
|
|
|
|
|
<td valign="top">haltonerror</td> |
|
|
<td valign="top">Stop the build process if an error occurs during the test |
|
|
<td valign="top">Stop the build process if an error occurs during the test |
|
|
run.</td> |
|
|
run.</td> |
|
|
<td align="center" valign="top">No, default is "off"</td> |
|
|
<td align="center" valign="top">No, default is "off"</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">errorProperty</td> |
|
|
|
|
|
<td valign="top">The name of a property to set in the event of an error.</td> |
|
|
|
|
|
|
|
|
<td valign="top">errorProperty</td> |
|
|
|
|
|
<td valign="top">The name of a property to set in the event of an error.</td> |
|
|
<td align="center" valign="top">No.</td> |
|
|
<td align="center" valign="top">No.</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">haltonfailure</td> |
|
|
|
|
|
<td valign="top">Stop the build process if a test fails (errors are |
|
|
|
|
|
|
|
|
<td valign="top">haltonfailure</td> |
|
|
|
|
|
<td valign="top">Stop the build process if a test fails (errors are |
|
|
considered failures as well).</td> |
|
|
considered failures as well).</td> |
|
|
<td align="center" valign="top">No, default is "off"</td> |
|
|
<td align="center" valign="top">No, default is "off"</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">failureProperty</td> |
|
|
|
|
|
|
|
|
<td valign="top">failureProperty</td> |
|
|
<td valign="top">The name of a property to set in the event of a failure |
|
|
<td valign="top">The name of a property to set in the event of a failure |
|
|
(errors are considered failures as well).</td> |
|
|
|
|
|
|
|
|
(errors are considered failures as well).</td> |
|
|
<td align="center" valign="top">No.</td> |
|
|
<td align="center" valign="top">No.</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">filtertrace</td> |
|
|
|
|
|
<td valign="top">Filter out junit and ant stack frames from error and failure stack traces.</td> |
|
|
|
|
|
|
|
|
<td valign="top">filtertrace</td> |
|
|
|
|
|
<td valign="top">Filter out junit and ant stack frames from error and failure stack traces.</td> |
|
|
<td align="center" valign="top">No, default is "on."</td> |
|
|
<td align="center" valign="top">No, default is "on."</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">timeout</td> |
|
|
|
|
|
|
|
|
<td valign="top">timeout</td> |
|
|
<td valign="top">Cancel the individual tests if the don't finish |
|
|
<td valign="top">Cancel the individual tests if the don't finish |
|
|
in the given time (measured in milliseconds). Ignored if fork is |
|
|
in the given time (measured in milliseconds). Ignored if fork is |
|
|
disabled.</td> |
|
|
|
|
|
|
|
|
disabled.</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
@@ -148,11 +152,11 @@ The attributes for this element are the same as for <a href="../CoreTasks/exec.h |
|
|
available to the test.</p> |
|
|
available to the test.</p> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<h4>env</h4> |
|
|
|
|
|
|
|
|
<h4>env</h4> |
|
|
|
|
|
|
|
|
<p>It is possible to specify environment variables to pass to the |
|
|
<p>It is possible to specify environment variables to pass to the |
|
|
forked VM via nested <code><env></code> elements. See the |
|
|
forked VM via nested <code><env></code> elements. See the |
|
|
description in the section about |
|
|
|
|
|
|
|
|
description in the section about |
|
|
<a href="../CoreTasks/exec.html#env">exec</a></p> |
|
|
<a href="../CoreTasks/exec.html#env">exec</a></p> |
|
|
|
|
|
|
|
|
<p>Settings will be ignored if fork is disabled.</p> |
|
|
<p>Settings will be ignored if fork is disabled.</p> |
|
@@ -180,22 +184,22 @@ can be specified.</p> |
|
|
<td width="10%" valign="top"><b>Required</b></td> |
|
|
<td width="10%" valign="top"><b>Required</b></td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">type</td> |
|
|
|
|
|
|
|
|
<td valign="top">type</td> |
|
|
<td valign="top">Use a predefined formatter (either |
|
|
<td valign="top">Use a predefined formatter (either |
|
|
"xml", "plain" or "brief").</td> |
|
|
"xml", "plain" or "brief").</td> |
|
|
<td align="center" rowspan="2">Exactly one of these.</td> |
|
|
<td align="center" rowspan="2">Exactly one of these.</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">classname</td> |
|
|
|
|
|
|
|
|
<td valign="top">classname</td> |
|
|
<td valign="top">Name of a custom formatter class.</td> |
|
|
<td valign="top">Name of a custom formatter class.</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">extension</td> |
|
|
|
|
|
|
|
|
<td valign="top">extension</td> |
|
|
<td valign="top">Extension to append to the output filename.</td> |
|
|
<td valign="top">Extension to append to the output filename.</td> |
|
|
<td align="center">Yes, if classname has been used.</td> |
|
|
<td align="center">Yes, if classname has been used.</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">usefile</td> |
|
|
|
|
|
|
|
|
<td valign="top">usefile</td> |
|
|
<td valign="top">Boolean that determines whether output should be |
|
|
<td valign="top">Boolean that determines whether output should be |
|
|
sent to a file.</td> |
|
|
sent to a file.</td> |
|
|
<td align="center">No, default true.</td> |
|
|
<td align="center">No, default true.</td> |
|
@@ -213,54 +217,54 @@ can be specified.</p> |
|
|
<td width="10%" valign="top"><b>Required</b></td> |
|
|
<td width="10%" valign="top"><b>Required</b></td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">name</td> |
|
|
|
|
|
|
|
|
<td valign="top">name</td> |
|
|
<td valign="top">Name of the test class</td> |
|
|
<td valign="top">Name of the test class</td> |
|
|
<td align="center">Yes</td> |
|
|
<td align="center">Yes</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">fork</td> |
|
|
|
|
|
<td valign="top">Run the tests in a separate VM. |
|
|
|
|
|
|
|
|
<td valign="top">fork</td> |
|
|
|
|
|
<td valign="top">Run the tests in a separate VM. |
|
|
Overrides value set in <code><junit></code>.</td> |
|
|
Overrides value set in <code><junit></code>.</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">haltonerror</td> |
|
|
|
|
|
|
|
|
<td valign="top">haltonerror</td> |
|
|
<td valign="top">Stop the build process if an error occurs during the test |
|
|
<td valign="top">Stop the build process if an error occurs during the test |
|
|
run. Overrides value set in <code><junit></code>.</td> |
|
|
run. Overrides value set in <code><junit></code>.</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">errorProperty</td> |
|
|
|
|
|
|
|
|
<td valign="top">errorProperty</td> |
|
|
<td valign="top">The name of a property to set in the event of an error. |
|
|
<td valign="top">The name of a property to set in the event of an error. |
|
|
Overrides value set in <junit>.</td> |
|
|
|
|
|
|
|
|
Overrides value set in <junit>.</td> |
|
|
<td align="center" valign="top">No.</td> |
|
|
<td align="center" valign="top">No.</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">haltonfailure</td> |
|
|
|
|
|
<td valign="top">Stop the build process if a test fails (errors are |
|
|
|
|
|
considered failures as well). Overrides value set in |
|
|
|
|
|
|
|
|
<td valign="top">haltonfailure</td> |
|
|
|
|
|
<td valign="top">Stop the build process if a test fails (errors are |
|
|
|
|
|
considered failures as well). Overrides value set in |
|
|
<code><junit></code>.</td> |
|
|
<code><junit></code>.</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">failureProperty</td> |
|
|
|
|
|
|
|
|
<td valign="top">failureProperty</td> |
|
|
<td valign="top">The name of a property to set in the event of a failure |
|
|
<td valign="top">The name of a property to set in the event of a failure |
|
|
(errors are considered failures as well). Overrides value set in <junit>.</td> |
|
|
|
|
|
|
|
|
(errors are considered failures as well). Overrides value set in <junit>.</td> |
|
|
<td align="center" valign="top">No.</td> |
|
|
<td align="center" valign="top">No.</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">filtertrace</td> |
|
|
|
|
|
<td valign="top">Filter out junit and ant stack frames from error and failure stack |
|
|
|
|
|
traces. Overrides value set in <junit></td> |
|
|
|
|
|
|
|
|
<td valign="top">filtertrace</td> |
|
|
|
|
|
<td valign="top">Filter out junit and ant stack frames from error and failure stack |
|
|
|
|
|
traces. Overrides value set in <junit></td> |
|
|
<td align="center" valign="top">No, default is "on."</td> |
|
|
<td align="center" valign="top">No, default is "on."</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">todir</td> |
|
|
|
|
|
|
|
|
<td valign="top">todir</td> |
|
|
<td valign="top">Directory to write the reports to.</td> |
|
|
<td valign="top">Directory to write the reports to.</td> |
|
|
<td align="center" valign="top">No, default is current directory.</td> |
|
|
<td align="center" valign="top">No, default is current directory.</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">outfile</td> |
|
|
|
|
|
|
|
|
<td valign="top">outfile</td> |
|
|
<td valign="top">Base name of the test result. The full filename is |
|
|
<td valign="top">Base name of the test result. The full filename is |
|
|
determined by this attribute and the extension of |
|
|
determined by this attribute and the extension of |
|
|
<code>formatter</code>.</td> |
|
|
<code>formatter</code>.</td> |
|
@@ -268,12 +272,12 @@ can be specified.</p> |
|
|
<code>TEST-name</code> using the <code>name</code> attribute.</td> |
|
|
<code>TEST-name</code> using the <code>name</code> attribute.</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">if</td> |
|
|
|
|
|
|
|
|
<td valign="top">if</td> |
|
|
<td valign="top">Only run test if the named property is set.</td> |
|
|
<td valign="top">Only run test if the named property is set.</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">unless</td> |
|
|
|
|
|
|
|
|
<td valign="top">unless</td> |
|
|
<td valign="top">Only run test if the named property is <b>not</b> set.</td> |
|
|
<td valign="top">Only run test if the named property is <b>not</b> set.</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
</tr> |
|
|
</tr> |
|
@@ -299,54 +303,54 @@ generates a test class name for each file that ends in |
|
|
<td width="10%" valign="top"><b>Required</b></td> |
|
|
<td width="10%" valign="top"><b>Required</b></td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">fork</td> |
|
|
|
|
|
<td valign="top">Run the tests in a separate VM. |
|
|
|
|
|
|
|
|
<td valign="top">fork</td> |
|
|
|
|
|
<td valign="top">Run the tests in a separate VM. |
|
|
Overrides value set in <code><junit></code>.</td> |
|
|
Overrides value set in <code><junit></code>.</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">haltonerror</td> |
|
|
|
|
|
|
|
|
<td valign="top">haltonerror</td> |
|
|
<td valign="top">Stop the build process if an error occurs during the test |
|
|
<td valign="top">Stop the build process if an error occurs during the test |
|
|
run. Overrides value set in <code><junit></code>.</td> |
|
|
run. Overrides value set in <code><junit></code>.</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">errorProperty</td> |
|
|
|
|
|
|
|
|
<td valign="top">errorProperty</td> |
|
|
<td valign="top">The name of a property to set in the event of an error. |
|
|
<td valign="top">The name of a property to set in the event of an error. |
|
|
Overrides value set in <junit>.</td> |
|
|
|
|
|
|
|
|
Overrides value set in <junit>.</td> |
|
|
<td align="center" valign="top">No.</td> |
|
|
<td align="center" valign="top">No.</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">haltonfailure</td> |
|
|
|
|
|
<td valign="top">Stop the build process if a test fails (errors are |
|
|
|
|
|
considered failures as well). Overrides value set in |
|
|
|
|
|
|
|
|
<td valign="top">haltonfailure</td> |
|
|
|
|
|
<td valign="top">Stop the build process if a test fails (errors are |
|
|
|
|
|
considered failures as well). Overrides value set in |
|
|
<code><junit></code>.</td> |
|
|
<code><junit></code>.</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">failureProperty</td> |
|
|
|
|
|
|
|
|
<td valign="top">failureProperty</td> |
|
|
<td valign="top">The name of a property to set in the event of a failure |
|
|
<td valign="top">The name of a property to set in the event of a failure |
|
|
(errors are considered failures as well). Overrides value set in <junit></td> |
|
|
|
|
|
|
|
|
(errors are considered failures as well). Overrides value set in <junit></td> |
|
|
<td align="center" valign="top">No.</td> |
|
|
<td align="center" valign="top">No.</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">filtertrace</td> |
|
|
|
|
|
<td valign="top">Filter out junit and ant stack frames from error and failure stack |
|
|
|
|
|
traces. Overrides value set in <junit></td> |
|
|
|
|
|
|
|
|
<td valign="top">filtertrace</td> |
|
|
|
|
|
<td valign="top">Filter out junit and ant stack frames from error and failure stack |
|
|
|
|
|
traces. Overrides value set in <junit></td> |
|
|
<td align="center" valign="top">No, default is "on."</td> |
|
|
<td align="center" valign="top">No, default is "on."</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">todir</td> |
|
|
|
|
|
|
|
|
<td valign="top">todir</td> |
|
|
<td valign="top">Directory to write the reports to.</td> |
|
|
<td valign="top">Directory to write the reports to.</td> |
|
|
<td align="center" valign="top">No, default is current directory.</td> |
|
|
<td align="center" valign="top">No, default is current directory.</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">if</td> |
|
|
|
|
|
|
|
|
<td valign="top">if</td> |
|
|
<td valign="top">Only run tests if the named property is set.</td> |
|
|
<td valign="top">Only run tests if the named property is set.</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
</tr> |
|
|
</tr> |
|
|
<tr> |
|
|
<tr> |
|
|
<td valign="top">unless</td> |
|
|
|
|
|
|
|
|
<td valign="top">unless</td> |
|
|
<td valign="top">Only run tests if the named property is <b>not</b> set.</td> |
|
|
<td valign="top">Only run tests if the named property is <b>not</b> set.</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
<td align="center" valign="top">No</td> |
|
|
</tr> |
|
|
</tr> |
|
@@ -416,7 +420,7 @@ perform setup work (such as starting an external server), execute the test, |
|
|
clean up, and still fail the build in the event of a failure.</p> |
|
|
clean up, and still fail the build in the event of a failure.</p> |
|
|
|
|
|
|
|
|
<p>The filtertrace attribute condenses error and failure stack traces before reporting them. |
|
|
<p>The filtertrace attribute condenses error and failure stack traces before reporting them. |
|
|
It works with the plain and xml formatters. It filters out lines that begin with the following |
|
|
|
|
|
|
|
|
It works with the plain and xml formatters. It filters out lines that begin with the following |
|
|
string patterns:<pre> |
|
|
string patterns:<pre> |
|
|
"junit.framework.TestCase" |
|
|
"junit.framework.TestCase" |
|
|
"junit.framework.TestResult" |
|
|
"junit.framework.TestResult" |
|
@@ -426,7 +430,7 @@ string patterns:<pre> |
|
|
"junit.awtui.TestRunner" |
|
|
"junit.awtui.TestRunner" |
|
|
"junit.textui.TestRunner" |
|
|
"junit.textui.TestRunner" |
|
|
"java.lang.reflect.Method.invoke(" |
|
|
"java.lang.reflect.Method.invoke(" |
|
|
"org.apache.tools.ant."</pre></p> |
|
|
|
|
|
|
|
|
"org.apache.tools.ant."</pre></p> |
|
|
<hr> |
|
|
<hr> |
|
|
<p align="center">Copyright © 2001-2002 Apache Software Foundation. All rights |
|
|
<p align="center">Copyright © 2001-2002 Apache Software Foundation. All rights |
|
|
Reserved.</p> |
|
|
Reserved.</p> |
|
|