Attribute | Description | Required |
printsummary | Print one-line statistics for each testcase. Can take the values on, off, and withOutAndErr. withOutAndErr is the same as on but also includes the output of the test as written to System.out and System.err. | No; default is off. |
fork | Run the tests in a separate VM. | No; default is off. |
haltonerror | Stop the build process if an error occurs during the test run. | No; default is off. |
errorproperty | The name of a property to set in the event of an error. | No |
haltonfailure | Stop the build process if a test fails (errors are considered failures as well). | No; default is off. |
failureproperty | The name of a property to set in the event of a failure (errors are considered failures as well). | No. |
filtertrace | Filter out Junit and Ant stack frames from error and failure stack traces. | No; default is on. |
timeout | Cancel the individual tests if they don't finish in the given time (measured in milliseconds). Ignored if fork is disabled. | No |
maxmemory | Maximum amount of memory to allocate to the forked VM. Ignored if fork is disabled. | No |
jvm | The command used to invoke the Java Virtual Machine, default is 'java'. The command is resolved by java.lang.Runtime.exec(). Ignored if fork is disabled. | No; default is java. |
dir | The directory in which to invoke the VM. Ignored if fork is disabled. | No |
newenvironment | Do not propagate the old environment when new environment variables are specified. Ignored if fork is disabled. | No; default is false. |
includeantruntime | Implicitly add the Ant classes required to run the tests and JUnit to the classpath in forked mode. | No; default is true. |
showoutput | Send any output generated by tests to Ant's logging system as well as to the formatters. By default only the formatters receive the output. | No |
By using the errorproperty and failureproperty attributes, it is possible to perform setup work (such as starting an external server), execute the test, clean up, and still fail the build in the event of a failure.
The filtertrace attribute condenses error and failure stack traces before reporting them. It works with both the plain and XML formatters. It filters out any lines that begin with the following string patterns:
"junit.framework.TestCase" "junit.framework.TestResult" "junit.framework.TestSuite" "junit.framework.Assert." "junit.swingui.TestRunner" "junit.awtui.TestRunner" "junit.textui.TestRunner" "java.lang.reflect.Method.invoke(" "org.apache.tools.ant."