public class AntUnit
extends org.apache.tools.ant.Task
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).
| Modifier and Type | Class and Description |
|---|---|
static class |
AntUnit.Reference |
static class |
AntUnit.ReferenceSet
Defines a collection of inherited
references,
with an optional nested Mapper that maps them to new
reference IDs in the target project. |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ERROR_NO_TESTS
Message if no tests have been specified.
|
static java.lang.String |
ERROR_NON_FILES
Message if non-File resources have been specified.
|
static java.lang.String |
ERROR_TESTS_FAILED
Message to print if an error or failure occured.
|
| Constructor and Description |
|---|
AntUnit() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(AntUnitListener al)
Add a test listener.
|
void |
add(org.apache.tools.ant.types.ResourceCollection rc)
Add build files to run as tests.
|
void |
addPropertySet(org.apache.tools.ant.types.PropertySet ps)
Add a PropertySet.
|
void |
addReference(AntUnit.Reference reference)
Add an inherited reference.
|
AntUnit.ReferenceSet |
createReferenceSet()
Add a set of inherited references.
|
void |
execute()
Execute the tests.
|
void |
handleErrorFlush(java.lang.String errorOutputToFlush)
Redirect error flush to new project instance.
|
void |
handleErrorOutput(java.lang.String errorOutputToHandle)
Redirect error output to new project instance.
|
void |
handleFlush(java.lang.String toFlush)
Redirect flush to new project instance.
|
int |
handleInput(byte[] buffer,
int offset,
int length)
Redirect input to new project instance.
|
void |
handleOutput(java.lang.String outputToHandle)
Redirect output to new project instance.
|
void |
setErrorProperty(java.lang.String s)
Set the name of a property to set if an error or failure occurs.
|
void |
setFailOnError(boolean failOnError)
Set whether to stop testing if an error or failure occurs?
|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypepublic static final java.lang.String ERROR_TESTS_FAILED
public static final java.lang.String ERROR_NO_TESTS
public static final java.lang.String ERROR_NON_FILES
public void add(org.apache.tools.ant.types.ResourceCollection rc)
rc - the ResourceCollection to add.public void add(AntUnitListener al)
al - the AntUnitListener to add.public void addPropertySet(org.apache.tools.ant.types.PropertySet ps)
ps - the PropertySet to add.public AntUnit.ReferenceSet createReferenceSet()
public void addReference(AntUnit.Reference reference)
reference - inherited referencepublic void setErrorProperty(java.lang.String s)
s - the name of the error property.public void setFailOnError(boolean failOnError)
failOnError - default truepublic void execute()
execute in class org.apache.tools.ant.Taskpublic void handleOutput(java.lang.String outputToHandle)
handleOutput in class org.apache.tools.ant.TaskoutputToHandle - the output to handle.public int handleInput(byte[] buffer,
int offset,
int length)
throws java.io.IOException
handleInput in class org.apache.tools.ant.Taskbuffer - the buffer containing the input.offset - the offset into buffer.length - the length of the data.java.io.IOExceptionpublic void handleFlush(java.lang.String toFlush)
handleFlush in class org.apache.tools.ant.TasktoFlush - the output String to flush.public void handleErrorOutput(java.lang.String errorOutputToHandle)
handleErrorOutput in class org.apache.tools.ant.TaskerrorOutputToHandle - the error output to handle.public void handleErrorFlush(java.lang.String errorOutputToFlush)
handleErrorFlush in class org.apache.tools.ant.TaskerrorOutputToFlush - the error output to flush.