Test Script Services

prevnext

Logging Services


Use the logging functions to build the log that TestManager uses for analysis and reporting. You can log events, messages, or test case results.

A logged event is the record of something that happened. Use the environment variable EVAR_LogEvent_control to control whether or not an event is logged.

An event that gets logged may have associated data (either returned by the server or supplied with the call). Use the environment variable EVAR_LogData_control to control whether or not any data associated with an event is logged.


Summary

Use the functions listed in the following table to write to the TestManager log.

Function Description
TSSLogEvent() Logs an event.
TSSLogMessage() Logs a message event.
TSSLogTestCaseResult() Logs a test case event.


TSSLogEvent()

Logs an event.


Syntax

s32 TSSLogEvent (char *eventType, s16 result, char 
*description, s32 propertyCount, NamedValue *property)

Element Description
eventType Contains the description to be displayed in the log for this event.
result Specifies the notification preference regarding the result of the call. Can be one of the following:
  • TSS_LOG_RESULT_NONE (default: no notification)

  • TSS_LOG_RESULT_PASS

  • TSS_LOG_RESULT_FAIL

  • TSS_LOG_RESULT_WARN

  • TSS_LOG_RESULT_STOPPED

  • TSS_LOG_RESULT_INFO

  • TSS_LOG_RESULT_COMPLETED

  • TSS_LOG_RESULT_UNEVALUATED

0 specifies the default.
description Contains the string to be put in the entry's failure description field.
propertyCount Specifies the number of rows in the property array.
property An array containing property name/value pairs, where property[n].name is the property name and property[n].value is its value.


Return Value

This function exits with one of the following results:


Comments

The event and any data associated with it are logged only if the specified result preference matches associated settings in the EVAR_LogData_control or EVAR_LogEvent_control environment variables. Alternatively, the logging preference can be set with the EVAR_Log_leveland EVAR_Record_level environment variables. The TSS_LOG_RESULT_STOPPED, TSS_LOG_RESULT_COMPLETED, and TSS_LOG_RESULT_UNEVALUATED preferences are intended for internal use.

NamedValue is defined as follows:

typedef struct {
	 	 	 char *Name;
	 	 	 char *Value;
} NamedValue;

Example

This example logs the beginning of an event of type Login Dialog.

NamedValue scriptProp[2];
scriptProp[0].Name = "ScriptName";
scriptProp[0].Value = "Login";
scriptProp[1].Name = "LineNumber";
scriptProp[1].Value = "1";
s32 retVal = TSSLogEvent("Login Dialog",0,"Login script failed", 
2,scriptProp);

TSSLogMessage()

Logs a message.


Syntax

s32 TSSLogMessage(char *message, s16 result, char *description)

Element Description
message Specifies the string to log.
result Specifies the notification preference regarding the result of the call. Can be one of the following:
  • TSS_LOG_RESULT_NONE (default: no notification)

  • TSS_LOG_RESULT_PASS

  • TSS_LOG_RESULT_FAIL

  • TSS_LOG_RESULT_WARN

  • TSS_LOG_RESULT_STOPPED

  • TSS_LOG_RESULT_INFO

  • TSS_LOG_RESULT_COMPLETED

  • TSS_LOG_RESULT_UNEVALUATED

0 specifies the default.
description Specifies the string to be put in the entry's failure description field.


Return Value

This function exits with one of the following results:


Comments

An event and any data associated with it are logged only if the specified result preference matches associated settings in the EVAR_LogData_control or EVAR_LogEvent_control environment variables.

Alternatively, the logging preference can be set with the EVAR_Log_level and EVAR_Record_level environment variables. The TSS_LOG_RESULT_STOPPED, TSS_LOG_RESULT_COMPLETED, and TSS_LOG_RESULT_UNEVALUATED preferences are intended for internal use.


Example

This example logs the following message: --Beginning of timed block T1--.

TSSLogMessage ("--Beginning of timed block T1--", 0, NULL);

TSSLogTestCaseResult()

Logs a test case result.


Syntax

s32 TSSLogTestCaseResult (char *testcase, s16 result, char 
*description, s32 propertyCount, NamedValue *property[])

Element Description
testcase Identifies the test case whose result is to be logged.
result Specifies the notification preference regarding the result of the call. Can be one of the following:
  • TSS_LOG_RESULT_NONE (default: no notification)

  • TSS_LOG_RESULT_PASS

  • TSS_LOG_RESULT_FAIL

  • TSS_LOG_RESULT_WARN

  • TSS_LOG_RESULT_STOPPED

  • TSS_LOG_RESULT_INFO

  • TSS_LOG_RESULT_COMPLETED

  • TSS_LOG_RESULT_UNEVALUATED

0 specifies the default.
description Contains the string to be displayed in the event of a log failure.
propertyCount Specifies the number of rows in the property array.
property An array containing property name/value pairs, where property[n].name is the property name and property[n].value is its value.


Return Value

This function exits with one of the following results:


Comments

A test case is a condition, specified in a list of property name/value pairs, that you are interested in. This function searches for the test case and logs the result of the search.

An event and any data associated with it are logged only if the specified result preference matches associated settings in the EVAR_LogData_control or EVAR_LogEvent_control environment variables. Alternatively, the logging preference may be set by the EVAR_Log_level and EVAR_Record_level environment variables. The TSS_LOG_RESULT_STOPPED, TSS_LOG_RESULT_COMPLETED, and TSS_LOG_RESULT_UNEVALUATED preferences are intended for internal use.

The NamedValue data type is defined as follows:

typedef struct {
	 	 	 char *Name;
	 	 	 char *Value;
} NamedValue;

Example

This example logs the result of a test case named Verify login.

NamedValue loginResult[1];
loginResult[0].Name = "Result";
loginResult[0].Value = "OK";
s32 retVal = TSSLogTestCaseResult("Verify login", 0, NULL, 
1,loginResult);

prevnext


Rational TestManager Extensibility Reference Rational Software Corporation
Copyright (c) 2003, Rational Software Corporation http://www.rational.com
support@rational.com
info@rational.com