Class DefaultReporterFactory
java.lang.Object
org.apache.maven.plugin.surefire.report.DefaultReporterFactory
- All Implemented Interfaces:
ReporterFactory
Provides reporting modules on the plugin side.
Keeps a centralized count of test run results.
Keeps a centralized count of test run results.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConsoleLogger
private Map<String,
List<TestMethodStats>> private Map<String,
List<TestMethodStats>> private Map<String,
List<TestMethodStats>> private final Integer
private RunStatistics
private final Collection<TestSetRunListener>
private final StartupReportConfiguration
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultReporterFactory
(StartupReportConfiguration reportConfiguration, ConsoleLogger consoleLogger) DefaultReporterFactory
(StartupReportConfiguration reportConfiguration, ConsoleLogger consoleLogger, Integer forkNumber) -
Method Summary
Modifier and TypeMethodDescription(package private) final void
addListener
(TestSetRunListener listener) close()
Closes the factory, freeing resources allocated in the factory.private ConsoleOutputReportEventListener
Creates a reporter.private StatisticsReporter
private void
(package private) static DefaultReporterFactory.TestResultType
getTestResultType
(List<ReportEntryType> reportEntries, int rerunFailingTestsCount) Get the result of a test based on all its runs.private void
private void
private void
private void
void
mergeFromOtherFactories
(Collection<DefaultReporterFactory> factories) private void
Merge all the TestMethodStats in each TestRunListeners and put results into flakyTests, failedTests and errorTests, indexed by test class and method name.(package private) boolean
Print failed tests and flaked tests.private void
void
private void
private void
-
Field Details
-
listeners
-
reportConfiguration
-
consoleLogger
-
forkNumber
-
globalStats
-
flakyTests
-
failedTests
-
errorTests
-
-
Constructor Details
-
DefaultReporterFactory
public DefaultReporterFactory(StartupReportConfiguration reportConfiguration, ConsoleLogger consoleLogger) -
DefaultReporterFactory
public DefaultReporterFactory(StartupReportConfiguration reportConfiguration, ConsoleLogger consoleLogger, Integer forkNumber)
-
-
Method Details
-
createReporter
Description copied from interface:ReporterFactory
Creates a reporter.- Specified by:
createReporter
in interfaceReporterFactory
- Returns:
- A reporter instance
-
getReportsDirectory
-
createConsoleReporter
private StatelessTestsetInfoConsoleReportEventListener<WrappedReportEntry,TestSetStats> createConsoleReporter() -
createFileReporter
private StatelessTestsetInfoFileReportEventListener<WrappedReportEntry,TestSetStats> createFileReporter() -
createSimpleXMLReporter
-
createConsoleOutputReceiver
-
createStatisticsReporter
-
mergeFromOtherFactories
-
addListener
-
close
Description copied from interface:ReporterFactory
Closes the factory, freeing resources allocated in the factory.- Specified by:
close
in interfaceReporterFactory
- Returns:
- The run result
-
runStarting
public void runStarting() -
runCompleted
private void runCompleted() -
getGlobalRunStatistics
-
getTestResultType
static DefaultReporterFactory.TestResultType getTestResultType(List<ReportEntryType> reportEntries, int rerunFailingTestsCount) Get the result of a test based on all its runs. If it has success and failures/errors, then it is a flake; if it only has errors or failures, then count its result based on its first run- Parameters:
reportEntries
- the list of test run report type for a given testrerunFailingTestsCount
- configured rerun count for failing tests- Returns:
- the type of test result
-
mergeTestHistoryResult
private void mergeTestHistoryResult()Merge all the TestMethodStats in each TestRunListeners and put results into flakyTests, failedTests and errorTests, indexed by test class and method name. Update globalStatistics based on the result of the merge. -
printTestFailures
Print failed tests and flaked tests. A test is considered as a failed test if it failed/got an error with all the runs. If a test passes in ever of the reruns, it will be count as a flaked test- Parameters:
type
- the type of results to be printed, could be error, failure or flake- Returns:
true
if printed some lines
-
log
private void log(String s, boolean success, boolean failures, boolean errors, boolean skipped, boolean flakes) -
log
-
log
-
info
-
warning
-
success
-
failure
-