summaryrefslogtreecommitdiff
path: root/manual
diff options
context:
space:
mode:
authorStefan Bodewig <bodewig@apache.org>2016-07-13 20:28:32 +0200
committerStefan Bodewig <bodewig@apache.org>2016-09-11 12:10:15 +0200
commit31cc48c6f70b8c24f79aa5f17f80c32f8480e2f9 (patch)
tree29950f72f5b91df968a58dc011c8684c5150e79b /manual
parent1d7b624155b06f665c8b99014227bc1f87f9ec54 (diff)
downloadant-31cc48c6f70b8c24f79aa5f17f80c32f8480e2f9.tar.gz
JDK9 modules support for JUnit by Tomáš Zezula
this is the combined patch or #18 which couldn't be applied via `git am`
Diffstat (limited to 'manual')
-rw-r--r--manual/Tasks/junit.html59
1 files changed, 57 insertions, 2 deletions
diff --git a/manual/Tasks/junit.html b/manual/Tasks/junit.html
index 76df9ced6..9f6051217 100644
--- a/manual/Tasks/junit.html
+++ b/manual/Tasks/junit.html
@@ -371,6 +371,21 @@ subelement.</p>
<p><em>since Ant 1.6.</em></p>
+<h4>modulepath</h4>
+
+<p>The location of modules can be specified using this <a href="../using.html#path">PATH like structure</a>.<br/>
+The modulepath requires <i>fork</i> to be set to <code>true</code>.
+
+<p><em>since Ant 1.10</em></p>
+
+<h4>upgrademodulepath</h4>
+
+<p>The location of modules that replace upgradeable modules in the runtime image
+can be specified using this <a href="../using.html#path">PATH like structure</a>.<br/>
+The upgrademodulepath requires <i>fork</i> to be set to <code>true</code>.
+
+<p><em>since Ant 1.10</em></p>
+
<h4>formatter</h4>
<p>The results of the tests can be printed in different
@@ -796,7 +811,47 @@ the single <code>&lt;test/&gt;</code> will run. So only the failing test cases a
The two nested formatters are for displaying (for the user) and for updating the collector
class.
</p>
-
-
+<pre>
+ &lt;junit fork="true"
+ jvm="${platform.java}"&gt;
+ &lt;jvmarg value="-Xpatch:${module.name}=${build.test.classes}"/&gt;
+ &lt;jvmarg line="-addmods ${module.name}"/&gt;
+ &lt;jvmarg value="-XaddReads:${module.name}=ALL-UNNAMED"/&gt;
+ &lt;jvmarg value="-XaddExports:${module.name}/my.test=ALL-UNNAMED"/&gt;
+ &lt;classpath&gt;
+ &lt;pathelement path="${libs.junit}"/&gt;
+ &lt;/classpath&gt;
+ &lt;modulepath&gt;
+ &lt;pathelement path="${modules}:${build.classes}"/&gt;
+ &lt;/modulepath&gt;
+ &lt;formatter type="plain"/&gt;
+ &lt;test name="my.test.TestCase"/&gt;
+ &lt;/junit&gt;
+</pre>
+<p>Runs my.test.TestCase as a white-box test in the forked VM given by the <code>platform.java</code> property.
+The junit library is a part of an unnamed module while the tested project and required modules are on the module path. The tests
+do not have module-info file and are executed in the project module given by <code>module.name</code> property.<br/>
+The <code>-Xpatch</code> java option executes the tests built into <code>${build.test.classes}</code> in a module given
+by <code>module.name</code> property.<br/>
+The <code>-addmods</code> java option enables the tested module.<br/>
+The <code>-XaddReads</code> java option makes the unnamed module containing the junit readable by tested module.<br/>
+The <code>-XaddExports</code> java option makes the non-exported test package <code>my.test</code> accessible from the unnamed module containing the junit.<br/>
+<pre>
+ &lt;junit fork="true"
+ jvm="${platform.java}"&gt;
+ &lt;jvmarg line="-addmods ${test.module.name}"/&gt;
+ &lt;jvmarg value="-XaddExports:${test.module.name}/my.test=junit,ALL-UNNAMED"/&gt;
+ &lt;modulepath&gt;
+ &lt;pathelement path="${modules}:${build.classes}:${libs.junit}"/&gt;
+ &lt;/modulepath&gt;
+ &lt;formatter type="plain"/&gt;
+ &lt;test name="my.test.TestCase"/&gt;
+ &lt;/junit&gt;
+</pre>
+<p>Runs my.test.TestCase as a black-box test in the forked VM given by the <code>platform.java</code> property.
+The junit library is used as an automatic module. The tests module-info requires the tested module and junit.<br/>
+The <code>-addmods</code> java option enables the test module.<br/>
+The <code>-XaddExports</code> java option makes the non-exported test package <code>my.test</code> accessible from the junit module and Ant's test runner.
+Another possibility is to export the test package in the tests module-info by <code>exports my.test</code> directive.<br/>
</body>
</html>