|
|
@@ -28,112 +28,115 @@ |
|
|
|
This task allows tests to be launched and run using the JUnit 5 framework. |
|
|
|
</p> |
|
|
|
<p> |
|
|
|
JUnit 5 introduced a newer set of APIs to write and launch tests. It also introduced |
|
|
|
the concept of test engines. Test engines decide which classes are considered as testcases |
|
|
|
and how they are executed. JUnit 5 supports running tests that have been written using |
|
|
|
JUnit 4 constructs as well as tests that have been written using JUnit 5 constructs. |
|
|
|
For more details about JUnit 5 itself, please refer to the JUnit 5 project's documentation at |
|
|
|
<a href="https://junit.org/junit5/">https://junit.org/junit5/</a>. |
|
|
|
JUnit 5 introduced a newer set of APIs to write and launch tests. It also introduced the concept |
|
|
|
of test engines. Test engines decide which classes are considered as testcases and how they are |
|
|
|
executed. JUnit 5 supports running tests that have been written using JUnit 4 constructs as well |
|
|
|
as tests that have been written using JUnit 5 constructs. For more details about JUnit 5 |
|
|
|
itself, please refer to the JUnit 5 project's documentation |
|
|
|
at <a href="https://junit.org/junit5/">https://junit.org/junit5/</a>. |
|
|
|
</p> |
|
|
|
<p> |
|
|
|
The goal of this <code>junitlauncher</code> task is to allow launching the JUnit 5 |
|
|
|
test launcher and building the test requests so that the selected tests can then be parsed |
|
|
|
and executed by the test engine(s) supported by JUnit 5. This task in itself does <i>not</i> |
|
|
|
understand what a test case is nor does it execute the tests itself. |
|
|
|
The goal of this <code>junitlauncher</code> task is to allow launching the JUnit 5 test launcher |
|
|
|
and building the test requests so that the selected tests can then be parsed and executed by the |
|
|
|
test engine(s) supported by JUnit 5. This task in itself does <i>not</i> understand what a test |
|
|
|
case is nor does it execute the tests itself. |
|
|
|
</p> |
|
|
|
<p> |
|
|
|
<strong>Note</strong>: This task depends on external libraries not included |
|
|
|
in the Apache Ant distribution. See <a href="../install.html#librarydependencies"> |
|
|
|
Library Dependencies</a> for more information. |
|
|
|
<strong>Note</strong>: This task depends on external libraries not included in the Apache Ant |
|
|
|
distribution. See <a href="../install.html#librarydependencies">Library Dependencies</a> for |
|
|
|
more information. |
|
|
|
</p> |
|
|
|
<p> |
|
|
|
<strong>Note</strong>: |
|
|
|
You must have the necessary JUnit 5 libraries in the classpath of the tests. At the time of |
|
|
|
writing this documentation, the list of JUnit 5 platform libraries that are necessary to run the tests |
|
|
|
are: |
|
|
|
<strong>Note</strong>: You must have the necessary JUnit 5 libraries in the classpath of the |
|
|
|
tests. At the time of writing this documentation, the list of JUnit 5 platform libraries that |
|
|
|
are necessary to run the tests are: |
|
|
|
</p> |
|
|
|
|
|
|
|
<ul> |
|
|
|
<li> |
|
|
|
junit-platform-commons.jar |
|
|
|
<samp>junit-platform-commons.jar</samp> |
|
|
|
</li> |
|
|
|
<li> |
|
|
|
junit-platform-engine.jar |
|
|
|
<samp>junit-platform-engine.jar</samp> |
|
|
|
</li> |
|
|
|
<li> |
|
|
|
junit-platform-launcher.jar |
|
|
|
<samp>junit-platform-launcher.jar</samp> |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
</p> |
|
|
|
|
|
|
|
<p> |
|
|
|
Depending on the test engine(s) that you want to use in your tests, you will further need the following |
|
|
|
libraries in the classpath |
|
|
|
Depending on the test engine(s) that you want to use in your tests, you will further need the |
|
|
|
following libraries in the classpath |
|
|
|
</p> |
|
|
|
|
|
|
|
<p> |
|
|
|
For <code>junit-vintage</code> engine: |
|
|
|
For <q>junit-vintage</q> engine: |
|
|
|
</p> |
|
|
|
|
|
|
|
<ul> |
|
|
|
<li> |
|
|
|
junit-vintage-engine.jar |
|
|
|
<samp>junit-vintage-engine.jar</samp> |
|
|
|
</li> |
|
|
|
<li> |
|
|
|
junit.jar (JUnit 4.x version) |
|
|
|
<samp>junit.jar</samp> (JUnit 4.x version) |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
</p> |
|
|
|
|
|
|
|
<p> |
|
|
|
For <code>junit-jupiter</code> engine: |
|
|
|
For <q>junit-jupiter</q> engine: |
|
|
|
</p> |
|
|
|
|
|
|
|
<ul> |
|
|
|
<li> |
|
|
|
junit-jupiter-api.jar |
|
|
|
<samp>junit-jupiter-api.jar</samp> |
|
|
|
</li> |
|
|
|
<li> |
|
|
|
junit-jupiter-engine.jar |
|
|
|
<samp>junit-jupiter-engine.jar</samp> |
|
|
|
</li> |
|
|
|
<li> |
|
|
|
opentest4j.jar |
|
|
|
<samp>opentest4j.jar</samp> |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
|
|
|
|
</p> |
|
|
|
<p> |
|
|
|
To have these in the test classpath, you can follow <i>either</i> of the following approaches: |
|
|
|
To have these in the test classpath, you can follow <em>either</em> of the following approaches: |
|
|
|
</p> |
|
|
|
|
|
|
|
<ul> |
|
|
|
<li>Put all these relevant jars along with the <code>ant-junitlauncher.jar</code> in <code>ANT_HOME/lib</code> |
|
|
|
directory |
|
|
|
</li> |
|
|
|
<li>OR Leave <code>ant-junitlauncher.jar</code> in the <code>ANT_HOME/lib</code> directory and include all |
|
|
|
other relevant jars in the classpath by passing them as a <code>-lib</code> option, while invoking Ant |
|
|
|
</li> |
|
|
|
<li>Put all these relevant jars along with the <samp>ant-junitlauncher.jar</samp> |
|
|
|
in <samp>ANT_HOME/lib</samp> directory</li> |
|
|
|
<li>OR Leave <samp>ant-junitlauncher.jar</samp> in the <samp>ANT_HOME/lib</samp> directory and |
|
|
|
include all other relevant jars in the classpath by passing them as a <kbd>-lib</kbd> |
|
|
|
option, while invoking Ant</li> |
|
|
|
</ul> |
|
|
|
</p> |
|
|
|
|
|
|
|
<p> |
|
|
|
Tests are defined by nested elements like <code>test</code>, |
|
|
|
<code>testclasses</code> tags (see <a href="#nested">nested |
|
|
|
elements</a>).</p> |
|
|
|
Tests are defined by nested elements like <code>test</code>, <code>testclasses</code> tags |
|
|
|
(see <a href="#nested">nested elements</a>). |
|
|
|
</p> |
|
|
|
|
|
|
|
<h3>Parameters</h3> |
|
|
|
<table> |
|
|
|
<table class="attr"> |
|
|
|
<tr> |
|
|
|
<td valign="top"><b>Attribute</b></td> |
|
|
|
<td valign="top"><b>Description</b></td> |
|
|
|
<td valign="top"><b>Required</b></td> |
|
|
|
<th>Attribute</th> |
|
|
|
<th>Description</th> |
|
|
|
<th>Required</th> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">haltOnFailure</td> |
|
|
|
<td valign="top">A value of <code>true</code> implies that build has to stop |
|
|
|
if any failure occurs in any of the tests. JUnit 5 classifies failures |
|
|
|
as both assertion failures as well as exceptions that get thrown during |
|
|
|
test execution. As such, this task too considers both these cases as |
|
|
|
failures and doesn't distinguish one from another. |
|
|
|
<td>haltOnFailure</td> |
|
|
|
<td>A value of <q>true</q> implies that build has to stop if any failure occurs in any of |
|
|
|
the tests. JUnit 4+ classifies failures as both assertion failures as well as exceptions |
|
|
|
that get thrown during test execution. As such, this task too considers both these cases |
|
|
|
as failures and doesn't distinguish one from another. |
|
|
|
</td> |
|
|
|
<td align="center" valign="top">No; default is <code>false</code>.</td> |
|
|
|
<td>No; default is <q>false</q></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">failureProperty</td> |
|
|
|
<td valign="top">The name of a property to set in the event of a failure |
|
|
|
<td>failureProperty</td> |
|
|
|
<td>The name of a property to set in the event of a failure |
|
|
|
(exceptions in tests are considered failures as well). |
|
|
|
</td> |
|
|
|
<td align="center" valign="top">No.</td> |
|
|
|
<td>No</td> |
|
|
|
</tr> |
|
|
|
</table> |
|
|
|
|
|
|
@@ -141,132 +144,141 @@ |
|
|
|
|
|
|
|
<h4>classpath</h4> |
|
|
|
<p> |
|
|
|
The nested <code><classpath></code> element that represents a |
|
|
|
<a href="../using.html#path">PATH like structure</a> can be used to configure |
|
|
|
the task to use this classpath for finding and running the tests. This classpath |
|
|
|
will be used for: |
|
|
|
The nested <code><classpath></code> element that represents |
|
|
|
a <a href="../using.html#path">PATH like structure</a> can be used to configure the task to use |
|
|
|
this classpath for finding and running the tests. This classpath will be used for: |
|
|
|
</p> |
|
|
|
<ul> |
|
|
|
<li>Finding the test classes to execute</li> |
|
|
|
<li>Finding the JUnit 5 framework libraries (which include the API jars and test engine jars). The complete |
|
|
|
set of jars that are relevant in JUnit 5 framework are listed in the <a href="#junit5deps">dependecies</a> |
|
|
|
section |
|
|
|
</li> |
|
|
|
<li>Finding the JUnit 5 framework libraries (which include the API jars and test engine |
|
|
|
jars). The complete set of jars that are relevant in JUnit 5 framework are listed in |
|
|
|
the <a href="#junit5deps">dependencies</a> section</li> |
|
|
|
</ul> |
|
|
|
If the <code>classpath</code> element isn't configured for the task, then the classpath of |
|
|
|
Ant itself will be used for finding the test classes and JUnit 5 libraries. |
|
|
|
|
|
|
|
<p> |
|
|
|
If the <code>classpath</code> element isn't configured for the task, then the classpath of Ant |
|
|
|
itself will be used for finding the test classes and JUnit 5 libraries. |
|
|
|
</p> |
|
|
|
|
|
|
|
<h4>listener</h4> |
|
|
|
|
|
|
|
<p> |
|
|
|
The <code>junitlauncher</code> task can be configured with <code>listener</code>(s) to listen |
|
|
|
to test execution events (such as a test execution starting, completing etc...). The listener |
|
|
|
is expected to be a class which implements the <code>org.junit.platform.launcher.TestExecutionListener</code>. |
|
|
|
This <code>TestExecutionListener</code> interface is an API exposed by the JUnit 5 platform APIs and isn't |
|
|
|
specific to Ant. As such, you can use any existing implementation of <code>TestExecutionListener</code> in |
|
|
|
this task. |
|
|
|
The <code>junitlauncher</code> task can be configured with <code>listener</code>(s) to listen to |
|
|
|
test execution events (such as a test execution starting, completing etc...). The listener is |
|
|
|
expected to be a class which implements |
|
|
|
the <code class="code">org.junit.platform.launcher.TestExecutionListener</code>. |
|
|
|
This <code class="code">TestExecutionListener</code> interface is an API exposed by the JUnit 5 |
|
|
|
platform APIs and isn't specific to Ant. As such, you can use any existing implementation |
|
|
|
of <code class="code">TestExecutionListener</code> in this task. |
|
|
|
</p> |
|
|
|
|
|
|
|
<h5>Test result formatter</h5> |
|
|
|
<p> |
|
|
|
<code>junitlauncher</code> provides a way where the test execution results can be formatted and presented |
|
|
|
in a way that's customizable. The task allows for configuring test result formatters, through the use of |
|
|
|
<code>listener</code> element. As noted previously, the <code>listener</code> element expects the listener |
|
|
|
to implement the <code>org.junit.platform.launcher.TestExecutionListener</code> interface. Typically, result |
|
|
|
formatters need a bit more configuration details to be fed to them, during the test execution - details |
|
|
|
like where to write out the formatted result. Any such listener can optionally implement |
|
|
|
the <code>org.apache.tools.ant.taskdefs.optional.junitlauncher.TestResultFormatter</code> interface. This interface |
|
|
|
is specific to Ant <code>junitlauncher</code> task and it extends the <code>org.junit.platform.launcher.TestExecutionListener</code> |
|
|
|
interface |
|
|
|
<code>junitlauncher</code> provides a way where the test execution results can be formatted and |
|
|
|
presented in a way that's customizable. The task allows for configuring test result formatters, |
|
|
|
through the use of <code>listener</code> element. As noted previously, the <code>listener</code> |
|
|
|
element expects the listener to implement |
|
|
|
the <code class="code">org.junit.platform.launcher.TestExecutionListener</code> |
|
|
|
interface. Typically, result formatters need a bit more configuration details to be fed to them, |
|
|
|
during the test execution—details like where to write out the formatted result. Any such |
|
|
|
listener can optionally implement |
|
|
|
the <code class="code">org.apache.tools.ant.taskdefs.optional.junitlauncher.TestResultFormatter</code> |
|
|
|
interface. This interface is specific to Ant <code>junitlauncher</code> task and it extends |
|
|
|
the <code class="code">org.junit.platform.launcher.TestExecutionListener</code> interface |
|
|
|
</p> |
|
|
|
<p> |
|
|
|
The <code>junitlauncher</code> task comes with the following pre-defined test result formatter types: |
|
|
|
The <code>junitlauncher</code> task comes with the following pre-defined test result formatter |
|
|
|
types: |
|
|
|
</p> |
|
|
|
<ul> |
|
|
|
<li> |
|
|
|
<code>legacy-plain</code> : This formatter prints a short statistics line for all test cases. |
|
|
|
<q>legacy-plain</q> : This formatter prints a short statistics line for all test |
|
|
|
cases. |
|
|
|
</li> |
|
|
|
<li> |
|
|
|
<code>legacy-brief</code> : This formatter prints information for tests that failed or were skipped. |
|
|
|
<q>legacy-brief</q> : This formatter prints information for tests that failed or were |
|
|
|
skipped. |
|
|
|
</li> |
|
|
|
<li> |
|
|
|
<code>legacy-xml</code> : This formatter prints statistics for the tests in xml format. |
|
|
|
<q>legacy-xml</q> : This formatter prints statistics for the tests in XML format. |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
<em>NOTE:</em> Each of these formatters, that are named "legacy" try, and format the results to be almost similar to |
|
|
|
what the <code>junit</code> task's formatters used to do. Furthermore, the <code>legacy-xml</code> formatters |
|
|
|
generates the XML to comply with the same schema that the <code>junit</code> task's XML formatter used to follow. |
|
|
|
As a result, the XML generated by this formatter, can be used as-is by the <code>junitreport</code> task. |
|
|
|
|
|
|
|
<p> |
|
|
|
<strong>Note</strong>: Each of these formatters named <q>legacy</q> try to format the results |
|
|
|
similar to what the <code>junit</code> task's formatters used to do. Furthermore, |
|
|
|
the <q>legacy-xml</q> formatter generates the XML to comply with the same schema that |
|
|
|
the <code>junit</code> task's XML formatter used to follow. As a result, the XML generated by |
|
|
|
this formatter, can be used as-is by the <code>junitreport</code> task. |
|
|
|
</p> |
|
|
|
|
|
|
|
The <code>listener</code> element supports the following attributes: |
|
|
|
|
|
|
|
<table> |
|
|
|
<p> |
|
|
|
The <code>listener</code> element supports the following attributes: |
|
|
|
</p> |
|
|
|
<table class="attr"> |
|
|
|
<tr> |
|
|
|
<td valign="top"><b>Attribute</b></td> |
|
|
|
<td valign="top"><b>Description</b></td> |
|
|
|
<td valign="top"><b>Required</b></td> |
|
|
|
<th>Attribute</th> |
|
|
|
<th>Description</th> |
|
|
|
<th>Required</th> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">type</td> |
|
|
|
<td valign="top">Use a predefined formatter (either |
|
|
|
<code>legacy-xml</code>, <code>legacy-plain</code> or <code>legacy-brief</code>). |
|
|
|
</td> |
|
|
|
<td align="center" rowspan="2">Exactly one of these</td> |
|
|
|
<td>type</td> |
|
|
|
<td>Use a predefined formatter (either <q>legacy-xml</q>, <q>legacy-plain</q> |
|
|
|
or <q>legacy-brief</q>).</td> |
|
|
|
<td rowspan="2">Exactly one of these</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">classname</td> |
|
|
|
<td valign="top">Name of a listener class which implements <code>org.junit.platform.launcher.TestExecutionListener</code> |
|
|
|
or the <code>org.apache.tools.ant.taskdefs.optional.junitlauncher.TestResultFormatter</code> interface |
|
|
|
<td>classname</td> |
|
|
|
<td class="left">Name of a listener class which |
|
|
|
implements <code>org.junit.platform.launcher.TestExecutionListener</code> or |
|
|
|
the <code>org.apache.tools.ant.taskdefs.optional.junitlauncher.TestResultFormatter</code> |
|
|
|
interface |
|
|
|
</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">resultFile</td> |
|
|
|
<td valign="top">The file name to which the formatted result needs to be written to. This attribute is only |
|
|
|
relevant |
|
|
|
when the listener class implements the <code>org.apache.tools.ant.taskdefs.optional.junitlauncher.TestResultFormatter</code> |
|
|
|
<td>resultFile</td> |
|
|
|
<td> |
|
|
|
The file name to which the formatted result needs to be written to. This attribute is |
|
|
|
only relevant when the listener class implements |
|
|
|
the <code>org.apache.tools.ant.taskdefs.optional.junitlauncher.TestResultFormatter</code> |
|
|
|
interface. |
|
|
|
<p> If no value is specified for this attribute and the listener implements the |
|
|
|
<code>org.apache.tools.ant.taskdefs.optional.junitlauncher.TestResultFormatter</code> then the file name |
|
|
|
will be defaulted |
|
|
|
to and will be of the form <code>TEST-<testname>.<formatter-specific-extension></code> |
|
|
|
(ex: TEST-org.myapp.SomeTest.xml for the <code>legacy-xml</code> type formatter) |
|
|
|
<p> |
|
|
|
If no value is specified for this attribute and the listener implements |
|
|
|
the <code>org.apache.tools.ant.taskdefs.optional.junitlauncher.TestResultFormatter</code> |
|
|
|
then the file name will be defaulted to and will be of the |
|
|
|
form <code>TEST-<i>testname</i>.<i>formatter-specific-extension</i></code> |
|
|
|
(ex: <samp>TEST-org.myapp.SomeTest.xml</samp> for the <q>legacy-xml</q> type |
|
|
|
formatter) |
|
|
|
</p> |
|
|
|
</td> |
|
|
|
<td align="center">No</td> |
|
|
|
<td>No</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">sendSysOut</td> |
|
|
|
<td valign="top">If set to <code>true</code> then the listener will be passed the <code>stdout</code> content |
|
|
|
generated by the test(s). This attribute is relevant only if the listener |
|
|
|
class implements the <code>org.apache.tools.ant.taskdefs.optional.junitlauncher.TestResultFormatter</code> |
|
|
|
interface. |
|
|
|
</td> |
|
|
|
<td align="center">No; defaults to <code>false</code></td> |
|
|
|
<td>sendSysOut</td> |
|
|
|
<td>If set to <q>true</q> then the listener will be passed the <code>stdout</code> content |
|
|
|
generated by the test(s). This attribute is relevant only if the listener class |
|
|
|
implements |
|
|
|
the <code>org.apache.tools.ant.taskdefs.optional.junitlauncher.TestResultFormatter</code> |
|
|
|
interface.</td> |
|
|
|
<td>No; defaults to <q>false</q></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">sendSysErr</td> |
|
|
|
<td valign="top">If set to <code>true</code> then the listener will be passed the <code>stderr</code> content |
|
|
|
generated by the test(s). This attribute is relevant only if the listener |
|
|
|
class implements the <code>org.apache.tools.ant.taskdefs.optional.junitlauncher.TestResultFormatter</code> |
|
|
|
interface. |
|
|
|
</td> |
|
|
|
<td align="center">No; defaults to <code>false</code></td> |
|
|
|
<td>sendSysErr</td> |
|
|
|
<td>If set to <q>true</q> then the listener will be passed the <code>stderr</code> content |
|
|
|
generated by the test(s). This attribute is relevant only if the listener class |
|
|
|
implements |
|
|
|
the <code>org.apache.tools.ant.taskdefs.optional.junitlauncher.TestResultFormatter</code> |
|
|
|
interface.</td> |
|
|
|
<td>No; defaults to <q>false</q></td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">if</td> |
|
|
|
<td valign="top">Only use this listener <a href="../properties.html#if+unless">if the named property is set</a>. |
|
|
|
</td> |
|
|
|
<td align="center">No</td> |
|
|
|
<td>if</td> |
|
|
|
<td>Only use this listener <a href="../properties.html#if+unless">if the named property is |
|
|
|
set</a>.</td> |
|
|
|
<td>No</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">unless</td> |
|
|
|
<td valign="top">Only use this listener <a href="../properties.html#if+unless">if the named property is |
|
|
|
<b>not</b> |
|
|
|
set</a>. |
|
|
|
</td> |
|
|
|
<td align="center">No</td> |
|
|
|
<td>unless</td> |
|
|
|
<td>Only use this listener <a href="../properties.html#if+unless">if the named property |
|
|
|
is <strong>not</strong> set</a>.</td> |
|
|
|
<td>No</td> |
|
|
|
</tr> |
|
|
|
</table> |
|
|
|
|
|
|
@@ -274,58 +286,52 @@ The <code>listener</code> element supports the following attributes: |
|
|
|
|
|
|
|
<p>Defines a single test class.</p> |
|
|
|
|
|
|
|
<table> |
|
|
|
<table class="attr"> |
|
|
|
<tr> |
|
|
|
<td valign="top"><b>Attribute</b></td> |
|
|
|
<td valign="top"><b>Description</b></td> |
|
|
|
<td valign="top"><b>Required</b></td> |
|
|
|
<th>Attribute</th> |
|
|
|
<th>Description</th> |
|
|
|
<th>Required</th> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">name</td> |
|
|
|
<td valign="top">Fully qualified name of the test class.</td> |
|
|
|
<td align="center">Yes</td> |
|
|
|
<td>name</td> |
|
|
|
<td>Fully qualified name of the test class.</td> |
|
|
|
<td>Yes</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">methods</td> |
|
|
|
<td valign="top">Comma-separated list of names of test case methods to execute. |
|
|
|
If this is specified, then only these test methods from the test class will be |
|
|
|
executed. |
|
|
|
</td> |
|
|
|
<td align="center">No</td> |
|
|
|
<td>methods</td> |
|
|
|
<td>Comma-separated list of names of test case methods to execute. If this is specified, |
|
|
|
then only these test methods from the test class will be executed.</td> |
|
|
|
<td>No</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">haltOnFailure</td> |
|
|
|
<td valign="top">Stop the build process if a failure occurs during the test |
|
|
|
run (exceptions are considered as failures too). |
|
|
|
Overrides value set on <code>junitlauncher</code> element. |
|
|
|
</td> |
|
|
|
<td align="center" valign="top">No</td> |
|
|
|
<td>haltOnFailure</td> |
|
|
|
<td>Stop the build process if a failure occurs during the test run (exceptions are |
|
|
|
considered as failures too). Overrides value set on <code>junitlauncher</code> |
|
|
|
element.</td> |
|
|
|
<td>No</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">failureProperty</td> |
|
|
|
<td valign="top">The name of a property to set in the event of a failure |
|
|
|
(exceptions are considered failures as well). Overrides value set on |
|
|
|
<code>junitlauncher</code> element. |
|
|
|
</td> |
|
|
|
<td align="center" valign="top">No</td> |
|
|
|
<td>failureProperty</td> |
|
|
|
<td>The name of a property to set in the event of a failure (exceptions are considered |
|
|
|
failures as well). Overrides value set on <code>junitlauncher</code> element.</td> |
|
|
|
<td>No</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">outputDir</td> |
|
|
|
<td valign="top">Directory to write the reports to.</td> |
|
|
|
<td align="center" valign="top">No; default is the base directory of the project.</td> |
|
|
|
<td>outputDir</td> |
|
|
|
<td>Directory to write the reports to.</td> |
|
|
|
<td>No; default is the base directory of the project.</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">if</td> |
|
|
|
<td valign="top">Only run this test <a href="../properties.html#if+unless">if the named property is set</a>. |
|
|
|
</td> |
|
|
|
<td align="center" valign="top">No</td> |
|
|
|
<td>if</td> |
|
|
|
<td>Only run this test <a href="../properties.html#if+unless">if the named property is |
|
|
|
set</a>.</td> |
|
|
|
<td>No</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">unless</td> |
|
|
|
<td valign="top">Only run this test <a href="../properties.html#if+unless">if the named property is <b>not</b> |
|
|
|
set</a>. |
|
|
|
</td> |
|
|
|
<td align="center" valign="top">No</td> |
|
|
|
<td>unless</td> |
|
|
|
<td>Only run this test <a href="../properties.html#if+unless">if the named property |
|
|
|
is <strong>not</strong> set</a>.</td> |
|
|
|
<td>No</td> |
|
|
|
</tr> |
|
|
|
</table> |
|
|
|
|
|
|
@@ -338,57 +344,53 @@ The <code>listener</code> element supports the following attributes: |
|
|
|
<p>Define a number of tests based on pattern matching.</p> |
|
|
|
|
|
|
|
<p> |
|
|
|
<code>testclasses</code> collects the included <a href="../Types/resources.html">resources</a> from any number |
|
|
|
of nested <a |
|
|
|
href="../Types/resources.html#collection">Resource Collection</a>s. It then |
|
|
|
selects each resource whose name ends in <code>.class</code>. These classes are then passed on to the |
|
|
|
JUnit 5 platform for it to decide and run them as tests. |
|
|
|
<code>testclasses</code> collects the included <a href="../Types/resources.html">resources</a> |
|
|
|
from any number of nested <a href="../Types/resources.html#collection">Resource |
|
|
|
Collection</a>s. It then selects each resource whose name ends in <code>.class</code>. These |
|
|
|
classes are then passed on to the JUnit 5 platform for it to decide and run them as tests. |
|
|
|
</p> |
|
|
|
|
|
|
|
<table> |
|
|
|
<table class="attr"> |
|
|
|
<tr> |
|
|
|
<td valign="top"><b>Attribute</b></td> |
|
|
|
<td valign="top"><b>Description</b></td> |
|
|
|
<td valign="top"><b>Required</b></td> |
|
|
|
<th>Attribute</th> |
|
|
|
<th>Description</th> |
|
|
|
<th>Required</th> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">haltOnFailure</td> |
|
|
|
<td valign="top">Stop the build process if a failure occurs during the test |
|
|
|
run (exceptions are considered as failures too). |
|
|
|
Overrides value set on <code>junitlauncher</code> element. |
|
|
|
</td> |
|
|
|
<td align="center" valign="top">No</td> |
|
|
|
<td>haltOnFailure</td> |
|
|
|
<td>Stop the build process if a failure occurs during the test run (exceptions are |
|
|
|
considered as failures too). Overrides value set on <code>junitlauncher</code> |
|
|
|
element.</td> |
|
|
|
<td>No</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">failureProperty</td> |
|
|
|
<td valign="top">The name of a property to set in the event of a failure |
|
|
|
(exceptions are considered failures as well). Overrides value set on |
|
|
|
<code>junitlauncher</code> element. |
|
|
|
</td> |
|
|
|
<td align="center" valign="top">No</td> |
|
|
|
<td>failureProperty</td> |
|
|
|
<td>The name of a property to set in the event of a failure (exceptions are considered |
|
|
|
failures as well). Overrides value set on <code>junitlauncher</code> element.</td> |
|
|
|
<td>No</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">outputDir</td> |
|
|
|
<td valign="top">Directory to write the reports to.</td> |
|
|
|
<td align="center" valign="top">No; default is the base directory of the project.</td> |
|
|
|
<td>outputDir</td> |
|
|
|
<td>Directory to write the reports to.</td> |
|
|
|
<td>No; default is the base directory of the project.</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">if</td> |
|
|
|
<td valign="top">Only run the tests <a href="../properties.html#if+unless">if the named property is set</a>. |
|
|
|
</td> |
|
|
|
<td align="center" valign="top">No</td> |
|
|
|
<td>if</td> |
|
|
|
<td>Only run the tests <a href="../properties.html#if+unless">if the named property is |
|
|
|
set</a>.</td> |
|
|
|
<td>No</td> |
|
|
|
</tr> |
|
|
|
<tr> |
|
|
|
<td valign="top">unless</td> |
|
|
|
<td valign="top">Only run the tests <a href="../properties.html#if+unless">if the named property is <b>not</b> |
|
|
|
set</a>. |
|
|
|
</td> |
|
|
|
<td align="center" valign="top">No</td> |
|
|
|
<td>unless</td> |
|
|
|
<td>Only run the tests <a href="../properties.html#if+unless">if the named property |
|
|
|
is <strong>not</strong> set</a>.</td> |
|
|
|
<td>No</td> |
|
|
|
</tr> |
|
|
|
</table> |
|
|
|
|
|
|
|
<p> |
|
|
|
<code>testclasses</code> can define their own listeners via nested <code>listener</code> elements. |
|
|
|
<code>testclasses</code> can define their own listeners via nested <code>listener</code> |
|
|
|
elements. |
|
|
|
</p> |
|
|
|
|
|
|
|
<h3>Examples</h3> |
|
|
@@ -401,12 +403,10 @@ The <code>listener</code> element supports the following attributes: |
|
|
|
<junitlauncher> |
|
|
|
<classpath refid="test.classpath"/> |
|
|
|
<test name="org.myapp.SimpleTest"/> |
|
|
|
</junitlauncher> |
|
|
|
|
|
|
|
</pre> |
|
|
|
</junitlauncher></pre> |
|
|
|
|
|
|
|
<p> |
|
|
|
Launches the JUnit 5 platform to run the <code>org.myapp.SimpleTest</code> test |
|
|
|
Launches the JUnit 5 platform to run the <samp>org.myapp.SimpleTest</samp> test |
|
|
|
</p> |
|
|
|
|
|
|
|
<pre> |
|
|
@@ -418,20 +418,20 @@ The <code>listener</code> element supports the following attributes: |
|
|
|
</pre> |
|
|
|
|
|
|
|
<p> |
|
|
|
Launches the JUnit 5 platform to run the <code>org.myapp.SimpleTest</code> and the |
|
|
|
<code>org.myapp.AnotherTest</code> tests. The build process will be stopped if any |
|
|
|
test, in the <code>org.myapp.SimpleTest</code>, fails. |
|
|
|
Launches the JUnit 5 platform to run the <samp>org.myapp.SimpleTest</samp> and |
|
|
|
the <samp>org.myapp.AnotherTest</samp> tests. The build process will be stopped if any test, in |
|
|
|
the <samp>org.myapp.SimpleTest</samp>, fails. |
|
|
|
</p> |
|
|
|
|
|
|
|
<pre> |
|
|
|
<junitlauncher> |
|
|
|
<classpath refid="test.classpath"/> |
|
|
|
<test name="org.myapp.SimpleTest" methods="testFoo, testBar"/> |
|
|
|
</junitlauncher> |
|
|
|
</pre> |
|
|
|
</junitlauncher></pre> |
|
|
|
|
|
|
|
<p> |
|
|
|
Launches the JUnit 5 platform to run only the <code>testFoo</code> and <code>testBar</code> methods of the |
|
|
|
<code>org.myapp.SimpleTest</code> test class. |
|
|
|
Launches the JUnit 5 platform to run only the <samp>testFoo</samp> and <samp>testBar</samp> |
|
|
|
methods of the <samp>org.myapp.SimpleTest</samp> test class. |
|
|
|
</p> |
|
|
|
|
|
|
|
<pre> |
|
|
@@ -443,12 +443,12 @@ The <code>listener</code> element supports the following attributes: |
|
|
|
<include name="org/example/**/tests/**/"/> |
|
|
|
</fileset> |
|
|
|
</testclasses> |
|
|
|
</junitlauncher> |
|
|
|
</pre> |
|
|
|
</junitlauncher></pre> |
|
|
|
|
|
|
|
<p> |
|
|
|
Selects any <code>.class</code> files that match the <code>org/example/**/tests/**/</code> <code>fileset</code> |
|
|
|
filter, under the <code>${build.classes.dir}</code> and passes those classes to the JUnit 5 platform for |
|
|
|
Selects any <samp>.class</samp> files that match |
|
|
|
the <samp>org/example/**/tests/**/</samp> <code>fileset</code> filter, under |
|
|
|
the <samp>${build.classes.dir}</samp> and passes those classes to the JUnit 5 platform for |
|
|
|
execution as tests. |
|
|
|
</p> |
|
|
|
|
|
|
@@ -463,19 +463,17 @@ The <code>listener</code> element supports the following attributes: |
|
|
|
<listener type="legacy-xml" sendSysOut="true" sendSysErr="true"/> |
|
|
|
<listener type="legacy-plain" sendSysOut="true" /> |
|
|
|
</testclasses> |
|
|
|
</junitlauncher> |
|
|
|
</pre> |
|
|
|
</junitlauncher></pre> |
|
|
|
<p> |
|
|
|
Selects any <code>.class</code> files that match the <code>org/example/**/tests/**/</code> <code>fileset</code> |
|
|
|
filter, under the <code>${build.classes.dir}</code> and passes those classes to the JUnit 5 platform for |
|
|
|
execution as tests. Test results will be written out to the <code>${output.dir}</code> by the |
|
|
|
<code>legacy-xml</code> and <code>legacy-plain</code> formatters, in separate files. |
|
|
|
Furthermore, both the <code>legacy-xml</code> and the <code>legacy-plain</code> |
|
|
|
listeners, above, are configured to receive the standard output content generated by the tests. |
|
|
|
The <code>legacy-xml</code> listener is configured to receive standard error content as well. |
|
|
|
|
|
|
|
Selects any <samp>.class</samp> files that match |
|
|
|
the <samp>org/example/**/tests/**/</samp> <code>fileset</code> filter, under |
|
|
|
the <samp>${build.classes.dir}</samp> and passes those classes to the JUnit 5 platform for |
|
|
|
execution as tests. Test results will be written out to the <samp>${output.dir}</samp> by |
|
|
|
the <q>legacy-xml</q> and <q>legacy-plain</q> formatters, in separate files. Furthermore, both |
|
|
|
the <q>legacy-xml</q> and the <q>legacy-plain</q> listeners, above, are configured to receive |
|
|
|
the standard output content generated by the tests. The <q>legacy-xml</q> listener is |
|
|
|
configured to receive standard error content as well. |
|
|
|
</p> |
|
|
|
|
|
|
|
|
|
|
|
</body> |
|
|
|
</html> |