Test Script Services Reference |
Use the logging methods 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
(Arguments of TSSMeasure.EnvironmentOp) 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
(Arguments of TSSMeasure.EnvironmentOp) to control whether or not any data associated with an event is logged.
Commonly used with TestManager and QualityArchitect.
Use the methods listed in the following table to write to the TestManager log. They are methods of class TSSLog.
Event
Logs an event.
Message
Logs a message event.
TestCaseResult
Logs a test case event.
Event
(eventType
As String, [result
As Integer], [description
As String], [property
[] As NamedValue])
This method may generate one of the followingerror codes:
ERROR_CONVERT_BSTR
. An encountered string cannot be converted.
ERROR_INVALID_PARM
. A required argument is missing or invalid.
ERROR_OUT_OF_MEMORY
. An attempt to allocate dynamic memory failed.
TSS_NOSERVER
. No previous successful call to TSSSession.Connect
.
TSS_INVALID
. An unknown result
was specified.
TSS_ABORT
. Pending abort resulting from a user request to stop a suite run.
If you handle one of these errors and do not log it, TestManager is not aware of the error and does not log a Fail result for it. The script continues to run, and TestManager could log a Pass result for the script.
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. (See Arguments of TSSMeasure.EnvironmentOp.) 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 a dimensioned array of name/value pairs. For example, an array of 10 name/value pairs could be implemented as follows:
Dim NV(9,1) As String NV(0,0)= "name1" NV(0,1)= "value1" NV(1,0)= "name2" NV(1,1)= "value2" ...
This example logs the beginning of an event of type Login Dialog
.
Dim scriptProp (1,1) As String
scriptProp(0,0)= "ScriptName"
scriptProp(0,1)= "Login"
scriptProp(1,0)= "LineNumber"
scriptProp(1,1)= "1"
Dim log As New TSSLog
log.Event
"Login Dialog",0,"Login script failed",scriptProp
Message
(message
As String, [result
As Integer], [description
As String])
This method may generate one of the followingerror codes:
ERROR_CONVERT_BSTR
. An encountered string cannot be converted.
ERROR_INVALID_PARM
. A required argument is missing or invalid.
TSS_NOSERVER
. No previous successful call to TSSSession.Connect
.
TSS_ABORT
. Pending abort resulting from a user request to stop a suite run.
If you handle one of these errors and do not log it, TestManager is not aware of the error and does not log a Fail result for it. The script continues to run, and TestManager could log a Pass result for the script.
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. (See Arguments of TSSMeasure.EnvironmentOp.)
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--
.
Dim log As New TSSLog log.Message "--Beginning of timed block T1--"
TestCaseResult
(testcase
As String, [result
As Integer], [description
As String], [property
[] As NamedValue])
This method may generate one of the followingerror codes:
ERROR_CONVERT_BSTR
. An encountered string cannot be converted.
ERROR_INVALID_PARM
. A required argument is missing or invalid.
ERROR_OUT_OF_MEMORY
. An attempt to allocate dynamic memory failed.
TSS_NOSERVER
. No previous successful call to TSSSession.Connect
.
TSS_ABORT
. Pending abort resulting from a user request to stop a suite run.
If you handle one of these errors and do not log it, TestManager is not aware of the error and does not log a Fail result for it. The script continues to run, and TestManager could log a Pass result for the script.
A test case is a condition, specified in a list of property name/value pairs, that you are interested in. This method 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. (See Arguments of TSSMeasure.EnvironmentOp.) 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.
NamedValue
is a dimensioned array of name/value pairs. For example, an array of 10 name/value pairs could be implemented as follows:
Dim NV(9,1) As String NV(0,0)= "name1" NV(0,1)= "value1" NV(1,0)= "name2" NV(1,1)= "value2" ...
This example logs the result of a test case named Verify login
.
Dim loginResult(0,1) As String
loginResult(0,0)= "Result"
loginResult(0,1)= "OK"
Dim log As New TSSLog
log.TestCaseResult
"Verify login",0,NULL,loginResult
Rational Test Script Services for Visual Basic | Rational Software Corporation |
Copyright (c) 2003, Rational Software Corporation | http://www.rational.com support@rational.com info@rational.com |