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 TypeClassDescriptionclassClass 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 StringLineSeparator just for beautifying the output.private StringThe current running build file.private org.apache.tools.ant.ProjectThe current running test project.private static SortedSetA sorted list (without duplicates) of failed tests.private static FileWhere 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 TypeMethodDescriptionvoidInvoked if any error other than a failed assertion occured during execution.voidaddFailure(String target, AssertionFailedException ae) Invoked if an assert tasked caused an error during execution.voidnot in usevoidendTestSuite(org.apache.tools.ant.Project testProject, String buildFile) Invoked once per build file, after all targets have been executed.voidvoidstartTestSuite(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:AntUnitListenerInvoked once per build file, before any targets get executed.- Specified by:
startTestSuitein interfaceAntUnitListener- Overrides:
startTestSuitein classBaseAntUnitListener- Parameters:
testProject- the projectbuildFile- the build file
-
addError
Description copied from interface:AntUnitListenerInvoked if any error other than a failed assertion occured during execution.- Specified by:
addErrorin interfaceAntUnitListener- Overrides:
addErrorin classBaseAntUnitListener- Parameters:
target- name of the targetae- the error
-
addFailure
Description copied from interface:AntUnitListenerInvoked if an assert tasked caused an error during execution.- Specified by:
addFailurein interfaceAntUnitListener- Overrides:
addFailurein classBaseAntUnitListener- Parameters:
target- name of the targetae- the failure
-
endTest
not in use- Parameters:
target- name of the target
-
endTestSuite
Description copied from interface:AntUnitListenerInvoked once per build file, after all targets have been executed.- Parameters:
testProject- the projectbuildFile- the build file
-