Class DefaultReporterFactory

  • All Implemented Interfaces:
    ReporterFactory

    public class DefaultReporterFactory
    extends java.lang.Object
    implements ReporterFactory
    Provides reporting modules on the plugin side.
    Keeps a centralized count of test run results.
    • Field Detail

      • forkNumber

        private final java.lang.Integer forkNumber
      • flakyTests

        private java.util.Map<java.lang.String,​java.util.List<TestMethodStats>> flakyTests
      • failedTests

        private java.util.Map<java.lang.String,​java.util.List<TestMethodStats>> failedTests
      • errorTests

        private java.util.Map<java.lang.String,​java.util.List<TestMethodStats>> errorTests
    • Method Detail

      • getReportsDirectory

        public java.io.File getReportsDirectory()
      • mergeFromOtherFactories

        public void mergeFromOtherFactories​(java.util.Collection<DefaultReporterFactory> factories)
      • close

        public RunResult close()
        Description copied from interface: ReporterFactory
        Closes the factory, freeing resources allocated in the factory.
        Specified by:
        close in interface ReporterFactory
        Returns:
        The run result
      • runStarting

        public void runStarting()
      • runCompleted

        private void runCompleted()
      • getGlobalRunStatistics

        public RunStatistics getGlobalRunStatistics()
      • getTestResultType

        static DefaultReporterFactory.TestResultType getTestResultType​(java.util.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 test
        rerunFailingTestsCount - 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

        boolean printTestFailures​(DefaultReporterFactory.TestResultType type)
        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​(java.lang.String s,
                         boolean success,
                         boolean failures,
                         boolean errors,
                         boolean skipped,
                         boolean flakes)
      • log

        private void log​(java.lang.String s,
                         Level level)
      • log

        private void log​(java.lang.String s)
      • info

        private void info​(java.lang.String s)
      • warning

        private void warning​(java.lang.String s)
      • success

        private void success​(java.lang.String s)
      • failure

        private void failure​(java.lang.String s)