# AntUnit (ant-antunit API)
declaration: package: org.apache.ant.antunit, class: AntUnit

# Klasse AntUnit

java.lang.Object
org.apache.tools.ant.ProjectComponent
org.apache.tools.ant.Task
org.apache.ant.antunit.AntUnit

Alle implementierten Schnittstellen:
  `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).

## Verschachtelte Klassen - Übersicht

Verschachtelte Klassen
Modifikator und Typ
Klasse
Beschreibung
`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.

## Feldübersicht

Felder
Modifikator und Typ
Feld
Beschreibung
`static final String`
`ERROR_NO_TESTS`
Message if no tests have been specified.
`static final String`
`ERROR_NON_FILES`
Message if non-File resources have been specified.
`static final String`
`ERROR_TESTS_FAILED`
Message to print if an error or failure occured.

### Von Klasse geerbte Felder org.apache.tools.ant.Task

`target, taskName, taskType, wrapper`

### Von Klasse geerbte Felder org.apache.tools.ant.ProjectComponent

`description, location, project`

## Konstruktorübersicht

Konstruktoren
Konstruktor
Beschreibung
`AntUnit()`

## Methodenübersicht

Modifikator und Typ
Methode
Beschreibung
`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.
`org.apache.tools.ant.types.Path`
`createClasspath()`
Create the nested classpath element.
`AntUnit.ReferenceSet`
`createReferenceSet()`
Add a set of inherited references.
`void`
`execute()`
Execute the tests.
`void`
`handleErrorFlush(String errorOutputToFlush)`
Redirect error flush to new project instance.
`void`
`handleErrorOutput(String errorOutputToHandle)`
Redirect error output to new project instance.
`void`
`handleFlush(String toFlush)`
Redirect flush to new project instance.
`int`
`handleInput(byte[] buffer, int offset, int length)`
Redirect input to new project instance.
`void`
`handleOutput(String outputToHandle)`
Redirect output to new project instance.
`void`
`setClasspathRefid(String classpathRefid)`
Set the test classpath as a reference to a `Path` defined elsewhere.
`void`
`setErrorProperty(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?

### Von Klasse geerbte Methoden org.apache.tools.ant.Task

`bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType`

### Von Klasse geerbte Methoden org.apache.tools.ant.ProjectComponent

`clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject`

### Von Klasse geerbte Methoden Object

`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Felddetails

### ERROR_TESTS_FAILED

public static final String ERROR_TESTS_FAILED
Message to print if an error or failure occured.

Siehe auch:
  - Konstantenfeldwerte

### ERROR_NO_TESTS

public static final String ERROR_NO_TESTS
Message if no tests have been specified.

Siehe auch:
  - Konstantenfeldwerte

### ERROR_NON_FILES

public static final String ERROR_NON_FILES
Message if non-File resources have been specified.

Siehe auch:
  - Konstantenfeldwerte

## Konstruktordetails

### AntUnit

public AntUnit()

## Methodendetails

### add

public void add(org.apache.tools.ant.types.ResourceCollection rc)
Add build files to run as tests.

Parameter:
  `rc` - the ResourceCollection to add.

### add

public void add(AntUnitListener al)
Add a test listener.

Parameter:
  `al` - the AntUnitListener to add.

### addPropertySet

public void addPropertySet(org.apache.tools.ant.types.PropertySet ps)
Add a PropertySet.

Parameter:
  `ps` - the PropertySet to add.

### createReferenceSet

public AntUnit.ReferenceSet createReferenceSet()
Add a set of inherited references.

Gibt zurück:
  set of inherited references

### addReference

public void addReference(AntUnit.Reference reference)
Add an inherited reference.

Parameter:
  `reference` - inherited reference

### setErrorProperty

public void setErrorProperty(String s)
Set the name of a property to set if an error or failure occurs.

Parameter:
  `s` - the name of the error property.

### setFailOnError

public void setFailOnError(boolean failOnError)
Set whether to stop testing if an error or failure occurs?

Parameter:
  `failOnError` - default `true`

### createClasspath

public org.apache.tools.ant.types.Path createClasspath()
Create the nested classpath element.

Gibt zurück:
  `Path`

### setClasspathRefid

public void setClasspathRefid(String classpathRefid)
Set the test classpath as a reference to a `Path` defined elsewhere.

Parameter:
  `classpathRefid` -

### execute

public void execute()
Execute the tests.

Setzt außer Kraft:
  `execute` in Klasse `org.apache.tools.ant.Task`

### handleOutput

public void handleOutput(String outputToHandle)
Redirect output to new project instance.

Setzt außer Kraft:
  `handleOutput` in Klasse `org.apache.tools.ant.Task`
Parameter:
  `outputToHandle` - the output to handle.

### handleInput

public int handleInput(byte[] buffer, int offset, int length) throws IOException
Redirect input to new project instance.

Setzt außer Kraft:
  `handleInput` in Klasse `org.apache.tools.ant.Task`
Parameter:
  `buffer` - the buffer containing the input.
  `offset` - the offset into `buffer`.
  `length` - the length of the data.
Löst aus:
  `IOException`

### handleFlush

public void handleFlush(String toFlush)
Redirect flush to new project instance.

Setzt außer Kraft:
  `handleFlush` in Klasse `org.apache.tools.ant.Task`
Parameter:
  `toFlush` - the output String to flush.

### handleErrorOutput

public void handleErrorOutput(String errorOutputToHandle)
Redirect error output to new project instance.

Setzt außer Kraft:
  `handleErrorOutput` in Klasse `org.apache.tools.ant.Task`
Parameter:
  `errorOutputToHandle` - the error output to handle.

### handleErrorFlush

public void handleErrorFlush(String errorOutputToFlush)
Redirect error flush to new project instance.

Setzt außer Kraft:
  `handleErrorFlush` in Klasse `org.apache.tools.ant.Task`
Parameter:
  `errorOutputToFlush` - the error output to flush.