org.apache.tools.ant.taskdefs.optional.junit

Class XMLJUnitResultFormatter

Implemented Interfaces:
JUnitResultFormatter, TestListener, JUnitTaskMirror.JUnitResultFormatterMirror, XMLConstants

public class XMLJUnitResultFormatter
extends java.lang.Object
implements JUnitResultFormatter, XMLConstants

Prints XML output of the test to a specified Writer.
See Also:
FormatterElement

Fields inherited from interface org.apache.tools.ant.taskdefs.optional.junit.XMLConstants

ATTR_CLASSNAME, ATTR_ERRORS, ATTR_FAILURES, ATTR_ID, ATTR_MESSAGE, ATTR_NAME, ATTR_PACKAGE, ATTR_TESTS, ATTR_TIME, ATTR_TYPE, ATTR_VALUE, ERROR, FAILURE, HOSTNAME, PROPERTIES, PROPERTY, SYSTEM_ERR, SYSTEM_OUT, TESTCASE, TESTSUITE, TESTSUITES, TIMESTAMP

Constructor Summary

XMLJUnitResultFormatter()
No arg constructor.

Method Summary

void
addError(Test test, Throwable t)
Interface TestListener.
void
addFailure(Test test, AssertionFailedError t)
Interface TestListener for JUnit > 3.4.
void
addFailure(Test test, Throwable t)
Interface TestListener for JUnit <= 3.4.
void
endTest(Test test)
Interface TestListener.
void
endTestSuite(JUnitTest suite)
The whole testsuite ended.
void
setOutput(OutputStream out)
.
void
setSystemError(String out)
.
void
setSystemOutput(String out)
.
void
startTest(Test t)
Interface TestListener.
void
startTestSuite(JUnitTest suite)
The whole testsuite started.

Constructor Details

XMLJUnitResultFormatter

public XMLJUnitResultFormatter()
No arg constructor.

Method Details

addError

public void addError(Test test,
                     Throwable t)
Interface TestListener.

An error occurred while running the test.

Parameters:
test - the test.
t - the error.

addFailure

public void addFailure(Test test,
                       AssertionFailedError t)
Interface TestListener for JUnit > 3.4.

A Test failed.

Parameters:
test - the test.
t - the assertion.

addFailure

public void addFailure(Test test,
                       Throwable t)
Interface TestListener for JUnit <= 3.4.

A Test failed.

Parameters:
test - the test.
t - the exception.

endTest

public void endTest(Test test)
Interface TestListener.

A Test is finished.

Parameters:
test - the test.

endTestSuite

public void endTestSuite(JUnitTest suite)
            throws BuildException
The whole testsuite ended.
Specified by:
endTestSuite in interface JUnitResultFormatter
Parameters:
suite - the testsuite.
Throws:
BuildException - on error.

setOutput

public void setOutput(OutputStream out)
.
Specified by:
setOutput in interface JUnitResultFormatter
setOutput in interface JUnitTaskMirror.JUnitResultFormatterMirror

setSystemError

public void setSystemError(String out)
.
Specified by:
setSystemError in interface JUnitResultFormatter

setSystemOutput

public void setSystemOutput(String out)
.
Specified by:
setSystemOutput in interface JUnitResultFormatter

startTest

public void startTest(Test t)
Interface TestListener.

A new Test is started.

Parameters:
t - the test.

startTestSuite

public void startTestSuite(JUnitTest suite)
The whole testsuite started.
Specified by:
startTestSuite in interface JUnitResultFormatter
Parameters:
suite - the testsuite.