Class DefaultReporterFactory
java.lang.Object
org.apache.maven.plugin.surefire.report.DefaultReporterFactory
- All Implemented Interfaces:
ReportsMerger,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 ConsoleLoggerprivate Map<String,List<TestMethodStats>> private Map<String,List<TestMethodStats>> private Map<String,List<TestMethodStats>> private final Integerprivate RunStatisticsprivate 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 voidaddListener(TestSetRunListener listener) close()Closes the factory, freeing resources allocated in the factory.private ConsoleOutputReportEventListenerprivate StatisticsReporterCreates a reporter listener.private void(package private) static DefaultReporterFactory.TestResultTypegetTestResultType(List<ReportEntryType> reportEntries, int rerunFailingTestsCount) Get the result of a test based on all its runs.private voidprivate voidprivate voidprivate voidvoidmergeFromOtherFactories(Collection<DefaultReporterFactory> factories) private voidMerge all the TestMethodStats in each TestRunListeners and put results into flakyTests, failedTests and errorTests, indexed by test class and method name.(package private) booleanPrint failed tests and flaked tests.private voidvoidprivate voidprivate 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
-
createTestReportListener
Description copied from interface:ReporterFactoryCreates a reporter listener.- Specified by:
createTestReportListenerin interfaceReporterFactory- Returns:
- new reporter listener instance
-
getReportsDirectory
- Specified by:
getReportsDirectoryin interfaceReportsMerger
-
createConsoleReporter
private StatelessTestsetInfoConsoleReportEventListener<WrappedReportEntry,TestSetStats> createConsoleReporter() -
createFileReporter
private StatelessTestsetInfoFileReportEventListener<WrappedReportEntry,TestSetStats> createFileReporter() -
createSimpleXMLReporter
-
createConsoleOutputReceiver
-
createStatisticsReporter
-
mergeFromOtherFactories
- Specified by:
mergeFromOtherFactoriesin interfaceReportsMerger
-
addListener
-
close
Description copied from interface:ReporterFactoryCloses the factory, freeing resources allocated in the factory.- Specified by:
closein interfaceReporterFactory- Specified by:
closein interfaceReportsMerger- Returns:
- The run result
-
runStarting
public void runStarting()- Specified by:
runStartingin interfaceReportsMerger
-
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:
trueif 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
-