com.ibm.rational.test.lt.kernel.services

Interface ITestLogManager



  • public interface ITestLogManager
    The ITestLogManager interface logs messages and verification points to the TestLog (execution history) from actions in custom code.

    Most code must handle error conditions, anomalies in expected data, or other abstract conditions that need to be reported to users. Or, a comparison or verification might need to be made in custom code, and the outcome reported.

    The ITestLogManger interface is the best interface to use for all actions, including all custom code, to report these circumstances to the TestLog. It is also the interface to use to convey informational or status messages after the completion of a test.

    This interface contains constants that are used to delineate the type of data being presented, methods for determining the categories of data requested by the tester (at the workbench), and methods for sending the messages to the logging subsystem.

    NOTE: Some methods and constants are marked for internal use only. Do not call or use them as they might have unpredictable results.

    USING ITestLogManager FROM CUSTOM CODE (ICustomCode)

    Use getTestLogManager() in ITestExecutionServices to acquire an object that provides these methods.

    To use the ITestLogManager interface from custom code, first determine what it is that you want to log. Is the message about an error that occurred, or simply informational? Does it require that the tester do something or is it just an anomaly that occurred?

    After you have determined what the message is about, examine the constants defined in this class to choose the best fit.

    For simple TestLog messages:

    If you are doing comparisons in your custom code (for example, verifying that some piece of data appeared on an HTML page), report the verdict of the the verification either as a string or as a VerdictEvent (part of the TPTP testing infrastructure). Read the documentation for VerdictEvent to understand the meaning of each of the VerdictEvent constants used as verdicts.

    Make a call to wouldReport() before issuing an event:

         if (wouldReport(ALL))
             reportVerificationPoint("x != y", VerdictEvent.VERDICT_FAIL);
     

    The detail of TestLog events reported on the workbench is determined by the settings applied to the schedule. Not all of the events are reported. They are reported according to the following hierarchy (getting more restrictive from top to bottom):

    ALL

    Report all events in greatest detail.

    ACTION_DETAL

    Report more detail about SECONDARY_TEST_ACTION events.

    SECONDARY_TEST_ACTION

    Only reports events down to the individual request.

    PRIMARY_TEST_ACTION

    Only reports events related to a page.

    SCHEDULE

    Only reports events related to the schedule (test start/stop, etc.).

    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int ACTION_DETAL
      (HTTP) Reports test log events in the most detail.
      static int ALL 
      static int DEBUG 
      static int FILTER_ALL
      Allows all event types to be included
      static int FILTER_ERRORS
      Allows error messages, failed verdicts, and error verdicts to be included.
      static int FILTER_WARNINGS
      Allows warning messages and inconclusive verdicts to be included in addition to errors
      static int NONE
      Does not report any test logs.
      static int PRIMARY_TEST_ACTION
      (HTTP) Reports test log events at the page level.
      static int SCHEDULE
      Reports test log events that correspond to actions found in the schedule behavior model.
      static int SECONDARY_TEST_ACTION
      (HTTP) Reports test log events at the request level.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void alwaysReportMessage(String msg)
      Always creates a TPTP MessageEvent and places it in the test log regardless of log level.
      int getLevel()
      Returns the current test log level.
      int getLevel(int filter)
      Returns the current test log level for the given filter.
      void reportErrorCondition(com.ibm.rational.test.lt.kernel.services.RPTCondition condition) 
      void reportEvent(ExecutionEvent event)
      Reports a TPTP ExecutionEvent to the test log if the calling virtual user is being sampled.
      void reportEvent(ExecutionEvent event, boolean override)
      Reports a TPTP ExecutionEvent to the test log if the calling virtual user is being sampled.
      void reportEvent(ExecutionEvent event, int historyType)
      Reports a TPTP ExecutionEvent to the test log if the calling virtual user is being sampled.
      void reportMessage(String msg)
      Creates a TPTP MessageEvent and places it in the test log.
      void reportMessage(String msg, int severity)
      Creates a TPTP MessageEvent and places it in the test log.
      void reportMessage(String msg, int severity, int historyType)
      Creates a TPTP MessageEvent and places it in the test log.
      void reportVerdict(String txt, int verdict)
      Creates a TPTP VerdictEvent and places it in the test log.
      void reportVerdict(String txt, int verdict, int reason)
      Creates a TPTP VerdictEvent and places it in the test log.
      void reportVerdict(String txt, int verdict, int reason, String cause)
      Creates a TPTP VerdictEvent and places it in the test log.
      void reportVerdict(VerdictEvent event)
      Reports a TPTP VerdictEvent.
      void reportVerificationPoint(String name, int verdict)
      Creates a TPTP VerdictEvent and places it in the test log.
      void reportVerificationPoint(String name, int verdict, String text)
      Creates a TPTP VerdictEvent and places it in the test log.
      void reportVerificationPoint(String name, int verdict, String text, int reason)
      Creates a TPTP VerdictEvent and places it in the test log.
      void reportVerificationPoint(String name, int verdict, String text, int reason, String cause)
      Creates a TPTP VerdictEvent and places it in the test log.
      void reportVerificationPoint(VerdictEvent vp)
      Reports a user-created TPTP VerdictEvent as a user-defined verification point.
      void reportVerificationPoint(VerdictEvent vp, IVerificationPoint vpStat)
      Report a TPTP VerdictEvent as a verification point.
      boolean wouldReport()
      Returns true if a TestLog event will be delivered.
      boolean wouldReport(ExecutionEvent event)
      Returns true if the given TestLog event will be delivered.
      boolean wouldReport(int level)
      Returns true if a TestLog event of the given level will be delivered.
      boolean wouldReport(int level, ExecutionEvent event)
      Returns true if the given TestLog event will be delivered.
      boolean wouldReportMessage(int severity)
      Returns true if a TestLog message event of the given severity will be delivered.
      boolean wouldReportMessage(int level, int severity)
      Returns true if a TestLog message event of the given level and severity will be delivered.
      boolean wouldReportVerdict(int verdict)
      Returns true if a TestLog verdict event of the given verdict will be delivered.
      boolean wouldReportVerdict(int level, int verdict)
      Returns true if a TestLog verdict event of the given level and verdict will be delivered.
    • Field Detail

      • NONE

        static final int NONE
        Does not report any test logs.

        Used for internal testing purposes only.

      • SCHEDULE

        static final int SCHEDULE
        Reports test log events that correspond to actions found in the schedule behavior model.

        This level shows high-level events down to and including test invocations. However, no events generated by the test behavior model are included in the test log.

      • PRIMARY_TEST_ACTION

        static final int PRIMARY_TEST_ACTION
        (HTTP) Reports test log events at the page level.

        This level shows events down to and including page start, page stop, and page level verification points. No individual HTTP requests are represented in the test log.

      • SECONDARY_TEST_ACTION

        static final int SECONDARY_TEST_ACTION
        (HTTP) Reports test log events at the request level.

        This level shows events down to and including individual HTTP requests and request level verification points. The actual content of the request or response is not reported.

      • ACTION_DETAL

        static final int ACTION_DETAL
        (HTTP) Reports test log events in the most detail.

        This level shows all events down to and including individual HTTP requests and request-level verification points. The actual content of the request or response is reported and visible with the protocol data view.

      • DEBUG

        static final int DEBUG
      • ALL

        static final int ALL
      • FILTER_ALL

        static final int FILTER_ALL
        Allows all event types to be included
      • FILTER_WARNINGS

        static final int FILTER_WARNINGS
        Allows warning messages and inconclusive verdicts to be included in addition to errors
      • FILTER_ERRORS

        static final int FILTER_ERRORS
        Allows error messages, failed verdicts, and error verdicts to be included.
    • Method Detail

      • getLevel

        int getLevel()
        Returns the current test log level.
        Returns:
        The current test log level.
      • getLevel

        int getLevel(int filter)
        Returns the current test log level for the given filter.
        Returns:
        The current test log level.
      • wouldReport

        boolean wouldReport()
        Returns true if a TestLog event will be delivered.

        This method evaluates the current TestLog Level and whether the calling virtual user is being sampled. The event is assumed to be neither a warning nor an error.

        Returns:
        True if an event of the given level will be delivered, false otherwise.
      • wouldReport

        boolean wouldReport(int level)
        Returns true if a TestLog event of the given level will be delivered.

        This method evaluates the TestLog Level and whether the calling virtual user is being sampled. The event is assumed to be neither a warning nor an error.

        Parameters:
        level - The level of the proposed event.
        Returns:
        True if an event of the given level will be delivered, false otherwise.
      • wouldReport

        boolean wouldReport(ExecutionEvent event)
        Returns true if the given TestLog event will be delivered.

        This method evaluates the current TestLog level, the verdict or severity if applicable and whether the calling virtual user is being sampled.

        Parameters:
        event - The proposed event.
        Returns:
        True if the event will be delivered, false otherwise.
      • wouldReport

        boolean wouldReport(int level,
                          ExecutionEvent event)
        Returns true if the given TestLog event will be delivered.

        This method evaluates the current TestLog level, the verdict or severity if applicable and whether the calling virtual user is being sampled.

        Parameters:
        level - The level of the event.
        event - The proposed event.
        Returns:
        True if the event will be delivered, false otherwise.
      • wouldReportMessage

        boolean wouldReportMessage(int severity)
        Returns true if a TestLog message event of the given severity will be delivered.

        This method evaluates the current TestLog level, the severity of the message and whether the calling virtual user is being sampled.

        Parameters:
        severity - The severity of the proposed message event.
        Returns:
        True if a message event of the given severity will be delivered, false otherwise.
      • wouldReportMessage

        boolean wouldReportMessage(int level,
                                 int severity)
        Returns true if a TestLog message event of the given level and severity will be delivered.

        This method evaluates the TestLog level, the severity of the message and whether the calling virtual user is being sampled.

        Parameters:
        level - The level of the proposed message event.
        severity - The severity of the proposed message event.
        Returns:
        True if a message event of the given level and severity will be delivered, false otherwise.
      • wouldReportVerdict

        boolean wouldReportVerdict(int verdict)
        Returns true if a TestLog verdict event of the given verdict will be delivered.

        This method evaluates the current TestLog level, the verdict and whether the calling virtual user is being sampled.

        Parameters:
        verdict - The verdict of the proposed verdict event.
        Returns:
        True if a verdict event of the given verdict will be delivered, false otherwise.
      • wouldReportVerdict

        boolean wouldReportVerdict(int level,
                                 int verdict)
        Returns true if a TestLog verdict event of the given level and verdict will be delivered.

        This method evaluates the TestLog level, the verdict and whether the calling virtual user is being sampled.

        Parameters:
        level - The level of the proposed message event.
        verdict - The verdict of the proposed verdict event.
        Returns:
        True if a verdict event of the given level and verdict will be delivered, false otherwise.
      • reportEvent

        void reportEvent(ExecutionEvent event)
        Reports a TPTP ExecutionEvent to the test log if the calling virtual user is being sampled.

        If the event.timestamp is not set, reportEvent sets it to the current time. ReportEvent() also sets the event id's correctly so that the event displays in the proper place in the test log.

        After reporting an event with reportEvent, the event's id can be gotten by event.getId() and used for another event's parentId. This makes the second event a child of the first in the test log.

        Parameters:
        event - that the TPTP ExecutionEvent reports.
      • reportEvent

        void reportEvent(ExecutionEvent event,
                       int historyType)
        Reports a TPTP ExecutionEvent to the test log if the calling virtual user is being sampled.

        If the event.timestamp is not set, reportEvent sets it to the current time. reportEvent() also sets the event id's correctly so that the event displays in the proper place in the test log.

        After reporting an event with reportEvent, the event's id can be gotten by event.getId() and used for another event's parentId. This will make the second event a child of the first in the test log.

        Parameters:
        event - The TPTP ExecutionEvent to report.
        historyType - The history level for which this event should appear.
      • reportEvent

        void reportEvent(ExecutionEvent event,
                       boolean override)
        Reports a TPTP ExecutionEvent to the test log if the calling virtual user is being sampled.

        If the event.timestamp is not set, reportEvent sets it to the current time. reportEvent() also sets the event id's correctly so that the event displays in the proper place in the test log.

        After reporting an event with reportEvent, the event's id can be gotten by event.getId() and used for another event's parentId. This will make the second event a child of the first in the test log.

        If the event would not be logged because of current testLog level or verdict or severity, but the event is to become the parent of another event which would be logged, then specifying an override of true will cause this event to be include in the testLog.

        Parameters:
        event - The TPTP ExecutionEvent to report.
        override - A flag that when true indicates that this event is to be logged regardless of level, severity, or verdict.
      • reportMessage

        void reportMessage(String msg,
                         int severity,
                         int historyType)
        Creates a TPTP MessageEvent and places it in the test log.
        Parameters:
        msg - The text of the message event.
        severity - The severity of the message event.
        historyType - The history level for which this event should appear.
      • reportMessage

        void reportMessage(String msg,
                         int severity)
        Creates a TPTP MessageEvent and places it in the test log.
        Parameters:
        msg - The text of the message event.
        severity - The severity of the message event.
      • reportMessage

        void reportMessage(String msg)
        Creates a TPTP MessageEvent and places it in the test log.
        Parameters:
        msg - The text of the message event.
      • alwaysReportMessage

        void alwaysReportMessage(String msg)
        Always creates a TPTP MessageEvent and places it in the test log regardless of log level.
        Parameters:
        msg - The text of the message event.
      • reportVerdict

        void reportVerdict(String txt,
                         int verdict,
                         int reason,
                         String cause)
        Creates a TPTP VerdictEvent and places it in the test log.

        VerdictEvents reported by this method contribute to the rollup of verdicts by the parent containers.

        If other features (such as property lists, eventType, or name) of a TPTP VerdictEvent are needed, you can create a verdictEvent and report it with reportVerdict(VerdictEvent).

        Parameters:
        txt - The text for the verdictEvent.
        verdict - The verdict for the verdictEvent. Must be one of the following:

        VerdictEvent.VERDICT_INCONCLUSIVE

        The verdict cannot be determined.

        VerdictEvent.VERDICT_PASS

        The testcase passes.

        VerdictEvent.VERDICT_FAIL

        The testcase fails.

        VerdictEvent.VERDICT_ERROR

        An error occured while processing the testcase.

        reason - The reason for the verdictEvent. Must be one of the following:

        VerdictEvent.REASON_UNKNOWN

        The reason for the verdict is unknown.

        VerdictEvent.REASON_NONE

        There is no reason for the verdict.

        VerdictEvent.REASON_SEE_DESCRIPTION

        More information is in the txt parameter.

        VerdictEvent.REASON_ABORT

        The processing of the testcase was aborted.

        VerdictEvent.REASON_DID_NOT_COMPLETE

        The testcase was not completed.

        cause - The id of an existing test log event that caused this verdict.

      • reportVerdict

        void reportVerdict(String txt,
                         int verdict,
                         int reason)
        Creates a TPTP VerdictEvent and places it in the test log.

        VerdictEvents reported by this method contribute to the rollup of verdicts by the parent containers.

        If other features (such as property lists, eventType, or name) of a TPTP VerdictEvent are needed, you can create a verdictEvent and report it with reportVerdict(VerdictEvent).

        Parameters:
        txt - The text for the verdictEvent.
        verdict - The verdict for the verdictEvent. Must be one of the following:

        VerdictEvent.VERDICT_INCONCLUSIVE

        The verdict cannot be determined.

        VerdictEvent.VERDICT_PASS

        The testcase passes.

        VerdictEvent.VERDICT_FAIL

        The testcase fails.

        VerdictEvent.VERDICT_ERROR

        An error occured while processing the testcase.

        reason - The reason for the verdictEvent. Must be one of the following:

        VerdictEvent.REASON_UNKNOWN

        The reason for the verdict is unknown.

        VerdictEvent.REASON_NONE

        There is no reason for the verdict.

        VerdictEvent.REASON_SEE_DESCRIPTION

        More information is in the txt parameter.

        VerdictEvent.REASON_ABORT

        The processing of the testcase was aborted.

        VerdictEvent.REASON_DID_NOT_COMPLETE

        The testcase was not completed.

      • reportVerdict

        void reportVerdict(String txt,
                         int verdict)
        Creates a TPTP VerdictEvent and places it in the test log.

        VerdictEvents reported by this method contribute to the rollup of verdicts by the parent containers.

        The reason for this verdictEvent is VerdictEvent.REASON_NONE.

        If other features (such as property lists, eventType, or name) of a TPTP VerdictEvent are needed, create a verdictEvent and report it with reportVerdict(VerdictEvent).

        Parameters:
        txt - The text for the verdictEvent.
        verdict - The verdict for the verdictEvent. Must be one of the following:

        VerdictEvent.VERDICT_INCONCLUSIVE

        The verdict cannot be determined.

        VerdictEvent.VERDICT_PASS

        The testcase passes.

        VerdictEvent.VERDICT_FAIL

        The testcase fails.

        VerdictEvent.VERDICT_ERROR

        An error occured while processing the testcase.

      • reportVerdict

        void reportVerdict(VerdictEvent event)
        Reports a TPTP VerdictEvent.

        It is up to the caller to instantiate the event and set all fields (except for id, parentId, and timestamp) as needed. This differs from reportEvent() in that verdicts reported by this method contribute to the rollup of verdicts by the parent containers.

        Parameters:
        event - The TPTP VerdictEvent to report.
      • reportVerificationPoint

        void reportVerificationPoint(String name,
                                   int verdict)
        Creates a TPTP VerdictEvent and places it in the test log.

        VerdictEvents reported by this method contribute to the rollup of verdicts by the parent containers. Statistics for the number of verification points of each possible verdict are kept and reported to the statistical model.

        The reason for this verdictEvent is VerdictEvent.REASON_NONE.

        If other features (such as property lists, eventType, or name) of a TPTP VerdictEvent are needed, you can create a verdictEvent and report it with reportVerificationPoint(VerdictEvent) as described in the following section.

        Parameters:
        name - The name of the verification point (for statistical reference).
        verdict - The verdict for the verdictEvent. Must be one of the following:

        VerdictEvent.VERDICT_INCONCLUSIVE

        The verdict cannot be determined.

        VerdictEvent.VERDICT_PASS

        The testcase passes.

        VerdictEvent.VERDICT_FAIL

        The testcase fails.

        VerdictEvent.VERDICT_ERROR

        An error occured while processing the testcase.

      • reportVerificationPoint

        void reportVerificationPoint(String name,
                                   int verdict,
                                   String text)
        Creates a TPTP VerdictEvent and places it in the test log.

        VerdictEvents reported by this method contribute to the rollup of verdicts by the parent containers. Statistics for the number of verification points of each possible verdict are kept and reported to the statistical model.

        The reason for this verdictEvent is VerdictEvent.REASON_NONE.

        If other features (such as property lists, eventType, or name) of a TPTP VerdictEvent are needed, you can create a verdictEvent and report it with reportVerificationPoint(VerdictEvent) as described in the following section.

        Parameters:
        name - The name of the verification point (for statistical reference).
        verdict - The verdict for the verdictEvent. Must be one of the following:

        VerdictEvent.VERDICT_INCONCLUSIVE

        The verdict cannot be determined.

        VerdictEvent.VERDICT_PASS

        The testcase passes.

        VerdictEvent.VERDICT_FAIL

        The testcase fails.

        VerdictEvent.VERDICT_ERROR

        An error occured while processing the testcase.

        text - the text for the verdictEvent

      • reportVerificationPoint

        void reportVerificationPoint(String name,
                                   int verdict,
                                   String text,
                                   int reason)
        Creates a TPTP VerdictEvent and places it in the test log.

        VerdictEvents reported by this method contribute to the rollup of verdicts by the parent containers. Statistics for the number of verification points of each possible verdict are kept and reported to the statistical model.

        If other features (such as property lists, eventType, or name) of a TPTP VerdictEvent are needed, you can create a verdictEvent and report it with reportVerificationPoint(VerdictEvent) as described in the following section.

        Parameters:
        name - The name of the verification point (for statistical reference)
        verdict - The verdict for the verdictEvent. Must be one of the following:

        VerdictEvent.VERDICT_INCONCLUSIVE

        The verdict cannot be determined.

        VerdictEvent.VERDICT_PASS

        The testcase passes.

        VerdictEvent.VERDICT_FAIL

        The testcase fails.

        VerdictEvent.VERDICT_ERROR

        An error occured while processing the testcase.

        text - The text for the verdictEvent.
        reason - The reason for the verdictEvent. Must be one of the following:

        VerdictEvent.REASON_UNKNOWN

        The reason for the verdict is unknown.

        VerdictEvent.REASON_NONE

        There is no reason for the verdict.

        VerdictEvent.REASON_SEE_DESCRIPTION

        More information is in the txt parameter.

        VerdictEvent.REASON_ABORT

        The processing of the testcase was aborted.

        VerdictEvent.REASON_DID_NOT_COMPLETE

        The testcase was not completed.

      • reportVerificationPoint

        void reportVerificationPoint(String name,
                                   int verdict,
                                   String text,
                                   int reason,
                                   String cause)
        Creates a TPTP VerdictEvent and places it in the test log.

        VerdictEvents reported by this method contribute to the rollup of verdicts by the parent containers. Statistics for the number of verification points of each possible verdict are kept and reported to the statistical model.

        If other features (such as property lists, eventType, or name) of a TPTP VerdictEvent are needed, you can create a verdictEvent and report it with reportVerificationPoint(VerdictEvent) as described in the following section.

        Parameters:
        name - The name of the verification point (for statistical reference).
        verdict - The verdict for the verdictEvent. Must be one of the following:

        VerdictEvent.VERDICT_INCONCLUSIVE

        The verdict cannot be determined.

        VerdictEvent.VERDICT_PASS

        The testcase passes.

        VerdictEvent.VERDICT_FAIL

        The testcase fails.

        VerdictEvent.VERDICT_ERROR

        An error occured while processing the testcase.

        text - The text for the verdictEvent.
        reason - The reason for the verdictEvent. Must be one of the following:

        VerdictEvent.REASON_UNKNOWN

        The reason for the verdict is unknown.

        VerdictEvent.REASON_NONE

        There is no reason for the verdict.

        VerdictEvent.REASON_SEE_DESCRIPTION

        More information is in the txt parameter.

        VerdictEvent.REASON_ABORT

        The processing of the testcase was aborted.

        VerdictEvent.REASON_DID_NOT_COMPLETE

        The testcase was not completed.

        cause - The id of an existing test log event which caused this verdict.
      • reportVerificationPoint

        void reportVerificationPoint(VerdictEvent vp)
        Reports a user-created TPTP VerdictEvent as a user-defined verification point.

        VerdictEvents reported by this method contribute to the rollup of verdicts by the parent containers. Statistics for the number of verification points of each possible verdict are kept and reported to the statistical model.

        Parameters:
        vp - The TPTP VerdictEvent to report as a verification point.
      • reportVerificationPoint

        void reportVerificationPoint(VerdictEvent vp,
                                   IVerificationPoint vpStat)
        Report a TPTP VerdictEvent as a verification point.

        VerdictEvents reported by this method contribute to the rollup of verdicts by the parent containers. The counter for the verdict in the given VerificationPoint statistics counter is incremented.

        Parameters:
        vp - the TPTP VerdictEvent to report as a verification point.
        vpStat - the counter associated with this verification point.
      • reportErrorCondition

        void reportErrorCondition(com.ibm.rational.test.lt.kernel.services.RPTCondition condition)
IBM Rational Performance Tester TES

© Copyright IBM Corp. 2013. All rights reserved.