Class ConsoleTestCallback


public class ConsoleTestCallback extends AbstractTestRunnerCallback
A simple callback which prints out test progression information onto the console.
Author:
Rene Schneider - initial API and implementation
  • Field Details

    • startTime

      protected long startTime
      Test execution start time.
    • testCount

      protected int testCount
      The number of tests executed.
    • tableTestRowCount

      protected int tableTestRowCount
      Counting table test rows.
    • callCount

      protected int callCount
      The number of calls executed.
    • suiteCount

      protected int suiteCount
      The number of suites executed.
    • suiteNumbers

      protected Map<Suite,Integer> suiteNumbers
      Map remembering suite numbers.
    • classLoader

      @Inject protected ClassLoader classLoader
      The classloader to use.
    • parameterResolver

      @Inject protected ParameterResolver parameterResolver
      The parameter resolver to use.
    • variableManager

      @Inject protected VariableManager variableManager
      The variable manager to use.
    • testFormatter

      @Inject protected TestFormatter testFormatter
      The test formatter to use.
  • Constructor Details

    • ConsoleTestCallback

      public ConsoleTestCallback()
  • Method Details

    • onExecutionStart

      public void onExecutionStart(TestModel aModel, VariantDefinition aVariant)
      Description copied from class: TestRunnerCallback
      Called when the execution starts, that is, before the first (root) suite is entered. This is always the first call of an execution phase.
      Specified by:
      onExecutionStart in class TestRunnerCallback
      Parameters:
      aModel - the test model that will be executed
    • onTestStart

      public void onTestStart(Test aTest)
      Description copied from class: TestRunnerCallback
      Called right before a test is being executed.
      Specified by:
      onTestStart in class TestRunnerCallback
      Parameters:
      aTest - the test
    • onTestFinish

      public void onTestFinish(Test aTest, TestResult aResult)
      Description copied from class: TestRunnerCallback
      Called after a test was executed.
      Specified by:
      onTestFinish in class TestRunnerCallback
      Parameters:
      aTest - the test that was executed
      aResult - the result of the execution
    • displayExtendedResults

      protected void displayExtendedResults(List<ExtendedResultFixture.ExtendedResult> someExtendedResults)
      Displays the provided extended results on the console.
      Parameters:
      someExtendedResults - the extended result list to display
    • displayTestSubResult

      protected void displayTestSubResult(TestSubResult aSubResult)
      Displays a test sub-result.
      Parameters:
      aSubResult - the sub-result to display
    • onExecutionFinish

      public void onExecutionFinish(TestModel aModel, SuiteSummaryResult aResult)
      Description copied from class: TestRunnerCallback
      Called after all execution has been finished. This is always the last call of an execution phase.
      Specified by:
      onExecutionFinish in class TestRunnerCallback
      Parameters:
      aModel -
      aResult -
    • onSuiteStart

      public void onSuiteStart(Suite aSuite)
      Description copied from class: TestRunnerCallback
      Called when a suite call is being followed.
      Specified by:
      onSuiteStart in class TestRunnerCallback
      Parameters:
      aSuite - the suite call that will be entered
    • onSuiteSkipped

      public void onSuiteSkipped(Suite aSuite, SuiteSkipReason aReason)
      Description copied from class: TestRunnerCallback
      Called when a suite call is being skipped.
      Specified by:
      onSuiteSkipped in class TestRunnerCallback
      Parameters:
      aSuite - the suite being skipped
      aReason - the reason for the skipping
    • onSuiteFinish

      public void onSuiteFinish(Suite aSuite, SuiteSummaryResult aResult)
      Description copied from class: TestRunnerCallback
      Called after a suite has finished execution. This might return a SuiteResult instance if the suite was executed locally, or a SuiteSummaryResult with just the summary count information if the suite ran on a fork, in which case the detailed information is not available.
      Specified by:
      onSuiteFinish in class TestRunnerCallback
      Parameters:
      aSuite - the suite that was executed
      aResult - the result of the execution
    • onVariableDefinition

      public void onVariableDefinition(VariableEntity aDefinition, SuiteDefinition aSuite, Object anInitialValue)
      Description copied from class: TestRunnerCallback
      Called when a variable is being defined.
      Specified by:
      onVariableDefinition in class TestRunnerCallback
      Parameters:
      aDefinition - the variable
      aSuite - the suite in which the variable is scoped (may be null if the variable is global)
      anInitialValue - the initial value (may be null if no initial value is given)
    • onConstantDefinition

      public void onConstantDefinition(ConstantEntity aDefinition, SuiteDefinition aSuite, Object aValue, boolean aParameterizedFlag)
      Description copied from class: TestRunnerCallback
      Called when a constant is being defined.
      Specified by:
      onConstantDefinition in class TestRunnerCallback
      Parameters:
      aDefinition - the constant
      aSuite - the suite in which the constant is scoped (may be null if the constant is global)
      aValue - the value (may be null if no value was given)
      aParameterizedFlag - true if the constant was parameterized (value defined not in script, but from outside the test runner via parameter)
    • onVariableAssignment

      public void onVariableAssignment(VariableAssignment anAssignment, VariableEntity aDefinition, SuiteDefinition aSuite, Object aValue)
      Description copied from class: TestRunnerCallback
      Called when a variable is being assigned.
      Specified by:
      onVariableAssignment in class TestRunnerCallback
      Parameters:
      anAssignment - the assignment
      aDefinition - the variable that the value is to be assigned
      aSuite - the suite in which the variable is scoped (may be null if the variable is global)
      aValue - the value
    • onReturnVariableAssignment

      public void onReturnVariableAssignment(SuiteReturn aReturn, VariableEntity aSource, VariableEntity aTarget, Suite aSuite, Object aValue)
      Description copied from class: TestRunnerCallback
      Called when a return variable value from a suite is assigned to the respective local variable in the calling suite.
      Specified by:
      onReturnVariableAssignment in class TestRunnerCallback
      Parameters:
      aReturn - the return variable object
      aSource - the source variable entity
      aTarget - the target variable entity
      aSuite - the suite invocation for which the assignment is done
      aValue - the value to be assigned
    • onTimeSetStart

      public void onTimeSetStart(TimeSet aTimeSet, SuiteDefinition aSuite, List<ForkDefinition> someForks)
      Description copied from class: TestRunnerCallback
      Called when the test time will be set.
      Specified by:
      onTimeSetStart in class TestRunnerCallback
      Parameters:
      aTimeSet - the time to be set
      aSuite - the suite in which the time was set
      someForks - the forks on which the time was set (the null element in the list means the master process)
    • onTimeSetFinish

      public void onTimeSetFinish(TimeSet aTimeSet, TimeSetResult aResult)
      Description copied from class: TestRunnerCallback
      Called when the test time was set.
      Specified by:
      onTimeSetFinish in class TestRunnerCallback
      Parameters:
      aTimeSet - the time to be set
      aResult - the result of the operation
    • onCallStart

      public void onCallStart(Call aCall)
      Description copied from class: TestRunnerCallback
      Called before a call is being executed.
      Specified by:
      onCallStart in class TestRunnerCallback
      Parameters:
      aCall - the call
    • onCallFinish

      public void onCallFinish(Call aCall, CallResult aResult)
      Description copied from class: TestRunnerCallback
      Called right after a call was executed.
      Specified by:
      onCallFinish in class TestRunnerCallback
      Parameters:
      aCall - the call
      aResult - the result of the execution
    • onSetupStart

      public void onSetupStart(SuiteDefinition aSetupSuite)
      Description copied from class: TestRunnerCallback
      Called when a setup suite is being called.
      Specified by:
      onSetupStart in class TestRunnerCallback
      Parameters:
      aSetupSuite - the setup suite being entered
    • onSetupSkipped

      public void onSetupSkipped(SuiteDefinition aSetupSuite, SuiteSkipReason aReason)
      Description copied from class: TestRunnerCallback
      Called when a setup suite is being skipped.
      Specified by:
      onSetupSkipped in class TestRunnerCallback
      Parameters:
      aSetupSuite - the suite being skipped
      aReason - the reason for the skipping
    • onSetupFinish

      public void onSetupFinish(SuiteDefinition aSetupSuite, SuiteResult aResult)
      Description copied from class: TestRunnerCallback
      Called when a setup suite has been executed.
      Specified by:
      onSetupFinish in class TestRunnerCallback
      Parameters:
      aSetupSuite - the setup suite that was executed
      aResult - the result of the execution
    • onTearDownStart

      public void onTearDownStart(SuiteDefinition aTearDownSuite)
      Description copied from class: TestRunnerCallback
      Called before a teardown suite is being executed.
      Specified by:
      onTearDownStart in class TestRunnerCallback
      Parameters:
      aTearDownSuite - the suite to be executed
    • onTearDownSkipped

      public void onTearDownSkipped(SuiteDefinition aTearDownSuite, SuiteSkipReason aReason)
      Description copied from class: TestRunnerCallback
      Called when a teardown suite is being skipped.
      Specified by:
      onTearDownSkipped in class TestRunnerCallback
      Parameters:
      aTearDownSuite - the suite being skipped
      aReason - the reason for the skipping
    • onTearDownFinish

      public void onTearDownFinish(SuiteDefinition aTearDownSuite, SuiteResult aResult)
      Description copied from class: TestRunnerCallback
      Called after a teardown suite was executed.
      Specified by:
      onTearDownFinish in class TestRunnerCallback
      Parameters:
      aTearDownSuite - the suite that was executed
      aResult - the result of the execution
    • onTableTestStart

      public void onTableTestStart(TableTest aTableTest)
      Description copied from class: TestRunnerCallback
      Called when a table test is about to be executed.
      Specified by:
      onTableTestStart in class TestRunnerCallback
      Parameters:
      aTableTest - the table test
    • onTableTestRowStart

      public void onTableTestRowStart(TableTest aTableTest, TableTestRow aRow)
      Description copied from class: TestRunnerCallback
      Called when a single row of a table test is about to be executed.
      Specified by:
      onTableTestRowStart in class TestRunnerCallback
      Parameters:
      aTableTest - the table test that contains the row
      aRow - the row
    • onTableTestRowFinish

      public void onTableTestRowFinish(TableTest aTableTest, TableTestRow aRow, TestSubResult aSubResult)
      Description copied from class: TestRunnerCallback
      Called after a table test row has been executed.
      Specified by:
      onTableTestRowFinish in class TestRunnerCallback
      Parameters:
      aTableTest - the table test that contains the row
      aRow - the row that was executed
      aSubResult - the result of the execution
    • onTableTestFinish

      public void onTableTestFinish(TableTest aTableTest, TestResult aResult)
      Description copied from class: TestRunnerCallback
      Called after a tabletest was fully executed (all rows have been executed).
      Specified by:
      onTableTestFinish in class TestRunnerCallback
      Parameters:
      aTableTest - the table test
      aResult - the result of the test execution
    • onVisibleComment

      public void onVisibleComment(String aCommentText, boolean anIsTitle, VisibleComment aCommentElement)
      Description copied from class: TestRunnerCallback
      Called when a visible comment is encountered during execution.
      Specified by:
      onVisibleComment in class TestRunnerCallback
      Parameters:
      aCommentText - the text inside the comment
      aCommentElement - the raw comment element
    • onVisibleDivider

      public void onVisibleDivider(String aDividerText, VisibleDivider aDividerElement)
      Description copied from class: TestRunnerCallback
      Called when a visible divider is encountered during execution.
      Specified by:
      onVisibleDivider in class TestRunnerCallback
      Parameters:
      aDividerText - the divider text (basically a String of '-' chars with minimum length of 3 chars)
      aDividerElement - the raw divider element
    • onAbortExecution

      public void onAbortExecution(String anAbortExecutionMessage, String anAbortExecutionStackTrace)
      Description copied from class: TestRunnerCallback
      Called when test execution is aborted prematurely due to an AbortExecutionException - either thrown locally or by a fork. The original exception can't be provided since it cannot be received from a fork by remoting. Instead, the data from the exception is provided in both cases.
      Specified by:
      onAbortExecution in class TestRunnerCallback
      Parameters:
      anAbortExecutionMessage - the message from the exception
      anAbortExecutionStackTrace - the stack trace of the exception
    • onMessageFromFork

      public void onMessageFromFork(TestRunnerCallbackMethods aMethod, Serializable... someObjects)
      Description copied from class: TestRunnerCallback
      Called when a fork has sent a message to the masters' callback. In order to merge results determined by forks seamlessly into the masters' results, callbacks do automatically have a simple messaging system at their disposal. When a fork callback uses TestRunnerCallback.sendToMaster(TestRunnerCallbackMethods, Serializable...), this method is called on the masters' respective callback in order to deliver the objects given.
      Specified by:
      onMessageFromFork in class TestRunnerCallback
      Parameters:
      aMethod - the method that was called on the forks' callback (doesn't have to be used, evaluating this parameter is the job of the masters' callback and can thus be omitted if it ain't necessary)
      someObjects - the objects sent by the forks' callback
    • print

      protected void print(String aString)
      Prints something, if we're not currently in a dry run.
      Parameters:
      aString - the string to print
    • println

      protected void println(String aString)
      Prints plus newline, if we're not currently in a dry run.
      Parameters:
      aString - the string to print
    • resolveSuiteSkipReasonToText

      protected String resolveSuiteSkipReasonToText(SuiteSkipReason aReason)
      Turns a SuiteSkipReason into understandable text.
      Parameters:
      aReason - the reason
      Returns:
      the textual reason