Apache Ant JUnit Task
This task is used to run tests from the JUnit testing framework. This task is depend on external libraries that are not included in Apache Ant distribution by default.
The junit.jar and ant.junit.jar both are required to run this task, so put these JAR's in ANT_HOME/lib location.
The <junit> element is used in build.xml file to implement this task. It also supports a nested element <classpath> which presents path-like structure.
Apache Ant Junit Task Attributes
Let's see some examples to understand the functionalities of this testing task.
Apache Ant JUnit Task Example
The above example is running a test case defined into TestCase.
This example runs a separate JVM and run test on it. The fork attribute will run a new JVM.