You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

junitlauncher.html 23 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <html>
  16. <head>
  17. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  18. <title>JUnitLauncher Task</title>
  19. </head>
  20. <body>
  21. <h2 id="junitlauncher">JUnitLauncher</h2>
  22. <h3>Description</h3>
  23. <p>
  24. This task allows tests to be launched and run using the JUnit 5 framework.
  25. </p>
  26. <p>
  27. JUnit 5 introduced a newer set of APIs to write and launch tests. It also introduced the concept
  28. of test engines. Test engines decide which classes are considered as testcases and how they are
  29. executed. JUnit 5 supports running tests that have been written using JUnit 4 constructs as well
  30. as tests that have been written using JUnit 5 constructs. For more details about JUnit 5
  31. itself, please refer to the JUnit 5 project's documentation
  32. at <a href="https://junit.org/junit5/">https://junit.org/junit5/</a>.
  33. </p>
  34. <p>
  35. The goal of this <code>junitlauncher</code> task is to allow launching the JUnit 5 test launcher
  36. and building the test requests so that the selected tests can then be parsed and executed by the
  37. test engine(s) supported by JUnit 5. This task in itself does <i>not</i> understand what a test
  38. case is nor does it execute the tests itself.
  39. </p>
  40. <p>
  41. <strong>Note</strong>: This task depends on external libraries not included in the Apache Ant
  42. distribution. See <a href="../install.html#librarydependencies">Library Dependencies</a> for
  43. more information.
  44. </p>
  45. <p>
  46. <strong>Note</strong>: You must have the necessary JUnit 5 libraries in the classpath of the
  47. tests. At the time of writing this documentation, the list of JUnit 5 platform libraries that
  48. are necessary to run the tests are:
  49. </p>
  50. <ul id="junit-platform-libraries">
  51. <li>
  52. <samp>junit-platform-commons.jar</samp>
  53. </li>
  54. <li>
  55. <samp>junit-platform-engine.jar</samp>
  56. </li>
  57. <li>
  58. <samp>junit-platform-launcher.jar</samp>
  59. </li>
  60. <li>
  61. <samp>opentest4j.jar</samp>
  62. </li>
  63. </ul>
  64. <p>
  65. Depending on the test engine(s) that you want to use in your tests, you will further need the
  66. following libraries in the classpath
  67. </p>
  68. <p id="junit-vintage-engine-libraries">
  69. For <q>junit-vintage</q> engine:
  70. </p>
  71. <ul>
  72. <li>
  73. <samp>junit-vintage-engine.jar</samp>
  74. </li>
  75. <li>
  76. <samp>junit.jar</samp> (JUnit 4.x version)
  77. </li>
  78. </ul>
  79. <p id="junit-jupiter-engine-libraries">
  80. For <q>junit-jupiter</q> engine:
  81. </p>
  82. <ul>
  83. <li>
  84. <samp>junit-jupiter-api.jar</samp>
  85. </li>
  86. <li>
  87. <samp>junit-jupiter-engine.jar</samp>
  88. </li>
  89. </ul>
  90. <p>
  91. To have these in the test classpath, you can follow <em>either</em> of the following approaches:
  92. </p>
  93. <ul>
  94. <li>Put all these relevant jars along with the <samp>ant-junitlauncher.jar</samp>
  95. in <samp>ANT_HOME/lib</samp> directory</li>
  96. <li>OR Leave <samp>ant-junitlauncher.jar</samp> in the <samp>ANT_HOME/lib</samp> directory and
  97. include all other relevant jars in the classpath by passing them as a <kbd>-lib</kbd>
  98. option, while invoking Ant</li>
  99. <li>OR Use the nested <code>&lt;classpath&gt;</code> element to specify the location of the
  100. test engines. For more details about this approach, please read the
  101. <a href=#test-engine-in-classpath>using classpath element to include test engines</a> section.
  102. </ul>
  103. <p>
  104. Tests are defined by nested elements like <code>test</code>, <code>testclasses</code> tags
  105. (see <a href="#nested">nested elements</a>).
  106. </p>
  107. <h3>Parameters</h3>
  108. <table class="attr">
  109. <tr>
  110. <th scope="col">Attribute</th>
  111. <th scope="col">Description</th>
  112. <th scope="col">Required</th>
  113. </tr>
  114. <tr>
  115. <td>haltOnFailure</td>
  116. <td>A value of <q>true</q> implies that build has to stop if any failure occurs in any of
  117. the tests. JUnit 4+ classifies failures as both assertion failures as well as exceptions
  118. that get thrown during test execution. As such, this task too considers both these cases
  119. as failures and doesn't distinguish one from another.
  120. </td>
  121. <td>No; default is <q>false</q></td>
  122. </tr>
  123. <tr>
  124. <td>failureProperty</td>
  125. <td>The name of a property to set in the event of a failure
  126. (exceptions in tests are considered failures as well).
  127. </td>
  128. <td>No</td>
  129. </tr>
  130. </table>
  131. <h3 id="nested">Nested Elements</h3>
  132. <h4>classpath</h4>
  133. <p>
  134. The nested <code>&lt;classpath&gt;</code> element that represents
  135. a <a href="../using.html#path">PATH like structure</a> can be used to configure the task to use
  136. this classpath for finding and running the tests. This classpath will be used for:
  137. </p>
  138. <ul>
  139. <li>Finding the test classes to execute</li>
  140. <li>Finding test engines that run the tests</li>
  141. </ul>
  142. <p>
  143. If the <code>classpath</code> element isn't configured for the task, then the classpath of Ant
  144. itself will be used for finding the test classes.
  145. </p>
  146. <h5 id="test-engine-in-classpath">Using the classpath element to include test engines</h5>
  147. <p>
  148. The <code>&lt;classpath&gt;</code> can be used to include the test engines that you want to be
  149. considered for execution of the tests.
  150. </p>
  151. <p>
  152. <strong>NOTE:</strong> An important aspect to remember is that
  153. whether or not you use this approach, the JUnit 5 platform libraries
  154. <a href="#junit-platform-libraries">listed earlier in this
  155. document</a> and the <code>ant-junitlauncher.jar</code>, <i>shouldn't</i> be part of this classpath
  156. and instead they must be included in Ant runtime's classpath either by placing them
  157. in <code>ANT_HOME/lib</code> or by passing the <code>-lib</code> option.
  158. </p>
  159. <p>
  160. Below is an example of setting up the classpath to include the Jupiter test engine during the
  161. execution of the tests. We assume that the JUnit 5 platform libraries and the
  162. <code>ant-junitlauncher.jar</code> have been setup as explained previously.
  163. <br/>
  164. <pre>
  165. &lt;project&gt;
  166. &lt;property name="output.dir" value="${basedir}/build"/&gt;
  167. &lt;property name="src.test.dir" value="${basedir}/src/test"/&gt;
  168. &lt;property name="build.classes.dir" value="${output.dir}/classes"/&gt;
  169. &lt;target name="init"&gt;
  170. &lt;mkdir dir="${output.dir}"/&gt;
  171. &lt;/target&gt;
  172. &lt;path id="junit.engine.jupiter.classpath"&gt;
  173. &lt;fileset dir="${basedir}/src/lib/jupiter/"/&gt;
  174. &lt;/path&gt;
  175. &lt;target name="compile-test" depends="init"&gt;
  176. &lt;mkdir dir="${build.classes.dir}"/&gt;
  177. &lt;javac srcdir="${src.test.dir}"
  178. destdir="${build.classes.dir}"&gt;
  179. &lt;classpath refid="junit.engine.jupiter.classpath"/&gt;
  180. &lt;/javac&gt;
  181. &lt;/target&gt;
  182. &lt;target name="test" depends="compile-test"&gt;
  183. &lt;junitlauncher&gt;
  184. &lt;classpath refid="junit.engine.jupiter.classpath"/&gt;
  185. &lt;classpath&gt;
  186. &lt;pathelement location="${build.classes.dir}"/&gt;
  187. &lt;/classpath&gt;
  188. &lt;testclasses outputdir="${output.dir}"&gt;
  189. &lt;fileset dir="${build.classes.dir}"/&gt;
  190. &lt;listener type="legacy-brief" sendSysOut="true"/&gt;
  191. &lt;listener type="legacy-xml" sendSysErr="true" sendSysOut="true"/&gt;
  192. &lt;/testclasses&gt;
  193. &lt;/junitlauncher&gt;
  194. &lt;/target&gt;
  195. &lt;/project&gt;
  196. </pre>
  197. In the example above, the <code>src/lib/jupiter</code> directory is expected to contain
  198. the Jupiter test engine related jars (which have been
  199. <a href="#junit-jupiter-engine-libraries">listed in an earlier section of this
  200. document</a>). In the <code>test</code> target we use the <code>classpath</code> nested element
  201. to point to the <code>junit.engine.jupiter.classpath</code> containing those jars. In this
  202. <code>test</code> target we also use another <code>classpath</code> element to point to
  203. the location containing our test classes. If required, both these classpath can be combined
  204. into one.
  205. </p>
  206. <h4>listener</h4>
  207. <p>
  208. The <code>junitlauncher</code> task can be configured with <code>listener</code>(s) to listen to
  209. test execution events (such as a test execution starting, completing etc...). The listener is
  210. expected to be a class which implements
  211. the <code class="code">org.junit.platform.launcher.TestExecutionListener</code>.
  212. This <code class="code">TestExecutionListener</code> interface is an API exposed by the JUnit 5
  213. platform APIs and isn't specific to Ant. As such, you can use any existing implementation
  214. of <code class="code">TestExecutionListener</code> in this task.
  215. </p>
  216. <h5>Test result formatter</h5>
  217. <p>
  218. <code>junitlauncher</code> provides a way where the test execution results can be formatted and
  219. presented in a way that's customizable. The task allows for configuring test result formatters,
  220. through the use of <code>listener</code> element. As noted previously, the <code>listener</code>
  221. element expects the listener to implement
  222. the <code class="code">org.junit.platform.launcher.TestExecutionListener</code>
  223. interface. Typically, result formatters need a bit more configuration details to be fed to them,
  224. during the test execution&mdash;details like where to write out the formatted result. Any such
  225. listener can optionally implement
  226. the <code class="code">org.apache.tools.ant.taskdefs.optional.junitlauncher.TestResultFormatter</code>
  227. interface. This interface is specific to Ant <code>junitlauncher</code> task and it extends
  228. the <code class="code">org.junit.platform.launcher.TestExecutionListener</code> interface
  229. </p>
  230. <p>
  231. The <code>junitlauncher</code> task comes with the following pre-defined test result formatter
  232. types:
  233. </p>
  234. <ul>
  235. <li>
  236. <q>legacy-plain</q> : This formatter prints a short statistics line for all test
  237. cases.
  238. </li>
  239. <li>
  240. <q>legacy-brief</q> : This formatter prints information for tests that failed or were
  241. skipped.
  242. </li>
  243. <li>
  244. <q>legacy-xml</q> : This formatter prints statistics for the tests in XML format.
  245. </li>
  246. </ul>
  247. <p>
  248. <strong>Note</strong>: Each of these formatters named <q>legacy</q> try to format the results
  249. similar to what the <code>junit</code> task's formatters used to do. Furthermore,
  250. the <q>legacy-xml</q> formatter generates the XML to comply with the same schema that
  251. the <code>junit</code> task's XML formatter used to follow. As a result, the XML generated by
  252. this formatter, can be used as-is by the <code>junitreport</code> task.
  253. </p>
  254. <p>
  255. The <code>listener</code> element supports the following attributes:
  256. </p>
  257. <table class="attr">
  258. <tr>
  259. <th scope="col">Attribute</th>
  260. <th scope="col">Description</th>
  261. <th scope="col">Required</th>
  262. </tr>
  263. <tr>
  264. <td>type</td>
  265. <td>Use a predefined formatter (either <q>legacy-xml</q>, <q>legacy-plain</q>
  266. or <q>legacy-brief</q>).</td>
  267. <td rowspan="2">Exactly one of these</td>
  268. </tr>
  269. <tr>
  270. <td>classname</td>
  271. <td class="left">Name of a listener class which
  272. implements <code>org.junit.platform.launcher.TestExecutionListener</code> or
  273. the <code>org.apache.tools.ant.taskdefs.optional.junitlauncher.TestResultFormatter</code>
  274. interface
  275. </td>
  276. </tr>
  277. <tr>
  278. <td>resultFile</td>
  279. <td>
  280. The file name to which the formatted result needs to be written to. This attribute is
  281. only relevant when the listener class implements
  282. the <code>org.apache.tools.ant.taskdefs.optional.junitlauncher.TestResultFormatter</code>
  283. interface.
  284. <p>
  285. If no value is specified for this attribute and the listener implements
  286. the <code>org.apache.tools.ant.taskdefs.optional.junitlauncher.TestResultFormatter</code>
  287. then the file name will be defaulted to and will be of the
  288. form <code>TEST-<i>testname</i>.<i>formatter-specific-extension</i></code>
  289. (ex: <samp>TEST-org.myapp.SomeTest.xml</samp> for the <q>legacy-xml</q> type
  290. formatter)
  291. </p>
  292. </td>
  293. <td>No</td>
  294. </tr>
  295. <tr>
  296. <td>sendSysOut</td>
  297. <td>If set to <q>true</q> then the listener will be passed the <code>stdout</code> content
  298. generated by the test(s). This attribute is relevant only if the listener class
  299. implements
  300. the <code>org.apache.tools.ant.taskdefs.optional.junitlauncher.TestResultFormatter</code>
  301. interface.</td>
  302. <td>No; defaults to <q>false</q></td>
  303. </tr>
  304. <tr>
  305. <td>sendSysErr</td>
  306. <td>If set to <q>true</q> then the listener will be passed the <code>stderr</code> content
  307. generated by the test(s). This attribute is relevant only if the listener class
  308. implements
  309. the <code>org.apache.tools.ant.taskdefs.optional.junitlauncher.TestResultFormatter</code>
  310. interface.</td>
  311. <td>No; defaults to <q>false</q></td>
  312. </tr>
  313. <tr>
  314. <td>if</td>
  315. <td>Only use this listener <a href="../properties.html#if+unless">if the named property is
  316. set</a>.</td>
  317. <td>No</td>
  318. </tr>
  319. <tr>
  320. <td>unless</td>
  321. <td>Only use this listener <a href="../properties.html#if+unless">if the named property
  322. is <strong>not</strong> set</a>.</td>
  323. <td>No</td>
  324. </tr>
  325. </table>
  326. <h4>test</h4>
  327. <p>Defines a single test class.</p>
  328. <table class="attr">
  329. <tr>
  330. <th scope="col">Attribute</th>
  331. <th scope="col">Description</th>
  332. <th scope="col">Required</th>
  333. </tr>
  334. <tr>
  335. <td>name</td>
  336. <td>Fully qualified name of the test class.</td>
  337. <td>Yes</td>
  338. </tr>
  339. <tr>
  340. <td>methods</td>
  341. <td>Comma-separated list of names of test case methods to execute. If this is specified,
  342. then only these test methods from the test class will be executed.</td>
  343. <td>No</td>
  344. </tr>
  345. <tr>
  346. <td>haltOnFailure</td>
  347. <td>Stop the build process if a failure occurs during the test run (exceptions are
  348. considered as failures too). Overrides value set on <code>junitlauncher</code>
  349. element.</td>
  350. <td>No</td>
  351. </tr>
  352. <tr>
  353. <td>failureProperty</td>
  354. <td>The name of a property to set in the event of a failure (exceptions are considered
  355. failures as well). Overrides value set on <code>junitlauncher</code> element.</td>
  356. <td>No</td>
  357. </tr>
  358. <tr>
  359. <td>outputDir</td>
  360. <td>Directory to write the reports to.</td>
  361. <td>No; default is the base directory of the project.</td>
  362. </tr>
  363. <tr>
  364. <td>if</td>
  365. <td>Only run this test <a href="../properties.html#if+unless">if the named property is
  366. set</a>.</td>
  367. <td>No</td>
  368. </tr>
  369. <tr>
  370. <td>unless</td>
  371. <td>Only run this test <a href="../properties.html#if+unless">if the named property
  372. is <strong>not</strong> set</a>.</td>
  373. <td>No</td>
  374. </tr>
  375. <tr>
  376. <td>includeEngines</td>
  377. <td>A comma separated set of test engine ids. If specified, only these test engine(s)
  378. will be used for running the tests.
  379. <br/>
  380. For example: <code>includeEngines="junit-jupiter"</code> will only use the Jupiter
  381. test engine for execution of the tests and will ignore any other engines that might
  382. have been found in the classpath.
  383. </td>
  384. <td>No</td>
  385. </tr>
  386. <tr>
  387. <td>excludeEngines</td>
  388. <td>A comma separated set of test engine ids. If specified, these test engine(s)
  389. will be excluded when running the tests.
  390. <br/>
  391. For example: <code>excludeEngines="junit-vintage"</code> will exclude the vintage
  392. test engine during execution of the tests and will use any other engines that might
  393. have been found in the classpath.
  394. </td>
  395. <td>No</td>
  396. </tr>
  397. </table>
  398. <p>
  399. Tests can define their own listeners via nested <code>listener</code> elements.
  400. </p>
  401. <h4>testclasses</h4>
  402. <p>Define a number of tests based on pattern matching.</p>
  403. <p>
  404. <code>testclasses</code> collects the included <a href="../Types/resources.html">resources</a>
  405. from any number of nested <a href="../Types/resources.html#collection">Resource
  406. Collection</a>s. It then selects each resource whose name ends in <code>.class</code>. These
  407. classes are then passed on to the JUnit 5 platform for it to decide and run them as tests.
  408. </p>
  409. <table class="attr">
  410. <tr>
  411. <th scope="col">Attribute</th>
  412. <th scope="col">Description</th>
  413. <th scope="col">Required</th>
  414. </tr>
  415. <tr>
  416. <td>haltOnFailure</td>
  417. <td>Stop the build process if a failure occurs during the test run (exceptions are
  418. considered as failures too). Overrides value set on <code>junitlauncher</code>
  419. element.</td>
  420. <td>No</td>
  421. </tr>
  422. <tr>
  423. <td>failureProperty</td>
  424. <td>The name of a property to set in the event of a failure (exceptions are considered
  425. failures as well). Overrides value set on <code>junitlauncher</code> element.</td>
  426. <td>No</td>
  427. </tr>
  428. <tr>
  429. <td>outputDir</td>
  430. <td>Directory to write the reports to.</td>
  431. <td>No; default is the base directory of the project.</td>
  432. </tr>
  433. <tr>
  434. <td>if</td>
  435. <td>Only run the tests <a href="../properties.html#if+unless">if the named property is
  436. set</a>.</td>
  437. <td>No</td>
  438. </tr>
  439. <tr>
  440. <td>unless</td>
  441. <td>Only run the tests <a href="../properties.html#if+unless">if the named property
  442. is <strong>not</strong> set</a>.</td>
  443. <td>No</td>
  444. </tr>
  445. <tr>
  446. <td>includeEngines</td>
  447. <td>A comma separated set of test engine ids. If specified, only these test engine(s)
  448. will be used for running the tests.
  449. <br/>
  450. For example: <code>includeEngines="junit-jupiter"</code> will only use the Jupiter
  451. test engine for execution of the tests and will ignore any other engines that might
  452. have been found in the classpath.
  453. </td>
  454. <td>No</td>
  455. </tr>
  456. <tr>
  457. <td>excludeEngines</td>
  458. <td>A comma separated set of test engine ids. If specified, these test engine(s)
  459. will be excluded when running the tests.
  460. <br/>
  461. For example: <code>excludeEngines="junit-vintage"</code> will exclude the vintage
  462. test engine during execution of the tests and will use any other engines that might
  463. have been found in the classpath.
  464. </td>
  465. <td>No</td>
  466. </tr>
  467. </table>
  468. <p>
  469. <code>testclasses</code> can define their own listeners via nested <code>listener</code>
  470. elements.
  471. </p>
  472. <h3>Examples</h3>
  473. <p>
  474. Launch the JUnit 5 platform to run the <samp>org.myapp.SimpleTest</samp> test
  475. </p>
  476. <pre>
  477. &lt;path id="test.classpath"&gt;
  478. ...
  479. &lt;/path&gt;
  480. &lt;junitlauncher&gt;
  481. &lt;classpath refid="test.classpath"/&gt;
  482. &lt;test name="org.myapp.SimpleTest"/&gt;
  483. &lt;/junitlauncher&gt;</pre>
  484. <p>
  485. Launch the JUnit 5 platform to run the <samp>org.myapp.SimpleTest</samp> and
  486. the <samp>org.myapp.AnotherTest</samp> tests. The build process will be stopped if any test, in
  487. the <samp>org.myapp.SimpleTest</samp>, fails.
  488. </p>
  489. <pre>
  490. &lt;junitlauncher&gt;
  491. &lt;classpath refid="test.classpath"/&gt;
  492. &lt;test name="org.myapp.SimpleTest" haltOnFailure="true"/&gt;
  493. &lt;test name="org.myapp.AnotherTest"/&gt;
  494. &lt;/junitlauncher&gt;
  495. </pre>
  496. <p>
  497. Launch the JUnit 5 platform to run only the <samp>testFoo</samp> and <samp>testBar</samp>
  498. methods of the <samp>org.myapp.SimpleTest</samp> test class.
  499. </p>
  500. <pre>
  501. &lt;junitlauncher&gt;
  502. &lt;classpath refid="test.classpath"/&gt;
  503. &lt;test name="org.myapp.SimpleTest" methods="testFoo, testBar"/&gt;
  504. &lt;/junitlauncher&gt;</pre>
  505. <p>
  506. Select any <samp>.class</samp> files that match
  507. the <samp>org/example/**/tests/**/</samp> <code>fileset</code> filter, under
  508. the <samp>${build.classes.dir}</samp> and passes those classes to the JUnit 5 platform for
  509. execution as tests.
  510. </p>
  511. <pre>
  512. &lt;junitlauncher&gt;
  513. &lt;classpath refid="test.classpath"/&gt;
  514. &lt;testclasses outputdir="${output.dir}"&gt;
  515. &lt;fileset dir="${build.classes.dir}"&gt;
  516. &lt;include name="org/example/**/tests/**/"/&gt;
  517. &lt;/fileset&gt;
  518. &lt;/testclasses&gt;
  519. &lt;/junitlauncher&gt;</pre>
  520. <p>
  521. Select any <samp>.class</samp> files that match
  522. the <samp>org/example/**/tests/**/</samp> <code>fileset</code> filter, under
  523. the <samp>${build.classes.dir}</samp> and pass those classes to the JUnit 5 platform for
  524. execution as tests. Test results will be written out to the <samp>${output.dir}</samp> by
  525. the <q>legacy-xml</q> and <q>legacy-plain</q> formatters, in separate files. Furthermore, both
  526. the <q>legacy-xml</q> and the <q>legacy-plain</q> listeners, above, are configured to receive
  527. the standard output content generated by the tests. The <q>legacy-xml</q> listener is configured
  528. to receive standard error content as well.
  529. </p>
  530. <pre>
  531. &lt;junitlauncher&gt;
  532. &lt;classpath refid="test.classpath"/&gt;
  533. &lt;testclasses outputdir="${output.dir}"&gt;
  534. &lt;fileset dir="${build.classes.dir}"&gt;
  535. &lt;include name="org/example/**/tests/**/"/&gt;
  536. &lt;/fileset&gt;
  537. &lt;listener type="legacy-xml" sendSysOut="true" sendSysErr="true"/&gt;
  538. &lt;listener type="legacy-plain" sendSysOut="true" /&gt;
  539. &lt;/testclasses&gt;
  540. &lt;/junitlauncher&gt;</pre>
  541. </body>
  542. </html>