API Adapter Reference |
An API Recorder Adapter is the interface between the Robot recording extensibility framework and a recording component (proxy library) that captures traffic between a designated target DLL and an application-under-test (AUT). The API Recorder Adapter and proxy library components must be in the same DLL. The recording functions used by the proxy library are documented in Chapter 4.
API Recorder Adapters implement the following calls:
Identifies an API Recorder Adapter.
BOOL IsAPIRecorderAdapter
();
Return TRUE to indicate that this is an API Recorder Adapter. Any other response disables the adapter.
extern "C" BOOL LINKDLL IsAPIRecorderAdapter() { return TRUE; }
IsAPIGenFiltExtAdapter()
, IsAPISgenAdapter()
Returns information about associated adapters and protocol.
intGetAPIRecAdapterInfo
(TCHAR *info
, size_tinfoSize
);
info |
Pointer to a container for adapter information. Copy to this location a string containing the following comma-separated items:
|
infoSize |
INPUT. The size allocated for info , which must not exceed this size. |
Return RSR_SUCCESS
to indicate that the call is complete.
An adapter responds to this call as illustrated below. In the terms of this example, the following happens: if a Robot user selects API Recording from the Method tab and MyProtocol from the Generator Filtering tab and activates recording, traffic between the AUT and HelloWorld.dll
specified by GetApiAndWrapperNamePairs()
is routed to MyAPIRecorder.dll
.
extern "C" int LINKDLL GetApiRecAdapterInfo (TCHAR *info, size_t infoSize) { static TCHAR buffer[] = "MyAPIRecorder.dll," "HellowWorld.dll," "MyGFA.dll," "MySGA.dll," "MyProtocol," "This is an example," "Version 0.1"; if (_tcslen(buffer) >= infoSize) return RSE_BUFFER_TOO_SHORT; else { _tcscpy(info, buffer); return RSR_SUCCESS; } }
IsAPIRecorderAdapter()
, GetApiAndWrapperNamePairs()
Returns names of calls to be intercepted and their wrapper names.
LPSTR GetApiAndWrapperNamePairs
(int *iNumPairs);
iNumPairs
The number of comma-separated pairs that are returned.
Your response to this call gives the name of each function call to be intercepted in the dialog between the target DLL and application-under-test, and the function's corresponding wrapper name. Calls to targeted functions are redirected to corresponding functions in the recording component (proxy library) of the API Recorder Adapter DLL.
This example returns two API/wrapper pairs:
extern "C" LPSTR GetApiAndWrapperNamePairs (int *iNumPairs) { static TCHAR szPairs[] = "HelloWorld1, pHelloWorld1, HelloWorld2, pHelloWorld2"; *iNumPairs = 2; return szPairs; }
IsAPIRecorderAdapter()
, GetAPIRecAdapterInfo()
Session Recording Extensibility Reference | Rational Software Corporation |
Copyright (c) 2003, Rational Software Corporation | http://www.rational.com support@rational.com info@rational.com |