Class AntUnit
java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.ant.antunit.AntUnit
- All Implemented Interfaces:
Cloneable
public class AntUnit
extends org.apache.tools.ant.Task
Run every target whose name starts with "test" in a set of build files.
Run the "setUp" target before each of them if present, same for "tearDown" after each "test*" target (targets named just "test" are ignored). If a target throws an AssertionFailedException, the test has failed; any other exception is considered an error (although BuildException will be scanned recursively for nested AssertionFailedExceptions).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classDefines a collection of inheritedreferences, with an optional nestedMapperthat maps them to new reference IDs in the target project. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringMessage if no tests have been specified.static final StringMessage if non-File resources have been specified.static final StringMessage to print if an error or failure occured.Fields inherited from class org.apache.tools.ant.Task
target, taskName, taskType, wrapperFields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(AntUnitListener al) Add a test listener.voidadd(org.apache.tools.ant.types.ResourceCollection rc) Add build files to run as tests.voidaddPropertySet(org.apache.tools.ant.types.PropertySet ps) Add a PropertySet.voidaddReference(AntUnit.Reference reference) Add an inherited reference.Add a set of inherited references.voidexecute()Execute the tests.voidhandleErrorFlush(String errorOutputToFlush) Redirect error flush to new project instance.voidhandleErrorOutput(String errorOutputToHandle) Redirect error output to new project instance.voidhandleFlush(String toFlush) Redirect flush to new project instance.inthandleInput(byte[] buffer, int offset, int length) Redirect input to new project instance.voidhandleOutput(String outputToHandle) Redirect output to new project instance.voidSet the name of a property to set if an error or failure occurs.voidsetFailOnError(boolean failOnError) Set whether to stop testing if an error or failure occurs?Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypeMethods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
-
Field Details
-
ERROR_TESTS_FAILED
Message to print if an error or failure occured.- See Also:
-
ERROR_NO_TESTS
-
ERROR_NON_FILES
Message if non-File resources have been specified.- See Also:
-
-
Constructor Details
-
AntUnit
public AntUnit()
-
-
Method Details
-
add
public void add(org.apache.tools.ant.types.ResourceCollection rc) Add build files to run as tests.- Parameters:
rc- the ResourceCollection to add.
-
add
Add a test listener.- Parameters:
al- the AntUnitListener to add.
-
addPropertySet
public void addPropertySet(org.apache.tools.ant.types.PropertySet ps) Add a PropertySet.- Parameters:
ps- the PropertySet to add.
-
createReferenceSet
Add a set of inherited references.- Returns:
- set of inherited references
-
addReference
Add an inherited reference.- Parameters:
reference- inherited reference
-
setErrorProperty
Set the name of a property to set if an error or failure occurs.- Parameters:
s- the name of the error property.
-
setFailOnError
public void setFailOnError(boolean failOnError) Set whether to stop testing if an error or failure occurs?- Parameters:
failOnError- defaulttrue
-
execute
public void execute()Execute the tests.- Overrides:
executein classorg.apache.tools.ant.Task
-
handleOutput
Redirect output to new project instance.- Overrides:
handleOutputin classorg.apache.tools.ant.Task- Parameters:
outputToHandle- the output to handle.
-
handleInput
Redirect input to new project instance.- Overrides:
handleInputin classorg.apache.tools.ant.Task- Parameters:
buffer- the buffer containing the input.offset- the offset intobuffer.length- the length of the data.- Throws:
IOException
-
handleFlush
Redirect flush to new project instance.- Overrides:
handleFlushin classorg.apache.tools.ant.Task- Parameters:
toFlush- the output String to flush.
-
handleErrorOutput
Redirect error output to new project instance.- Overrides:
handleErrorOutputin classorg.apache.tools.ant.Task- Parameters:
errorOutputToHandle- the error output to handle.
-
handleErrorFlush
Redirect error flush to new project instance.- Overrides:
handleErrorFlushin classorg.apache.tools.ant.Task- Parameters:
errorOutputToFlush- the error output to flush.
-