Test Script 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.
Use the functions listed in the following table to write to the TestManager log.
TSSLogEvent()
Logs an event.
TSSLogMessage()
Logs a message event.
TSSLogTestCaseResult()
Logs a test case event.
s32TSSLogEvent
(char *eventType
, s16result
, char *description
, s32propertyCount
, NamedValue *property
)
This function exits with one of the following results:
TSS_OK.
Success.
TSS_NOSERVER
. No previous successful call to TSSConnect()
.
TSS_INVALID
. An unknown result
was specified.
TSS_ABORT
. Pending abort resulting from a user request to stop a suite run.
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_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.
NamedValue
is defined as follows:
typedef struct { char *Name; char *Value; } NamedValue;
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);
s32TSSLogMessage
(char *message
, s16result
, char *description
)
This function exits with one of the following results:
TSS_OK.
Success.
TSS_NOSERVER
. No previous successful call to TSSConnect()
.
TSS_ABORT
. Pending abort resulting from a user request to stop a suite run.
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.
This example logs the following message: --Beginning of timed block T1--
.
TSSLogMessage
("--Beginning of timed block T1--", 0, NULL);
s32TSSLogTestCaseResult
(char *testcase
, s16result
, char *description
, s32propertyCount
, NamedValue *property
[])
This function exits with one of the following results:
TSS_OK.
Success.
TSS_NOSERVER
. No previous successful call to TSSConnect()
.
TSS_ABORT
. Pending abort resulting from a user request to stop a suite run.
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;
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);
Rational TestManager Extensibility Reference | Rational Software Corporation |
Copyright (c) 2003, Rational Software Corporation | http://www.rational.com support@rational.com info@rational.com |