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
static int ACTION_DETAL
          (HTTP) Reports test log events in the most detail.
static int ALL
           
static int DEBUG
           
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
 int getLevel()
          Returns the current test log level.
 void reportEvent(org.eclipse.hyades.test.common.event.ExecutionEvent event)
          Reports a TPTP ExecutionEvent to the test log if the calling virtual user is being sampled.
 void reportEvent(org.eclipse.hyades.test.common.event.ExecutionEvent event, int historyType)
          Reports a TPTP ExecutionEvent to the test log if the calling virtual user is being sampled.
 void reportMessage(java.lang.String msg)
          Creates a TPTP MessageEvent and places it in the test log.
 void reportMessage(java.lang.String msg, int severity)
          Creates a TPTP MessageEvent and places it in the test log.
 void reportMessage(java.lang.String msg, int severity, int historyType)
          Creates a TPTP MessageEvent and places it in the test log.
 void reportVerdict(java.lang.String txt, int verdict)
          Creates a TPTP VerdictEvent and places it in the test log.
 void reportVerdict(java.lang.String txt, int verdict, int reason)
          Creates a TPTP VerdictEvent and places it in the test log.
 void reportVerdict(java.lang.String txt, int verdict, int reason, java.lang.String cause)
          Creates a TPTP VerdictEvent and places it in the test log.
 void reportVerdict(org.eclipse.hyades.test.common.event.VerdictEvent event)
          Reports a TPTP VerdictEvent.
 void reportVerificationPoint(java.lang.String name, int verdict)
          Creates a TPTP VerdictEvent and places it in the test log.
 void reportVerificationPoint(java.lang.String name, int verdict, java.lang.String text)
          Creates a TPTP VerdictEvent and places it in the test log.
 void reportVerificationPoint(java.lang.String name, int verdict, java.lang.String text, int reason)
          Creates a TPTP VerdictEvent and places it in the test log.
 void reportVerificationPoint(java.lang.String name, int verdict, java.lang.String text, int reason, java.lang.String cause)
          Creates a TPTP VerdictEvent and places it in the test log.
 void reportVerificationPoint(org.eclipse.hyades.test.common.event.VerdictEvent vp)
          Reports a user-created TPTP VerdictEvent as a user-defined verification point.
 boolean wouldReport(int level)
          Returns true if a TestLog event of the given level will be delivered.
 

Field Detail

NONE

public static final int NONE
Does not report any test logs.

Used for internal testing purposes only.


SCHEDULE

public 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.

See Also:
ALL, ACTION_DETAL, SECONDARY_TEST_ACTION, PRIMARY_TEST_ACTION

PRIMARY_TEST_ACTION

public 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.

See Also:
ALL, ACTION_DETAL, SECONDARY_TEST_ACTION, SCHEDULE

SECONDARY_TEST_ACTION

public 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.

See Also:
ALL, ACTION_DETAL, PRIMARY_TEST_ACTION, SCHEDULE

ACTION_DETAL

public 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.

See Also:
ALL, SECONDARY_TEST_ACTION, PRIMARY_TEST_ACTION, SCHEDULE

DEBUG

public static final int DEBUG

ALL

public static final int ALL
Method Detail

getLevel

public int getLevel()
Returns the current test log level.

Returns:
The current test log level.

wouldReport

public 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.

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

reportEvent

public void reportEvent(org.eclipse.hyades.test.common.event.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.


reportEvent

public void reportEvent(org.eclipse.hyades.test.common.event.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.

reportMessage

public void reportMessage(java.lang.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

public void reportMessage(java.lang.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

public void reportMessage(java.lang.String msg)
Creates a TPTP MessageEvent and places it in the test log.

Parameters:
msg - The text of the message event.

reportVerdict

public void reportVerdict(java.lang.String txt,
                          int verdict,
                          int reason,
                          java.lang.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

public void reportVerdict(java.lang.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

public void reportVerdict(java.lang.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

public void reportVerdict(org.eclipse.hyades.test.common.event.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

public void reportVerificationPoint(java.lang.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

public void reportVerificationPoint(java.lang.String name,
                                    int verdict,
                                    java.lang.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

public void reportVerificationPoint(java.lang.String name,
                                    int verdict,
                                    java.lang.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

public void reportVerificationPoint(java.lang.String name,
                                    int verdict,
                                    java.lang.String text,
                                    int reason,
                                    java.lang.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

public void reportVerificationPoint(org.eclipse.hyades.test.common.event.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.


Copyright (c) IBM Corp. and others 2005. All rights reserved