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
public class FailureAntUnitListener extends BaseAntUnitListener
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 Classes Modifier and Type Class Description classFailureAntUnitListener.TestInfosClass 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
Fields Modifier and Type Field Description private static java.lang.StringBRLineSeparator just for beautifying the output.private java.lang.StringcurrentBuildFileThe current running build file.private org.apache.tools.ant.ProjectcurrentTestProjectThe current running test project.private static java.util.SortedSetfailedTestsA sorted list (without duplicates) of failed tests.private static java.io.FilefailureBuildfileWhere to write the generated buildfile.-
Fields inherited from class org.apache.ant.antunit.listener.BaseAntUnitListener
errorCount, failureCount, nf, runCount, start, testStart
-
-
Constructor Summary
Constructors Constructor Description FailureAntUnitListener()No-arg constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddError(java.lang.String target, java.lang.Throwable ae)Invoked if any error other than a failed assertion occured during execution.voidaddFailure(java.lang.String target, AssertionFailedException ae)Invoked if an assert tasked caused an error during execution.voidendTest(java.lang.String target)not in usevoidendTestSuite(org.apache.tools.ant.Project testProject, java.lang.String buildFile)Invoked once per build file, after all targets have been executed.voidsetFile(java.io.File file)voidstartTestSuite(org.apache.tools.ant.Project testProject, java.lang.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 Detail
-
BR
private static final java.lang.String BR
LineSeparator just for beautifying the output.
-
failedTests
private static java.util.SortedSet failedTests
A sorted list (without duplicates) of failed tests.
-
failureBuildfile
private static java.io.File failureBuildfile
Where to write the generated buildfile.
-
currentTestProject
private org.apache.tools.ant.Project currentTestProject
The current running test project. Needed for addError()/addFailure().
-
currentBuildFile
private java.lang.String currentBuildFile
The current running build file. Needed for addError()/addFailure().
-
-
Method Detail
-
setFile
public void setFile(java.io.File file)
-
startTestSuite
public void startTestSuite(org.apache.tools.ant.Project testProject, java.lang.String buildFile)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
public void addError(java.lang.String target, java.lang.Throwable ae)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
public void addFailure(java.lang.String target, AssertionFailedException ae)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
public void endTest(java.lang.String target)
not in use- Parameters:
target- name of the target
-
endTestSuite
public void endTestSuite(org.apache.tools.ant.Project testProject, java.lang.String buildFile)Description copied from interface:AntUnitListenerInvoked once per build file, after all targets have been executed.- Parameters:
testProject- the projectbuildFile- the build file
-
-