Top Description Inners Fields Constructors Methods
org.testng.reporters

public Class EmailableReporter2

extends Object
implements IReporter
Class Inheritance
All Implemented Interfaces
org.testng.IReporter, org.testng.ITestNGListener
Static Imports
java.nio.charset.StandardCharsets.UTF_8, java.nio.file.Files.newBufferedWriter

Reporter that generates a single-page HTML report of the test results.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
protected static class
EmailableReporter2.MethodResult

Groups test results by method.

protected static class
protected static class
EmailableReporter2.TestResult

Groups ClassResults by test, type (configuration or test), and status.

Field Summary

Modifier and TypeField and Description
private final StringBuilder
private String
private static final Logger
protected final List<EmailableReporter2.SuiteResult>
protected PrintWriter

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected PrintWriter
private void
private boolean
dumpParametersInfo(String prefix, Object[] parameters)

public void
generateReport(List<XmlSuite>
The list of XmlSuite
xmlSuites
,
List<ISuite>
The list of ISuite
suites
,
String
The output directory
outputDirectory
)

Overrides default org.testng.IReporter.generateReport.

Generate a report for the given suites into the specified output directory.
public String
protected String
getFormattedStartTime(long startTimeInMillisFromEpoch)

public void
setFileName(String fileName)

protected void
protected void
protected void
protected void
protected void
writeReporterMessages(List<String> reporterMessages)

private void
writeScenario(int scenarioIndex, String label, ITestResult result)

Writes the details for an individual test scenario.

protected void
writeScenarioDetails()

Writes the details for all test scenarios.

private int
writeScenarioDetails(List<EmailableReporter2.ClassResult> classResults, int startingScenarioIndex)

Writes the scenario details for the results of a given state for a single test.

protected void
writeScenarioSummary()

Writes a summary of all the test scenarios.

private int
writeScenarioSummary(String description, List<EmailableReporter2.ClassResult> classResults, String cssClassPrefix, int startingScenarioIndex)

Writes the scenario summary for the results of a given state for a single test.

protected void
protected void
protected void
protected void
writeTableData(String
the HTML contents
html
)

Writes a TD element with the specified contents.

protected void
writeTableData(String
the HTML contents
html
,
String
the space-delimited CSS classes or null if there are no classes to apply
cssClasses
)

Writes a TD element with the specified contents and CSS class names.

protected void
writeTableHeader(String
the HTML contents
html
,
String
the space-delimited CSS classes or null if there are no classes to apply
cssClasses
)

Writes a TH element with the specified contents and CSS class names.

protected void
writeTag(String
the tag name
tag
,
String
the HTML contents
html
,
String
the space-delimited CSS classes or null if there are no classes to apply
cssClasses
)

Writes an arbitrary HTML element with the specified contents and CSS class names.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bufferback to summary
private final StringBuilder buffer
fileNameback to summary
private String fileName
LOGback to summary
private static final Logger LOG
suiteResultsback to summary
protected final List<EmailableReporter2.SuiteResult> suiteResults
writerback to summary
protected PrintWriter writer

Constructor Detail

EmailableReporter2back to summary
public EmailableReporter2()

Method Detail

createWriterback to summary
protected PrintWriter createWriter(String outdir) throws IOException
dumpAttributesInfoback to summary
private void dumpAttributesInfo(CustomAttribute[] attributes)
dumpParametersInfoback to summary
private boolean dumpParametersInfo(String prefix, Object[] parameters)
generateReportback to summary
public void generateReport(List<XmlSuite> xmlSuites, List<ISuite> suites, String outputDirectory)

Overrides default org.testng.IReporter.generateReport.

Doc from org.testng.IReporter.generateReport.

Generate a report for the given suites into the specified output directory.

Parameters
xmlSuites:List<XmlSuite>

The list of XmlSuite

suites:List<ISuite>

The list of ISuite

outputDirectory:String

The output directory

Annotations
@Override
getFileNameback to summary
public String getFileName()
getFormattedStartTimeback to summary
protected String getFormattedStartTime(long startTimeInMillisFromEpoch)
setFileNameback to summary
public void setFileName(String fileName)
writeBodyback to summary
protected void writeBody()
writeDocumentEndback to summary
protected void writeDocumentEnd()
writeDocumentStartback to summary
protected void writeDocumentStart()
writeHeadback to summary
protected void writeHead()
writeReporterMessagesback to summary
protected void writeReporterMessages(List<String> reporterMessages)
writeScenarioback to summary
private void writeScenario(int scenarioIndex, String label, ITestResult result)

Writes the details for an individual test scenario.

writeScenarioDetailsback to summary
protected void writeScenarioDetails()

Writes the details for all test scenarios.

writeScenarioDetailsback to summary
private int writeScenarioDetails(List<EmailableReporter2.ClassResult> classResults, int startingScenarioIndex)

Writes the scenario details for the results of a given state for a single test.

writeScenarioSummaryback to summary
protected void writeScenarioSummary()

Writes a summary of all the test scenarios.

