Class LoggingReporter

java.lang.Object
org.citrusframework.report.AbstractTestReporter
org.citrusframework.report.LoggingReporter
All Implemented Interfaces:
org.citrusframework.common.ShutdownPhase, org.citrusframework.report.MessageListener, org.citrusframework.report.TestActionListener, org.citrusframework.report.TestListener, org.citrusframework.report.TestReporter, org.citrusframework.report.TestSuiteListener
Direct Known Subclasses:
OutputStreamReporter

public class LoggingReporter extends AbstractTestReporter implements org.citrusframework.report.MessageListener, org.citrusframework.report.TestSuiteListener, org.citrusframework.report.TestListener, org.citrusframework.report.TestActionListener, org.citrusframework.common.ShutdownPhase
Simple logging reporter printing test start and ending to the console/logger.

This class provides an option for disablement, allowing you to suppress logging for specific instances and delegate the logging to another facility, which could potentially be a subclass of LoggingReporter. It's important to note that when an instance of this class is disabled, it will not perform any logging, irrespective of the severity level.

Implementation note: The disablement of the reporter is achieved by using a NOPLogger, meaning that this class should primarily focus on logging operations and not extend beyond that functionality.

  • Constructor Details

    • LoggingReporter

      public LoggingReporter()
    • LoggingReporter

      public LoggingReporter(boolean stackTraceOutputEnabled)
  • Method Details

    • initialized

      protected static void initialized(boolean value)
    • isStackTraceOutputEnabled

      public boolean isStackTraceOutputEnabled()
    • generate

      public void generate(org.citrusframework.report.TestResults testResults)
      Description copied from class: AbstractTestReporter
      Subclasses must implement this method and generate the test report for given test results.
      Specified by:
      generate in class AbstractTestReporter
    • onTestFailure

      public void onTestFailure(org.citrusframework.TestCase testCase, Throwable cause)
      Specified by:
      onTestFailure in interface org.citrusframework.report.TestListener
    • onTestSkipped

      public void onTestSkipped(org.citrusframework.TestCase test)
      Specified by:
      onTestSkipped in interface org.citrusframework.report.TestListener
    • onTestStart

      public void onTestStart(org.citrusframework.TestCase test)
      Specified by:
      onTestStart in interface org.citrusframework.report.TestListener
    • onTestExecutionEnd

      public void onTestExecutionEnd(org.citrusframework.TestCase test)
      Specified by:
      onTestExecutionEnd in interface org.citrusframework.report.TestListener
    • onTestSuccess

      public void onTestSuccess(org.citrusframework.TestCase test)
      Specified by:
      onTestSuccess in interface org.citrusframework.report.TestListener
    • onFinish

      public void onFinish()
      Specified by:
      onFinish in interface org.citrusframework.report.TestSuiteListener
    • onStart

      public void onStart()
      Specified by:
      onStart in interface org.citrusframework.report.TestSuiteListener
    • onFinishFailure

      public void onFinishFailure(Throwable cause)
      Specified by:
      onFinishFailure in interface org.citrusframework.report.TestSuiteListener
    • onFinishSuccess

      public void onFinishSuccess()
      Specified by:
      onFinishSuccess in interface org.citrusframework.report.TestSuiteListener
    • onStartFailure

      public void onStartFailure(Throwable cause)
      Specified by:
      onStartFailure in interface org.citrusframework.report.TestSuiteListener
    • onStartSuccess

      public void onStartSuccess()
      Specified by:
      onStartSuccess in interface org.citrusframework.report.TestSuiteListener
    • onTestActionStart

      public void onTestActionStart(org.citrusframework.TestCase testCase, org.citrusframework.TestAction testAction)
      Specified by:
      onTestActionStart in interface org.citrusframework.report.TestActionListener
    • onTestActionFinish

      public void onTestActionFinish(org.citrusframework.TestCase testCase, org.citrusframework.TestAction testAction)
      Specified by:
      onTestActionFinish in interface org.citrusframework.report.TestActionListener
    • onTestActionFailed

      public void onTestActionFailed(org.citrusframework.TestCase testCase, org.citrusframework.TestAction testAction, Throwable cause)
      Specified by:
      onTestActionFailed in interface org.citrusframework.report.TestActionListener
    • onTestActionSkipped

      public void onTestActionSkipped(org.citrusframework.TestCase testCase, org.citrusframework.TestAction testAction)
      Specified by:
      onTestActionSkipped in interface org.citrusframework.report.TestActionListener
    • onInboundMessage

      public void onInboundMessage(org.citrusframework.message.Message message, org.citrusframework.context.TestContext context)
      Specified by:
      onInboundMessage in interface org.citrusframework.report.MessageListener
    • onOutboundMessage

      public void onOutboundMessage(org.citrusframework.message.Message message, org.citrusframework.context.TestContext context)
      Specified by:
      onOutboundMessage in interface org.citrusframework.report.MessageListener
    • separator

      protected void separator()
      Helper method to build consistent separators
    • newLine

      protected void newLine()
      Adds new line to console logging output.
    • info

      protected void info(String line)
      Write info level output.
    • error

      protected void error(String line)
      Write error level output.
    • error

      protected void error(String line, Throwable cause)
      Write error level output.
    • debug

      protected void debug(String line)
      Write debug level output.
    • isDebugEnabled

      protected boolean isDebugEnabled()
      Is debug level enabled.
    • setEnabled

      public void setEnabled(boolean enabled)
      Sets the enablement state of the reporter.
    • isEnabled

      protected boolean isEnabled()
    • destroy

      public void destroy()
      Specified by:
      destroy in interface org.citrusframework.common.ShutdownPhase