# XMLListener AntUnit Listener

## Failure AntUnit Listener

### Description

Writes reports similar to the "failure" JUnit formatter.

This AntUnitListener creates a new buildfile with a target for each failed test target in the AntUnit run. The generated target calls the failed target (with setUp and tearDown if present in the called project).

This is intended for rerunning just failed tests.

### Parameters

Attribute | Description | Required
file | Where to write the generated buildfile. | Yes.

### Examples

        <au:antunit>
          <fileset dir="${tests}" includes="*.xml"/>
          <au:failurelistener file="${build.dir}/failed-tests/failed.xml"/>
        </au:antunit>

Runs AntUnit on all XML files in the directory `${tests}` and collecting all failed tests. If there was a failure the file `${build.dir}/failed-tests/failed.xml` is created and has a textXXX target for each failed test. Additionally it has a default target antunit which runs all these failed tests.