diff --git a/manual/Tasks/junitlauncher.html b/manual/Tasks/junitlauncher.html index fb362598d..1eb8b6b0e 100644 --- a/manual/Tasks/junitlauncher.html +++ b/manual/Tasks/junitlauncher.html @@ -102,15 +102,18 @@ To have these in the test classpath, you can follow either of the following approaches:
-<classpath>
element to specify the location of the
+ the rest of the JUnit specific jars (noted above). Please read the
+ using classpath element section for more details.<classpath>
element to specify the location of the
- test engines. For more details about this approach, please read the
- using classpath element to include test engines section.
@@ -153,7 +156,7 @@
The nested <classpath>
element that represents
a PATH like structure can be used to configure the task to use
@@ -162,29 +165,16 @@
If the classpath
element isn't configured for the task, then the classpath of Ant
- itself will be used for finding the test classes.
+ itself will be used for finding the test classes and the JUnit libraries.
- The <classpath>
can be used to include the test engines that you want to be
- considered for execution of the tests.
-
- NOTE: An important aspect to remember is that
- whether or not you use this approach, the JUnit 5 platform libraries
- listed earlier in this
- document and the ant-junitlauncher.jar
, shouldn't be part of this classpath
- and instead they must be included in Ant runtime's classpath either by placing them
- in ANT_HOME/lib
or by passing the -lib
option.
-
- Below is an example of setting up the classpath to include the Jupiter test engine during the
- execution of the tests. We assume that the JUnit 5 platform libraries and the
- ant-junitlauncher.jar
have been setup as explained previously.
+ Below is an example of setting up the classpath to include the Jupiter test engine and
+ the JUnit platform libraries during the execution of the tests.
<project> @@ -197,6 +187,10 @@ <mkdir dir="${output.dir}"/> </target> + <path id="junit.platform.libs.classpath"> + <fileset dir="${basedir}/src/lib/junit-platform/"/> + </path> + <path id="junit.engine.jupiter.classpath"> <fileset dir="${basedir}/src/lib/jupiter/"/> </path> @@ -205,14 +199,23 @@ <mkdir dir="${build.classes.dir}"/> <javac srcdir="${src.test.dir}" destdir="${build.classes.dir}"> + <!-- our tests only need JUnit Jupiter engine + libraries in our compile classpath for the tests --> <classpath refid="junit.engine.jupiter.classpath"/> </javac> </target> <target name="test" depends="compile-test"> <junitlauncher> + <!-- include the JUnit platform related libraries + required to run the tests --> + <classpath refid="junit.platform.libs.classpath"/> + + <!-- include the JUnit Jupiter engine libraries --> <classpath refid="junit.engine.jupiter.classpath"/> + <classpath> + <!-- the test classes themselves --> <pathelement location="${build.classes.dir}"/> </classpath> <testclasses outputdir="${output.dir}"> @@ -226,13 +229,22 @@ </project>- In the example above, the
src/lib/jupiter
directory is expected to contain
- the Jupiter test engine related jars (which have been
- listed in an earlier section of this
- document). In the test
target we use the classpath
nested element
- to point to the junit.engine.jupiter.classpath
containing those jars. In this
- test
target we also use another classpath
element to point to
- the location containing our test classes. If required, both these classpath can be combined
+ In the example above,
+ src/lib/jupiter
directory is expected to contain
+ the Jupiter test engine related jars (which have been
+ listed in an earlier section of this
+ document).src/lib/junit-platform
directory is expected to
+ contain the JUnit platform jars (which have been
+ listed in an earlier section of this
+ document)test
target we use the classpath
nested element
+ to point to the junit.engine.jupiter.classpath
and junit.platform.libs.classpath
+ containing those jars.
+ In this test
target we also use another classpath
element to point to
+ the location containing our test classes. If required, all these classpaths can be combined
into one.