Introduction to the Robot Extensibility Framework |
An API recording is a capture of information exchanged between an executing application-under-test (AUT) and a target dynamic-link library (DLL) used by the AUT. The AUT is an application front-end (client); a target is a client-side library implementing functions used by the application front-end to communicate with its server, which might run on a remote host. An example of an AUT is Internet Explorer. An example of an interesting target is winInet.dll
, a well-documented dynamic-link library used by Internet Explorer. An example of an interesting function in winInet.dll
is InternetConnect
, which becomes active whenever an Internet Explorer user connects with a remote Web server.
During script generation, the total recorded data in a session file passes through one or more filtering programs, or protocols. This term describes a set of functions in a session recording that a script generator may find useful. Protocols are listed on the Generator Filtering tab of the Session Record Options dialog box.
By selecting a protocol, such as HTTP, the Robot user says in effect: if the session file includes any recorded calls to functions of this type, use the recorded data when generating test scripts.
The following table lists the API recording targets that are supported by Robot out-of-the-box. These DLLs need not (and cannot) be targeted by an extension adapter.
The API extensibility framework allows you to add to this list.
Suppose that no API adapters are installed and that a Robot user:
The diagram below illustrates what happens during the recording phase.
The targeted library in this example is winInet.dll
, which is used by the AUT (Internet Explorer) to communicate with Web servers. When Internet Explorer starts, rtxvspy.dll
attaches to its process space and waits for calls to functions defined in winInet.dll. Whenever a winInet.dll call occurs, the call is directed by rtxvspy.dll
to a corresponding call in a proxy library (proxyWinInit.dll
in the diagram).
The proxy library is the component responsible for API recording. For example, a call to the interesting function InternetConnect
might be redirected to a proxy call in proxyWinInit.dll
named proxyInternetConnect
. The role of a proxy function is to decide what data should be captured and to send this to the Rational utility that maintains the proprietary session file, rtxvutl.dll
. The functions needed to do this are documented in Chapter 4.
The diagram below illustrates what happens during the script generation phase.
The Rational recorder controller makes one or more passes through the session file, presenting each captured call in the session file to a filter corresponding to each user-selected protocol on the Generator Filtering tab. A filter inspects data sent to it and instructs the controller to forward relevant data to the VU script generator. (In actuality, this is a collection of script generators.)
You extend API recording and script generation by developing and installing three types of adapters: an API Recorder Adapter, a Generator Filter Adapter, and an API Script Generator Adapter.
An API Recorder Adapter identifies:
An API Recorder Adapter DLL includes a recording component (proxy) corresponding to the target. The AUT calls the proxy recorder instead of the target library, which is called by the proxy as needed. In this fashion, all traffic between the AUT and the target passes through the proxy. The functions used by the proxy to record functions are documented in Chapter 4.
A Generator Filter Adapter screens recorded calls for relevance to script generation.
An API Script Generator Adapter generates a script from the data earmarked for it by its associated Generator Filter Adapter.
Suppose that you develop and install three API adapters named newAPIRecorder.dll
, newFilter.dll
, and newAPIScriptGenerator.dll
. Now, when the Robot user initiates API recording, newAPIRecorder.dll
is interjected into the AUT's process space by rtxvspy.dll
such that client calls to newTarget.dll
are redirected to the proxy recording functions in newAPIRecorer.dll
.
The proxy functions in newAPIRecorder.dll
decide what needs to be recorded and use the functions documented in Chapter 4, "Recording and Script Generation Services," to send this information to rtxvutl.dll
, which adds it to the session file.
The script generation phase is modified as illustrated below. From the Generator Filtering tab, the Robot user selects the protocol name associated with newFilter.dll
, which directs scriptable packets to newAPIScriptGenerator.dll
.
The generated script can be in one of the three supported languages (VU, Java, Visual Basic). Rational® TestManager can play back test scripts you generate in these languages provided they are syntactically correct.
The Rational Test\rtsdk\c\rsrext\samples\API
folder contains skeletal adapters that you can use as a starting point.
Sample extensible API adapters are provided in the Robot installation directory under Rational Test\rtsdk\c\rsrext\samples\HelloWorldTests
. These C++ examples were developed with Visual Studio 6. For build and deployment instructions, see Rational Test\rtsdk\c\rsrext\samples\readme.htm
.
Session Recording Extensibility Reference | Rational Software Corporation |
Copyright (c) 2003, Rational Software Corporation | http://www.rational.com support@rational.com info@rational.com |