Package org.apache.ant.antunit.listener
Class XMLAntUnitListener
java.lang.Object
org.apache.ant.antunit.listener.BaseAntUnitListener
org.apache.ant.antunit.listener.XMLAntUnitListener
- All Implemented Interfaces:
AntUnitListener
A test listener for <antunit> modelled after the XML JUnit
test listener that is part of Ant.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.ant.antunit.listener.BaseAntUnitListener
BaseAntUnitListener.AntUnitLogLevel, BaseAntUnitListener.LogGrabber, BaseAntUnitListener.SendLogTo
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Element
private Document
private org.apache.tools.ant.util.DOMElementWriter
private static final String
private StringBuffer
Collects log messages.private OutputStream
private Element
private Writer
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
Invoked after a test target has been executed.void
endTestSuite
(org.apache.tools.ant.Project testProject, String buildFile) Invoked once per build file, after all targets have been executed.private void
formatError
(String type, Throwable t) private String
get the local hostname - stolen from junit.XMLJUnitResultFormatterprotected void
messageLogged
(org.apache.tools.ant.BuildEvent event) Gets messages from the project running the test target if their level is at least of the level specified withsetLogLevel
.void
Invoked before a test target gets executed.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, normalize, setCurrentTestProject, setLogLevel, setParentTask, setSendLogTo, setToDir
-
Field Details
-
INDENT
- See Also:
-
out
-
wri
-
domWri
private org.apache.tools.ant.util.DOMElementWriter domWri -
doc
-
root
-
currentTest
-
log
Collects log messages.
-
-
Constructor Details
-
XMLAntUnitListener
public XMLAntUnitListener()
-
-
Method Details
-
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
-
endTestSuite
Description copied from interface:AntUnitListener
Invoked once per build file, after all targets have been executed.- Parameters:
testProject
- the projectbuildFile
- the build file
-
startTest
Description copied from interface:AntUnitListener
Invoked before a test target gets executed.- Specified by:
startTest
in interfaceAntUnitListener
- Overrides:
startTest
in classBaseAntUnitListener
- Parameters:
target
- name of the target
-
endTest
Description copied from interface:AntUnitListener
Invoked after a test target has been executed.- Parameters:
target
- name of the target
-
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
-
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
-
formatError
-
messageLogged
protected void messageLogged(org.apache.tools.ant.BuildEvent event) Description copied from class:BaseAntUnitListener
Gets messages from the project running the test target if their level is at least of the level specified withsetLogLevel
.This implementation is empty.
- Overrides:
messageLogged
in classBaseAntUnitListener
- Parameters:
event
- the logged message
-
getHostname
get the local hostname - stolen from junit.XMLJUnitResultFormatter- Returns:
- the name of the local host, or "localhost" if we cannot work it out
-