Package org.apache.ant.antunit.listener
Class FailureAntUnitListener
java.lang.Object
org.apache.ant.antunit.listener.BaseAntUnitListener
org.apache.ant.antunit.listener.FailureAntUnitListener
- All Implemented Interfaces:
AntUnitListener
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Class for collecting needed information about failed tests.Nested classes/interfaces inherited from class org.apache.ant.antunit.listener.BaseAntUnitListener
BaseAntUnitListener.AntUnitLogLevel, BaseAntUnitListener.LogGrabber, BaseAntUnitListener.SendLogTo
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
LineSeparator just for beautifying the output.private String
The current running build file.private org.apache.tools.ant.Project
The current running test project.private static SortedSet
A sorted list (without duplicates) of failed tests.private static File
Where to write the generated buildfile.Fields inherited from class org.apache.ant.antunit.listener.BaseAntUnitListener
errorCount, failureCount, nf, runCount, start, testStart
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
not in usevoid
endTestSuite
(org.apache.tools.ant.Project testProject, String buildFile) Invoked once per build file, after all targets have been executed.void
void
startTestSuite
(org.apache.tools.ant.Project testProject, String buildFile) Invoked once per build file, before any targets get executed.Methods inherited from class org.apache.ant.antunit.listener.BaseAntUnitListener
close, getCurrentTestProject, getLocation, getOut, getToDir, messageLogged, normalize, setCurrentTestProject, setLogLevel, setParentTask, setSendLogTo, setToDir, startTest
-
Field Details
-
BR
LineSeparator just for beautifying the output. -
failedTests
A sorted list (without duplicates) of failed tests. -
failureBuildfile
Where to write the generated buildfile. -
currentTestProject
private org.apache.tools.ant.Project currentTestProjectThe current running test project. Needed for addError()/addFailure(). -
currentBuildFile
The current running build file. Needed for addError()/addFailure().
-
-
Constructor Details
-
FailureAntUnitListener
public FailureAntUnitListener()No-arg constructor.
-
-
Method Details
-
setFile
-
startTestSuite
Description copied from interface:AntUnitListener
Invoked once per build file, before any targets get executed.- Specified by:
startTestSuite
in interfaceAntUnitListener
- Overrides:
startTestSuite
in classBaseAntUnitListener
- Parameters:
testProject
- the projectbuildFile
- the build file
-
addError
Description copied from interface:AntUnitListener
Invoked if any error other than a failed assertion occured during execution.- Specified by:
addError
in interfaceAntUnitListener
- Overrides:
addError
in classBaseAntUnitListener
- Parameters:
target
- name of the targetae
- the error
-
addFailure
Description copied from interface:AntUnitListener
Invoked if an assert tasked caused an error during execution.- Specified by:
addFailure
in interfaceAntUnitListener
- Overrides:
addFailure
in classBaseAntUnitListener
- Parameters:
target
- name of the targetae
- the failure
-
endTest
not in use- Parameters:
target
- name of the target
-
endTestSuite
Description copied from interface:AntUnitListener
Invoked once per build file, after all targets have been executed.- Parameters:
testProject
- the projectbuildFile
- the build file
-