public class XmlJUnitResultFormatter extends Object implements org.apache.tools.ant.taskdefs.optional.junit.JUnitResultFormatter
XMLJUnitResultFormatter
, with flexibility for extension.Constructor and Description |
---|
XmlJUnitResultFormatter()
Creates a new
XmlJUnitResultFormatter . |
Modifier and Type | Method and Description |
---|---|
void |
addError(junit.framework.Test test,
Throwable error)
An error occurred while running the test.
|
void |
addFailure(junit.framework.Test test,
junit.framework.AssertionFailedError failedAssertion)
A test failed.
|
void |
addFailure(junit.framework.Test test,
Throwable error)
A test failed.
|
void |
endTest(junit.framework.Test test)
A test is finished.
|
void |
endTestSuite(org.apache.tools.ant.taskdefs.optional.junit.JUnitTest suite)
The whole test suite ended.
|
protected void |
onFailureOrError(junit.framework.Test test,
Throwable error,
XmlNode errorXmlNode)
Hook for subclasses to add extra functionality after a test failure or a test execution error.
|
protected void |
onStartTestSuite(org.apache.tools.ant.taskdefs.optional.junit.JUnitTest suite)
Hook for subclasses to add extra functionality after the whole test suite started.
|
void |
setOutput(OutputStream out)
Sets the stream the formatter is supposed to write its results to.
|
void |
setSystemError(String out)
This is what the test has written to
System.err . |
void |
setSystemOutput(String out)
This is what the test has written to
System.out , |
void |
startTest(junit.framework.Test test)
A new test is started.
|
void |
startTestSuite(org.apache.tools.ant.taskdefs.optional.junit.JUnitTest suite)
The whole test suite started.
|
protected void |
writeErrorAndStackTrace(Throwable error,
XmlNode errorXmlNode)
Writes the stack trace and message of the given error to the given XML node.
|
protected XmlNode |
xmlRootNode() |
public XmlJUnitResultFormatter()
XmlJUnitResultFormatter
.public final void setOutput(OutputStream out)
setOutput
in interface org.apache.tools.ant.taskdefs.optional.junit.JUnitResultFormatter
setOutput
in interface org.apache.tools.ant.taskdefs.optional.junit.JUnitTaskMirror.JUnitResultFormatterMirror
out
- the output stream to use.public final void setSystemOutput(String out)
System.out
,setSystemOutput
in interface org.apache.tools.ant.taskdefs.optional.junit.JUnitResultFormatter
out
- the String
to write.public final void setSystemError(String out)
System.err
.setSystemError
in interface org.apache.tools.ant.taskdefs.optional.junit.JUnitResultFormatter
out
- the String
to write.protected final XmlNode xmlRootNode()
public final void startTestSuite(org.apache.tools.ant.taskdefs.optional.junit.JUnitTest suite)
startTestSuite
in interface org.apache.tools.ant.taskdefs.optional.junit.JUnitResultFormatter
suite
- the test suite.ExceptionInInitializerError
- if the underlying XML document could not be created.protected void onStartTestSuite(org.apache.tools.ant.taskdefs.optional.junit.JUnitTest suite)
suite
- the test suite.public final void endTestSuite(org.apache.tools.ant.taskdefs.optional.junit.JUnitTest suite)
OutputStream
.endTestSuite
in interface org.apache.tools.ant.taskdefs.optional.junit.JUnitResultFormatter
suite
- the test suite.org.apache.tools.ant.BuildException
- on error.public final void startTest(junit.framework.Test test)
startTest
in interface junit.framework.TestListener
test
- the test.public final void endTest(junit.framework.Test test)
endTest
in interface junit.framework.TestListener
test
- the test.public final void addFailure(junit.framework.Test test, junit.framework.AssertionFailedError failedAssertion)
addFailure
in interface junit.framework.TestListener
test
- the test.failedAssertion
- the failed assertion.public final void addFailure(junit.framework.Test test, Throwable error)
test
- the test.error
- the exception.public final void addError(junit.framework.Test test, Throwable error)
addError
in interface junit.framework.TestListener
test
- the test.error
- the error.protected final void writeErrorAndStackTrace(Throwable error, XmlNode errorXmlNode)
error
- the given error.errorXmlNode
- the XML node to write to.protected void onFailureOrError(junit.framework.Test test, Throwable error, XmlNode errorXmlNode)
test
- the executing test.error
- the reason of the failure or error.errorXmlNode
- the XML element containing information about the test failure or error.Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.