@API(status=EXPERIMENTAL,
since="1.4")
public class LegacyXmlReportGeneratingListener
extends java.lang.Object
implements TestExecutionListener
LegacyXmlReportGeneratingListener is a TestExecutionListener that
generates a separate XML report for each root
in the TestPlan.
Note that the generated XML format is compatible with the legacy de facto standard for JUnit 4 based test reports that was made popular by the Ant build system.
LoggingListener,
SummaryGeneratingListener| Modifier and Type | Field and Description |
|---|---|
private java.time.Clock |
clock |
private java.io.PrintWriter |
out |
private XmlReportData |
reportData |
private java.nio.file.Path |
reportsDir |
| Modifier | Constructor and Description |
|---|---|
|
LegacyXmlReportGeneratingListener(java.nio.file.Path reportsDir,
java.io.PrintWriter out) |
private |
LegacyXmlReportGeneratingListener(java.nio.file.Path reportsDir,
java.io.PrintWriter out,
java.time.Clock clock) |
(package private) |
LegacyXmlReportGeneratingListener(java.lang.String reportsDir,
java.io.PrintWriter out,
java.time.Clock clock) |
| Modifier and Type | Method and Description |
|---|---|
void |
executionFinished(TestIdentifier testIdentifier,
TestExecutionResult result)
Called when the execution of a leaf or subtree of the
TestPlan
has finished, regardless of the outcome. |
void |
executionSkipped(TestIdentifier testIdentifier,
java.lang.String reason)
Called when the execution of a leaf or subtree of the
TestPlan
has been skipped. |
void |
executionStarted(TestIdentifier testIdentifier)
Called when the execution of a leaf or subtree of the
TestPlan
is about to be started. |
private boolean |
isRoot(TestIdentifier testIdentifier) |
private void |
printException(java.lang.String message,
java.lang.Exception exception) |
void |
reportingEntryPublished(TestIdentifier testIdentifier,
ReportEntry entry)
Called when additional test reporting data has been published for
the supplied
TestIdentifier. |
void |
testPlanExecutionFinished(TestPlan testPlan)
Called when the execution of the
TestPlan has finished,
after all tests have been executed. |
void |
testPlanExecutionStarted(TestPlan testPlan)
Called when the execution of the
TestPlan has started,
before any test has been executed. |
private void |
writeXmlReportInCaseOfRoot(TestIdentifier testIdentifier) |
private void |
writeXmlReportSafely(TestIdentifier testIdentifier,
java.lang.String rootName) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdynamicTestRegisteredprivate final java.nio.file.Path reportsDir
private final java.io.PrintWriter out
private final java.time.Clock clock
private XmlReportData reportData
public LegacyXmlReportGeneratingListener(java.nio.file.Path reportsDir,
java.io.PrintWriter out)
LegacyXmlReportGeneratingListener(java.lang.String reportsDir,
java.io.PrintWriter out,
java.time.Clock clock)
private LegacyXmlReportGeneratingListener(java.nio.file.Path reportsDir,
java.io.PrintWriter out,
java.time.Clock clock)
public void testPlanExecutionStarted(TestPlan testPlan)
TestExecutionListenerTestPlan has started,
before any test has been executed.testPlanExecutionStarted in interface TestExecutionListenertestPlan - describes the tree of tests about to be executedpublic void testPlanExecutionFinished(TestPlan testPlan)
TestExecutionListenerTestPlan has finished,
after all tests have been executed.testPlanExecutionFinished in interface TestExecutionListenertestPlan - describes the tree of tests that have been executedpublic void executionSkipped(TestIdentifier testIdentifier, java.lang.String reason)
TestExecutionListenerTestPlan
has been skipped.
The TestIdentifier may represent a test or a container. In
the case of a container, no listener methods will be called for any of
its descendants.
A skipped test or subtree of tests will never be reported as started or finished.
executionSkipped in interface TestExecutionListenertestIdentifier - the identifier of the skipped test or containerreason - a human-readable message describing why the execution
has been skippedpublic void executionStarted(TestIdentifier testIdentifier)
TestExecutionListenerTestPlan
is about to be started.
The TestIdentifier may represent a test or a container.
This method will only be called if the test or container has not been skipped.
This method will be called for a container TestIdentifier
before starting or
skipping any of its children.
executionStarted in interface TestExecutionListenertestIdentifier - the identifier of the started test or containerpublic void reportingEntryPublished(TestIdentifier testIdentifier, ReportEntry entry)
TestExecutionListenerTestIdentifier.
Can be called at any time during the execution of a test plan.
reportingEntryPublished in interface TestExecutionListenertestIdentifier - describes the test or container to which the entry pertainsentry - the published ReportEntrypublic void executionFinished(TestIdentifier testIdentifier, TestExecutionResult result)
TestExecutionListenerTestPlan
has finished, regardless of the outcome.
The TestIdentifier may represent a test or a container.
This method will only be called if the test or container has not been skipped.
This method will be called for a container TestIdentifier
after all of its children have been
skipped or have
finished.
The TestExecutionResult describes the result of the execution
for the supplied TestIdentifier. The result does not include or
aggregate the results of its children. For example, a container with a
failing test will be reported as SUCCESSFUL even
if one or more of its children are reported as FAILED.
executionFinished in interface TestExecutionListenertestIdentifier - the identifier of the finished test or containerresult - the (unaggregated) result of the execution for
the supplied TestIdentifierTestExecutionResultprivate void writeXmlReportInCaseOfRoot(TestIdentifier testIdentifier)
private void writeXmlReportSafely(TestIdentifier testIdentifier, java.lang.String rootName)
private boolean isRoot(TestIdentifier testIdentifier)
private void printException(java.lang.String message,
java.lang.Exception exception)