RTCOM Support Class

prevnext

About RTCOM


The Rational Test Component Object Model (RTCOM) class provides functions specific to the COM protocol. Visual Basic scripts that are generated from COM sessions use RTCOM class methods for error handling, datapool configuration, object monitoring, and logging operations.


Summary

In generated scripts, RTCOM methods are invoked through rtcom, a variable holding an object reference instantiated as follows:

Private RTCOM As New TestScriptServicesLib.RTCOMSupport 

This is not shown in the examples.

The following table lists and describes the RTCOM member functions.

Function Description
ErrorArray

Specifies the list of expected errors for the application under test.

GetDatapoolAccessFlags Gets datapool access flags from the resource file.
GetDatapoolOverrideList Gets datapool override column name/values from the resource file.
Monitor Controls COM object monitoring.
SetCMDID Sets the command ID for a COM method call.


ErrorArray

Specifies the list of expected error for the application under test.


Syntax

ErrorArray (errList as Long)

Element Description
errList An array of Longs specifying HRESULT values that should not be regarded as errors.


Error Codes

This method generates one of the following status codes:


Comments

When a method completes, the COM interception mechanism within TSS needs to decide whether the method succeeded or failed. Without guidance, the mechanism considers any HRESULT that has the error bit on to be a failure. It is possible that, for the application under test, certain HRESULTs that have the error bit set do not indicate failure. Use ErrorArray to pass any such HRESULTs to the interception mechanism so that it does not consider them failures for the application under test.


Example

This example passes three HRESULT values to the interception mechanism, so that it does not consider them to indicate failure.

Dim expectedErrs(2) As Long
expectedErrs(0) = 0
expectedErrs(1) = &H80040001
expectedErrs(2) = &H80040123
rtcom.ErrorArray expectedErrs

GetDatapoolAccessFlags

Gets datapool access flags from the resource file.


Syntax

GetDatapoolAccessFlags() As Long

Return Value

A 32-bit integer containing the access flags. If the resource file specifies multiple access flags, their bitmasks are merged in the integer.


Error Codes

This method generates one of the following status codes:


Comments

This call parses the resources associated with the script, extracts the datapool access flags, and returns them in a form suitable for passing to TSSDatapool.Open.


Example

This first example returns the datapool access flags in the resource file to flags. The second example invokes TSSDatapool.Open, whose arguments are passed by the LoadResString (a built-in function) from the resource file.

Dim Flags as Long
flags = rtcom.GetDatapoolAccessFlags
tssPool.Open LoadResString(TSSRES_datapoolname), _
	 	 	 	 	 rtCOM.GetDatapoolAccessFlags, _
	 	 	 	 	 rtCOM.GetDatapoolOverrideList

GetDatapoolOverrideList

Gets datapool override column name/values from the resource file.


Syntax

GetDatapoolOverrideList() as Variant


Return Values

A two-dimensional array of name/value pairs containing the datapool override list.


Error Codes

This method generates one of the following status codes:


Comments

This call parses the resources associated with the script, extracts any datapool override name/value pairs, and returns them in a form suitable for passing to TSSDatapool.Open.


Example

This example invokes TSSDatapool.Open, whose arguments are passed by the LoadResString (a built-in function) from the resource file.

tssPool.Open LoadResString(TSSRES_datapoolname), _
	 	 	 	 	 rtCOM.GetDatapoolAccessFlags, _
	 	 	 	 	 rtCOM.GetDatapoolOverrideList

Monitor

Controls object monitoring and reporting.


Syntax

Monitor (toggle As String, [class As Variant], [method As 
Variant], [instance As Variant])

Element Description
toggle ON (monitor) or OFF (exclude from monitoring).
class The name of a class include/exclude.
method The name of a method in class to include/exclude.
instance The instance of class to include/exclude.


Error Codes

This method generates one of the following status codes:


Comments

By default, the COMinterception mechanism monitors all non-TSS objects in order to keep track of them. This call allows you to exclude objects that should not be monitored. You can specify an object to exclude/include by specifying its class, method, instance, or a combination.


Example

This example excludes from monitoring all methods and instances of the class ADODB.

rtcom.Monitor "OFF", "ADODB"

SetCMDID

Sets the command ID for a COM method call.


Syntax

SetCMDID (cid As String)

Element Description
cid The command ID.


Error Codes

This method generates one of the following status codes:


Comments

Command IDs appear in logs in order to improve their readability.


Example

This example sets the command ID for a method call to test001.

rtcom.SetCMDID "test001"

prevnext


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