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 DocumentThe XML document.private intprivate Set<JUnitReportWriter.TestDescription> tests that failed.private intprivate booleanprivate OutputStreamWhere to write the log to.private ElementThe wrapper for the whole testsuite.private intprivate longprivate Map<JUnitReportWriter.TestDescription, Element> Element for the current test.private Map<JUnitReportWriter.TestDescription, Long> Timing helper.private static final Stringconstant 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 TypeMethodDescriptionvoidAn error occurred.voidA failure occurred.voidA test ended.voidendTest(JUnitReportWriter.TestDescription test, long duration) A test ended.The whole testsuite ended.private booleanfilterLine(String line) private StringfilterStack(String stack) private voidformatError(String type, JUnitReportWriter.TestDescription test, Throwable t) private voidformatOutput(String type, String output) private static DocumentBuilderprivate Stringprivate Stringprivate StringvoidsetOutput(OutputStream out) Sets the stream the formatter is supposed to write its results to.voidsetSystemError(String out) This is what the test has written to System.errvoidsetSystemOutput(String out) This is what the test has written to System.outvoidA test started.voidstartTestSuite(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:JUnitReportWriterSets the stream the formatter is supposed to write its results to.- Specified by:
setOutputin interfaceJUnitReportWriter- Parameters:
out- the output stream to use.
-
setSystemOutput
Description copied from interface:JUnitReportWriterThis is what the test has written to System.out- Specified by:
setSystemOutputin interfaceJUnitReportWriter- Parameters:
out- the string to write.
-
setSystemError
Description copied from interface:JUnitReportWriterThis is what the test has written to System.err- Specified by:
setSystemErrorin interfaceJUnitReportWriter- Parameters:
out- the string to write.
-
startTestSuite
Description copied from interface:JUnitReportWriterThe whole testsuite started.- Specified by:
startTestSuitein interfaceJUnitReportWriter- Parameters:
name- the suite.
-
getHostname
-
endTestSuite
Description copied from interface:JUnitReportWriterThe whole testsuite ended.- Specified by:
endTestSuitein interfaceJUnitReportWriter
-
startTest
Description copied from interface:JUnitReportWriterA test started.- Specified by:
startTestin interfaceJUnitReportWriter
-
endTest
Description copied from interface:JUnitReportWriterA test ended. Here we supply the duration, in case the duration is not determined by the [ startTest, endTest ] interval.- Specified by:
endTestin interfaceJUnitReportWriter
-
endTest
Description copied from interface:JUnitReportWriterA test ended.- Specified by:
endTestin interfaceJUnitReportWriter
-
endTestHelper
-
addFailure
Description copied from interface:JUnitReportWriterA failure occurred.- Specified by:
addFailurein interfaceJUnitReportWriter
-
addError
Description copied from interface:JUnitReportWriterAn error occurred.- Specified by:
addErrorin interfaceJUnitReportWriter
-
formatError
-
formatOutput
-
getStackTrace
-
getFilteredTrace
-
filterStack
-
filterLine
-