# AntUnitListener (ant-antunit API)
declaration: package: org.apache.ant.antunit, interface: AntUnitListener

# Schnittstelle AntUnitListener

Alle bekannten Implementierungsklassen:
  `BaseAntUnitListener, FailureAntUnitListener, LogForwarder, PlainAntUnitListener, XMLAntUnitListener`

public interface AntUnitListener
A test listener for <antunit>.

## Methodenübersicht

Modifikator und Typ
Methode
Beschreibung
`void`
`addError(String target, Throwable ae)`
Invoked if any error other than a failed assertion occured during execution.
`void`
`addFailure(String target, AssertionFailedException ae)`
Invoked if an assert tasked caused an error during execution.
`void`
`endTest(String target)`
Invoked after a test target has been executed.
`void`
`endTestSuite(org.apache.tools.ant.Project testProject, String buildFile)`
Invoked once per build file, after all targets have been executed.
`void`
`setCurrentTestProject(org.apache.tools.ant.Project p)`
Set a reference to the Project instance currently executing the test target.
`void`
`setParentTask(org.apache.tools.ant.Task t)`
Set a reference to the AntUnit task executing the tests, this provides access to the containing project, target or Ant's logging system.
`void`
`startTest(String target)`
Invoked before a test target gets executed.
`void`
`startTestSuite(org.apache.tools.ant.Project testProject, String buildFile)`
Invoked once per build file, before any targets get executed.

## Methodendetails

### setParentTask

void setParentTask(org.apache.tools.ant.Task t)
Set a reference to the AntUnit task executing the tests, this provides access to the containing project, target or Ant's logging system.

Parameter:
  `t` - the parent task

### setCurrentTestProject

void setCurrentTestProject(org.apache.tools.ant.Project p)
Set a reference to the Project instance currently executing the test target.

This provides access to the logging system or the properties of the project under test. Note that different test targets will be executed in different Ant Project instances.

Parameter:
  `p` - the test project

### startTestSuite

void startTestSuite(org.apache.tools.ant.Project testProject, String buildFile)
Invoked once per build file, before any targets get executed.

Parameter:
  `testProject` - the project
  `buildFile` - the build file

### endTestSuite

void endTestSuite(org.apache.tools.ant.Project testProject, String buildFile)
Invoked once per build file, after all targets have been executed.

Parameter:
  `testProject` - the project
  `buildFile` - the build file

### startTest

void startTest(String target)
Invoked before a test target gets executed.

Parameter:
  `target` - name of the target

### endTest

void endTest(String target)
Invoked after a test target has been executed.

Parameter:
  `target` - name of the target

### addFailure

void addFailure(String target, AssertionFailedException ae)
Invoked if an assert tasked caused an error during execution.

Parameter:
  `target` - name of the target
  `ae` - the failure

### addError

void addError(String target, Throwable ae)
Invoked if any error other than a failed assertion occured during execution.

Parameter:
  `target` - name of the target
  `ae` - the error