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 class
FailureAntUnitListener.TestInfos
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
Fields Modifier and Type Field Description private static java.lang.String
BR
LineSeparator just for beautifying the output.private java.lang.String
currentBuildFile
The current running build file.private org.apache.tools.ant.Project
currentTestProject
The current running test project.private static java.util.SortedSet
failedTests
A sorted list (without duplicates) of failed tests.private static java.io.File
failureBuildfile
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 Constructor Description FailureAntUnitListener()
No-arg constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addError(java.lang.String target, java.lang.Throwable ae)
Invoked if any error other than a failed assertion occured during execution.void
addFailure(java.lang.String target, AssertionFailedException ae)
Invoked if an assert tasked caused an error during execution.void
endTest(java.lang.String target)
not in usevoid
endTestSuite(org.apache.tools.ant.Project testProject, java.lang.String buildFile)
Invoked once per build file, after all targets have been executed.void
setFile(java.io.File file)
void
startTestSuite(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: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
public void addError(java.lang.String target, java.lang.Throwable ae)
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
public void addFailure(java.lang.String target, AssertionFailedException ae)
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
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:AntUnitListener
Invoked once per build file, after all targets have been executed.- Parameters:
testProject
- the projectbuildFile
- the build file
-
-