Class ForkingRunListener

java.lang.Object
org.apache.maven.surefire.booter.ForkingRunListener
All Implemented Interfaces:
ConsoleLogger, ConsoleOutputReceiver, ConsoleStream, RunListener

public class ForkingRunListener extends Object implements RunListener, ConsoleLogger, ConsoleOutputReceiver, ConsoleStream
Encodes the full output of the test run to the stdout stream.
This class and the ForkClient contain the full definition of the "wire-level" protocol used by the forked process. The protocol is *not* part of any public api and may change without further notice.
This class is threadsafe.
The synchronization in the underlying PrintStream (target instance) is used to preserve thread safety of the output stream. To perform multiple writes/prints for a single request, they must synchronize on "target.out" variable in this class.
  • Field Details

  • Constructor Details

  • Method Details

    • testSetStarting

      public void testSetStarting(TestSetReportEntry report)
      Description copied from interface: RunListener
      Indicates the start of a given test-set
      Specified by:
      testSetStarting in interface RunListener
      Parameters:
      report - the report entry describing the testset
    • testSetCompleted

      public void testSetCompleted(TestSetReportEntry report)
      Description copied from interface: RunListener
      Indicates end of a given test-set
      Specified by:
      testSetCompleted in interface RunListener
      Parameters:
      report - the report entry describing the testset
    • testStarting

      public void testStarting(ReportEntry report)
      Description copied from interface: RunListener
      Event fired when a test is about to start
      Specified by:
      testStarting in interface RunListener
      Parameters:
      report - The report entry to log for
    • testSucceeded

      public void testSucceeded(ReportEntry report)
      Description copied from interface: RunListener
      Event fired when a test ended successfully
      Specified by:
      testSucceeded in interface RunListener
      Parameters:
      report - The report entry to log for
    • testAssumptionFailure

      public void testAssumptionFailure(ReportEntry report)
      Description copied from interface: RunListener
      Event fired when a test assumption failure was encountered. An assumption failure indicates that the test is not relevant
      Specified by:
      testAssumptionFailure in interface RunListener
      Parameters:
      report - The report entry to log for
    • testError

      public void testError(ReportEntry report)
      Description copied from interface: RunListener
      Event fired when a test ended with an error (non anticipated problem)
      Specified by:
      testError in interface RunListener
      Parameters:
      report - The report entry to log for
    • testFailed

      public void testFailed(ReportEntry report)
      Description copied from interface: RunListener
      Event fired when a test ended with a failure (anticipated problem)
      Specified by:
      testFailed in interface RunListener
      Parameters:
      report - The report entry to log for
    • testSkipped

      public void testSkipped(ReportEntry report)
      Description copied from interface: RunListener
      Event fired when a test is skipped
      Specified by:
      testSkipped in interface RunListener
      Parameters:
      report - The report entry to log for
    • testExecutionSkippedByUser

      public void testExecutionSkippedByUser()
      Description copied from interface: RunListener
      Event fired skipping an execution of remaining test-set in other fork(s); or does nothing if no forks. The method is called by SurefireProvider.

      (The event is fired after the Nth test failed to signal skipping the rest of test-set.)

      Specified by:
      testExecutionSkippedByUser in interface RunListener
    • markAs

      public RunMode markAs(RunMode currentRunMode)
      Description copied from interface: RunListener
      Marks the listener with run mode, e.g. normal run or re-run.
      Specified by:
      markAs in interface RunListener
      Parameters:
      currentRunMode - set current run
      Returns:
      previous run mode; never returns null
    • writeTestOutput

      public void writeTestOutput(String output, boolean newLine, boolean stdout)
      Description copied from interface: ConsoleOutputReceiver
      Forwards process output from the running test-case into the reporting system
      Specified by:
      writeTestOutput in interface ConsoleOutputReceiver
      Parameters:
      output - stdout/sterr output from running tests
      newLine - print on new line
      stdout - Indicates if this is stdout
    • isDebugEnabled

      public boolean isDebugEnabled()
      Specified by:
      isDebugEnabled in interface ConsoleLogger
    • debug

      public void debug(String message)
      Specified by:
      debug in interface ConsoleLogger
    • isInfoEnabled

      public boolean isInfoEnabled()
      Specified by:
      isInfoEnabled in interface ConsoleLogger
    • info

      public void info(String message)
      Specified by:
      info in interface ConsoleLogger
    • isWarnEnabled

      public boolean isWarnEnabled()
      Specified by:
      isWarnEnabled in interface ConsoleLogger
    • warning

      public void warning(String message)
      Specified by:
      warning in interface ConsoleLogger
    • isErrorEnabled

      public boolean isErrorEnabled()
      Specified by:
      isErrorEnabled in interface ConsoleLogger
    • error

      public void error(String message)
      Specified by:
      error in interface ConsoleLogger
      Parameters:
      message - message to log
    • error

      public void error(String message, Throwable t)
      Description copied from interface: ConsoleLogger
      Simply delegates to error( toString( t, message ) ).
      Specified by:
      error in interface ConsoleLogger
      Parameters:
      message - message to log
      t - exception, message and trace to log
    • error

      public void error(Throwable t)
      Description copied from interface: ConsoleLogger
      Simply delegates to method error(null, Throwable).
      Specified by:
      error in interface ConsoleLogger
      Parameters:
      t - exception, message and trace to log
    • println

      public void println(String message)
      Specified by:
      println in interface ConsoleStream