The junit task runs unit-level tests developed in Junits testing framework.
printsummary: When set to on, prints one line of statistics for each test case.
fork: When set to on, runs the test in a JVM separate from the one in which Ant is running.
haltonerror: When set to on, fails the build if an error occurs during the testing.
haltonfailure: When set to on, fails the build if a test fails.
timeout: Skips a test if it doesnt finish in a given amount of time. Specified in milliseconds .
maxmemory: Maximum amount of memory for the new JVM.
jvm: Command used to invoke a new JVM. Default value is Java.
dir: The directory to invoke a new JVM.
classpath: Allows tasks to use paths and class paths efficiently (see section Frequently Used Nested Parameters and Elements at the end of this chapter).
jvmarg: Allows properties to be passed to the new JVM:
<jvmarg value="-Dfoo=baz"/>
value: The property key and value specified for the new JVMs use:
D<key>=<value>
sysproperty: Allows properties to be used by the test classes as they run:
<sysproperty key="foo" value="bla"/>
key: Name of the property.
value: Text associated with the key.
formatter: Prints test results with a specified format
type*: Either xml or plain; plain outputs a text file, and xml outputs XML.
classname: Name of a custom formatter class.
extension: Extension on the file name for use with the custom class.
usefile: When set to false, the output wont go to a file.
test: Runs a single Junit test.
name*: Name of the test class to run.
fork: When set to yes, a new JVM will be used.
fork: When set to on, runs the test in a separate JVM from the one in which Ant is running.
haltonerror: When set to on, fails the build if an error occurs during the testing.
haltonfailure: When set to on, fails the build if a test fails.
todir: Directory the reports will write to.
outfile: Base name of the report file.
if: Evaluates whether a property exists before running a test.
unless: Evaluates whether a property does not exists before running a test.
batchtest: Runs many Junit test with a nested file set.
fork: When set to on, runs the test in a JVM separate from the one in which Ant is running.
haltonerror: When set to on, fails the build if an error occurs during the testing.
todir: Directory the reports will write to.
if: Evaluates whether a property exists before running a test.
unless: Evaluates whether a property does not exist before running a test.
The junitreport task transforms the XML output from a Junit tasks tests into an HTML-based report:
<junitreport todir="./foo"> <fileset dir="./bla"> <include name="TEST-*.xml"/> </fileset> <report format="frames" todir="./reports"/> </junitreport>
tofile: File name to hold a list of all the files generated by the Junit task; defaults to TESTS-TestSuites.xml.
todir : Directory to which to write the file specified in the tofile parameter.
fileset: Specifies a collections of files (see section Frequently Used Nested Parameters and Elements at the end of this chapter for more information).
report: Generates reports for the JUnit tests.
format: Set to frames or no frames; defaults to frames.
styledir: Directory where style sheets are defined; defaults to embedded style sheets.
todir: Directory where the final HTML files are written.
extension: Extension for the final reports; defaults to HTML.