Package org.glassfish.pfl.test
Class XMLJUnitReportWriter
java.lang.Object
org.glassfish.pfl.test.XMLJUnitReportWriter
- All Implemented Interfaces:
JUnitReportWriter
,XMLConstants
Prints XML output of the test to a specified Writer.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.glassfish.pfl.test.JUnitReportWriter
JUnitReportWriter.TestCounts, JUnitReportWriter.TestDescription
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String[]
private Document
The XML document.private int
private Set
<JUnitReportWriter.TestDescription> tests that failed.private int
private boolean
private OutputStream
Where to write the log to.private Element
The wrapper for the whole testsuite.private int
private long
private Map
<JUnitReportWriter.TestDescription, Element> Element for the current test.private Map
<JUnitReportWriter.TestDescription, Long> Timing helper.private static final String
constant for unnnamed testsuites/casesFields inherited from interface org.glassfish.pfl.test.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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
An error occurred.void
A failure occurred.void
A test ended.void
endTest
(JUnitReportWriter.TestDescription test, long duration) A test ended.The whole testsuite ended.private boolean
filterLine
(String line) private String
filterStack
(String stack) private void
formatError
(String type, JUnitReportWriter.TestDescription test, Throwable t) private void
formatOutput
(String type, String output) private static DocumentBuilder
private String
private String
private String
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.errvoid
setSystemOutput
(String out) This is what the test has written to System.outvoid
A test started.void
startTestSuite
(String name, Properties props) The whole testsuite started.
-
Field Details
-
UNKNOWN
constant for unnnamed testsuites/cases- See Also:
-
doc
The XML document. -
rootElement
The wrapper for the whole testsuite. -
testElements
Element for the current test. -
failedTests
tests that failed. -
testStarts
Timing helper. -
out
Where to write the log to. -
filterTrace
private boolean filterTrace -
runCount
private int runCount -
failureCount
private int failureCount -
errorCount
private int errorCount -
startTime
private long startTime -
DEFAULT_TRACE_FILTERS
-
-
Constructor Details
-
XMLJUnitReportWriter
public XMLJUnitReportWriter()No arg constructor. -
XMLJUnitReportWriter
public XMLJUnitReportWriter(boolean filter)
-
-
Method Details
-
getDocumentBuilder
-
setOutput
Description copied from interface:JUnitReportWriter
Sets the stream the formatter is supposed to write its results to.- Specified by:
setOutput
in interfaceJUnitReportWriter
- Parameters:
out
- the output stream to use.
-
setSystemOutput
Description copied from interface:JUnitReportWriter
This is what the test has written to System.out- Specified by:
setSystemOutput
in interfaceJUnitReportWriter
- Parameters:
out
- the string to write.
-
setSystemError
Description copied from interface:JUnitReportWriter
This is what the test has written to System.err- Specified by:
setSystemError
in interfaceJUnitReportWriter
- Parameters:
out
- the string to write.
-
startTestSuite
Description copied from interface:JUnitReportWriter
The whole testsuite started.- Specified by:
startTestSuite
in interfaceJUnitReportWriter
- Parameters:
name
- the suite.
-
getHostname
-
endTestSuite
Description copied from interface:JUnitReportWriter
The whole testsuite ended.- Specified by:
endTestSuite
in interfaceJUnitReportWriter
-
startTest
Description copied from interface:JUnitReportWriter
A test started.- Specified by:
startTest
in interfaceJUnitReportWriter
-
endTest
Description copied from interface:JUnitReportWriter
A test ended. Here we supply the duration, in case the duration is not determined by the [ startTest, endTest ] interval.- Specified by:
endTest
in interfaceJUnitReportWriter
-
endTest
Description copied from interface:JUnitReportWriter
A test ended.- Specified by:
endTest
in interfaceJUnitReportWriter
-
endTestHelper
-
addFailure
Description copied from interface:JUnitReportWriter
A failure occurred.- Specified by:
addFailure
in interfaceJUnitReportWriter
-
addError
Description copied from interface:JUnitReportWriter
An error occurred.- Specified by:
addError
in interfaceJUnitReportWriter
-
formatError
-
formatOutput
-
getStackTrace
-
getFilteredTrace
-
filterStack
-
filterLine
-