writeScenarioSummaryback to summary
private int writeScenarioSummary(String description, List<EmailableReporter2.ClassResult> classResults, String cssClassPrefix, int startingScenarioIndex)

Writes the scenario summary for the results of a given state for a single test.

writeStackTraceback to summary
protected void writeStackTrace(Throwable throwable)
writeStylesheetback to summary
protected void writeStylesheet()
writeSuiteSummaryback to summary
protected void writeSuiteSummary()
writeTableDataback to summary
protected void writeTableData(String html)

Writes a TD element with the specified contents.

Parameters
html:String

the HTML contents

writeTableDataback to summary
protected void writeTableData(String html, String cssClasses)

Writes a TD element with the specified contents and CSS class names.

Parameters
html:String

the HTML contents

cssClasses:String

the space-delimited CSS classes or null if there are no classes to apply

writeTableHeaderback to summary
protected void writeTableHeader(String html, String cssClasses)

Writes a TH element with the specified contents and CSS class names.

Parameters
html:String

the HTML contents

cssClasses:String

the space-delimited CSS classes or null if there are no classes to apply

writeTagback to summary
protected void writeTag(String tag, String html, String cssClasses)

Writes an arbitrary HTML element with the specified contents and CSS class names.

Parameters
tag:String

the tag name

html:String

the HTML contents

cssClasses:String

the space-delimited CSS classes or null if there are no classes to apply

org.testng.reporters back to summary

protected Class EmailableReporter2.ClassResult

extends Object
Class Inheritance

Groups MethodResults by class.

Field Summary

Modifier and TypeField and Description
private final String
private final List<EmailableReporter2.MethodResult>

Constructor Summary

AccessConstructor and Description
public
ClassResult(String
the class name
className
,
List<EmailableReporter2.MethodResult>
the non-null, non-empty MethodResult list
methodResults
)

Method Summary

Modifier and TypeMethod and Description
public String
public List<EmailableReporter2.MethodResult>

Returns:

the non-null, non-empty MethodResult list
getMethodResults
()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classNameback to summary
private final String className
methodResultsback to summary
private final List<EmailableReporter2.MethodResult> methodResults

Constructor Detail

ClassResultback to summary
public ClassResult(String className, List<EmailableReporter2.MethodResult> methodResults)
Parameters
className:String

the class name

methodResults:List<EmailableReporter2.MethodResult>

the non-null, non-empty MethodResult list

Method Detail

getClassNameback to summary
public String getClassName()
getMethodResultsback to summary
public List<EmailableReporter2.MethodResult> getMethodResults()
Returns:List<EmailableReporter2.MethodResult>

the non-null, non-empty MethodResult list

org.testng.reporters back to summary

protected Class EmailableReporter2.MethodResult

extends Object
Class Inheritance

Groups test results by method.

Field Summary

Modifier and TypeField and Description
private final List<ITestResult>

Constructor Summary

AccessConstructor and Description
public
MethodResult(List<ITestResult>
the non-null, non-empty result list
results
)

Method Summary

Modifier and TypeMethod and Description
public List<ITestResult>

Returns:

the non-null, non-empty result list
getResults
()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

resultsback to summary
private final List<ITestResult> results

Constructor Detail

MethodResultback to summary
public MethodResult(List<ITestResult> results)
Parameters
results:List<ITestResult>

the non-null, non-empty result list

Method Detail

getResultsback to summary
public List<ITestResult> getResults()
Returns:List<ITestResult>

the non-null, non-empty result list

org.testng.reporters back to summary

protected Class EmailableReporter2.SuiteResult

extends Object
Class Inheritance

Groups TestResults by suite.

Field Summary

Modifier and TypeField and Description
private final XmlSuite.ParallelMode
private final String
private final List<EmailableReporter2.TestResult>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public XmlSuite.ParallelMode
public String
public List<EmailableReporter2.TestResult>

Returns:

the test results (possibly empty)
getTestResults
()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

modeback to summary
private final XmlSuite.ParallelMode mode
suiteNameback to summary
private final String suiteName
testResultsback to summary
private final List<EmailableReporter2.TestResult> testResults

Constructor Detail

SuiteResultback to summary
public SuiteResult(ISuite suite)

Method Detail

getParallelModeback to summary
public XmlSuite.ParallelMode getParallelMode()
getSuiteNameback to summary
public String getSuiteName()
getTestResultsback to summary
public List<EmailableReporter2.TestResult> getTestResults()
Returns:List<EmailableReporter2.TestResult>

the test results (possibly empty)

org.testng.reporters back to summary

protected Class EmailableReporter2.TestResult

extends Object
Class Inheritance

Groups ClassResults by test, type (configuration or test), and status.

Field Summary

Modifier and TypeField and Description
private final long
private final String
private final List<EmailableReporter2.ClassResult>
private final int
private final List<EmailableReporter2.ClassResult>
private final String
private final int
private final List<EmailableReporter2.ClassResult>
protected static final Comparator<ITestResult>
RESULT_COMPARATOR

Orders test results by class name and then by method name (in lexicographic order).

private final int
private final List<EmailableReporter2.ClassResult>
private final List<EmailableReporter2.ClassResult>
private final int
private final List<EmailableReporter2.ClassResult>
private final String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected String

Returns:

The String value of the groups
formatGroups
(String[]
The groups
groups
)

Formats an array of groups for display.

public long
public String
public List<EmailableReporter2.ClassResult>

Returns:

the results for failed configurations (possibly empty)
getFailedConfigurationResults
()

public int
public List<EmailableReporter2.ClassResult>

Returns:

the results for failed tests (possibly empty)
getFailedTestResults
()

public String
public int
public List<EmailableReporter2.ClassResult>

Returns:

the results for passed tests (possibly empty)
getPassedTestResults
()

public int
public List<EmailableReporter2.ClassResult>
public List<EmailableReporter2.ClassResult>

Returns:

the results for skipped configurations (possibly empty)
getSkippedConfigurationResults
()

public int
public List<EmailableReporter2.ClassResult>

Returns:

the results for skipped tests (possibly empty)
getSkippedTestResults
()

public String
protected List<EmailableReporter2.ClassResult>

Returns:

Test result grouped by method and class
groupResults
(Set<ITestResult>
All test results
results
)

Groups test results by method and then by class.

private static Set<ITestResult>
private static Set<ITestResult>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

durationback to summary
private final long duration
excludedGroupsback to summary
private final String excludedGroups
failedConfigurationResultsback to summary
private final List<EmailableReporter2.ClassResult> failedConfigurationResults
failedTestCountback to summary
private final int failedTestCount
failedTestResultsback to summary
private final List<EmailableReporter2.ClassResult> failedTestResults
includedGroupsback to summary
private final String includedGroups
passedTestCountback to summary
private final int passedTestCount
passedTestResultsback to summary
private final List<EmailableReporter2.ClassResult> passedTestResults
RESULT_COMPARATORback to summary
protected static final Comparator<ITestResult> RESULT_COMPARATOR

Orders test results by class name and then by method name (in lexicographic order).

retriedTestCountback to summary
private final int retriedTestCount
retriedTestResultsback to summary
private final List<EmailableReporter2.ClassResult> retriedTestResults
skippedConfigurationResultsback to summary
private final List<EmailableReporter2.ClassResult> skippedConfigurationResults
skippedTestCountback to summary
private final int skippedTestCount
skippedTestResultsback to summary
private final List<EmailableReporter2.ClassResult> skippedTestResults
testNameback to summary
private final String testName

Constructor Detail

TestResultback to summary
public TestResult(ITestContext context)

Method Detail

formatGroupsback to summary
protected String formatGroups(String[] groups)

Formats an array of groups for display.

Parameters
groups:String[]

The groups

Returns:String

The String value of the groups

getDurationback to summary
public long getDuration()
getExcludedGroupsback to summary
public String getExcludedGroups()
getFailedConfigurationResultsback to summary
public List<EmailableReporter2.ClassResult> getFailedConfigurationResults()
Returns:List<EmailableReporter2.ClassResult>

the results for failed configurations (possibly empty)

getFailedTestCountback to summary
public int getFailedTestCount()
getFailedTestResultsback to summary
public List<EmailableReporter2.ClassResult> getFailedTestResults()
Returns:List<EmailableReporter2.ClassResult>

the results for failed tests (possibly empty)

getIncludedGroupsback to summary
public String getIncludedGroups()
getPassedTestCountback to summary
public int getPassedTestCount()
getPassedTestResultsback to summary
public List<EmailableReporter2.ClassResult> getPassedTestResults()
Returns:List<EmailableReporter2.ClassResult>

the results for passed tests (possibly empty)

getRetriedTestCountback to summary
public int getRetriedTestCount()
getRetriedTestResultsback to summary
public List<EmailableReporter2.ClassResult> getRetriedTestResults()
getSkippedConfigurationResultsback to summary
public List<EmailableReporter2.ClassResult> getSkippedConfigurationResults()
Returns:List<EmailableReporter2.ClassResult>

the results for skipped configurations (possibly empty)

getSkippedTestCountback to summary
public int getSkippedTestCount()
getSkippedTestResultsback to summary
public List<EmailableReporter2.ClassResult> getSkippedTestResults()
Returns:List<EmailableReporter2.ClassResult>

the results for skipped tests (possibly empty)

getTestNameback to summary
public String getTestName()
groupResultsback to summary
protected List<EmailableReporter2.ClassResult> groupResults(Set<ITestResult> results)

Groups test results by method and then by class.

Parameters
results:Set<ITestResult>

All test results

Returns:List<EmailableReporter2.ClassResult>

Test result grouped by method and class

pruneRetriedback to summary
private static Set<ITestResult> pruneRetried(Set<ITestResult> results)
pruneSkippedback to summary
private static Set<ITestResult> pruneSkipped(Set<ITestResult> results)