HP LoadRunner Protocol SDK Test Run API Reference
12.02
|
The base class for handling API execution. More...
#include <ApiFunctions.h>
Public Member Functions | |
CApiFunction (const char *mDisplayName="", int mIconId=-1) | |
Instantiates a CApiFunction with icon and display name. More... | |
virtual | ~CApiFunction () |
Destructor. | |
int | Run (const char *mStepName, va_list mVaList=0) |
Executes this API function for one step. More... | |
void | WastedTime (long mMilliSeconds) |
Adds to the wasted time of all open transactions Every call to this method increases the wasted time of all open transactions, including the automatic transaction per step, if any. More... | |
void | ThinkTime (long mSeconds) |
Adds to the think time of all open transactions. More... | |
void | SetResultMessage (int mMessageID,...) |
Sets the message for the test result report. More... | |
Protected Member Functions | |
virtual void | Init ()=0 |
Initializations for this API function. More... | |
virtual void | HandleArguments (va_list mVaList) |
Validates arguments and checks for completeness. More... | |
virtual void | Invoke ()=0 |
Performs the logic of the API function. | |
virtual void | Terminate ()=0 |
Normal termination of the API function. More... | |
virtual void | Abort ()=0 |
Halts the API function when an unrecoverable exception is raised. More... | |
Protected Attributes | |
char * | m_stepName |
The display name for the step in which this API function is called. | |
char * | m_displayName |
The API function display name used in log messages and in the result report. | |
int | m_iconId |
The API function icon id. The icon is used in the test result report. | |
char * | m_fullName |
The name used in log messages. | |
The base class for handling API execution.
Class CApiFunction is the base class for API functions. Create a class derived from CApiFunction to implement each API function with positional arguments. For example,
You can add data members for storing the step data to the derived class, and add the function-specific arguments to the constructor. The scope of this data is one step, that is, one invocation of this API function from a script.
CApiFunction::CApiFunction | ( | const char * | mDisplayName = "" , |
int | mIconId = -1 |
||
) |
Instantiates a CApiFunction with icon and display name.
On UNIX platforms, the icon is not supported; pass the default ID, -1.
mDisplayName | The API function display name used in log messages and in the result report |
mIconId | The API function icon ID from resource.h. The icon is used in the test result report |
|
protectedpure virtual |
Halts the API function when an unrecoverable exception is raised.
Implement Abort to perform any necessary clean-up such as freeing resources allocated during the API function call, sending log messages, and so on.
|
protectedvirtual |
Validates arguments and checks for completeness.
Do not implement this method for API functions declared with named arguments. Implementation is optional for API functions declared with positional arguments.
mVaList | The list of arguments to be validated |
Reimplemented in CApiFunctionWithNamedArguments.
|
protectedpure virtual |
Initializations for this API function.
Set up to invoke the function by allocating resources and so on.
int CApiFunction::Run | ( | const char * | mStepName, |
va_list | mVaList = 0 |
||
) |
Executes this API function for one step.
For an API function declared with positional arguments, the default value for mVaList is used. The actual arguments are passed in the constructor.
LR_PASS
or LR_FAIL
mStepName | step name |
mVaList | variable-length argument list |
void CApiFunction::SetResultMessage | ( | int | mMessageID, |
... | |||
) |
Sets the message for the test result report.
The message is displayed in the details column of the report. If this method is not called, a default message is displayed. The default message may be the last error or warning message. Pass the parameters of the message in the variable-length argument list.
mMessageID | message id in resource file |
|
protectedpure virtual |
Normal termination of the API function.
Release resources, write log messages, and so on.
void CApiFunction::ThinkTime | ( | long | mSeconds | ) |
Adds to the think time of all open transactions.
Every call to this method increases the think time of all open transactions, including the automatic transaction per step, if any.
SDK_INTERNAL_ERROR | Failed to report think time |
mSeconds | think time in seconds |
void CApiFunction::WastedTime | ( | long | mMilliSeconds | ) |
Adds to the wasted time of all open transactions Every call to this method increases the wasted time of all open transactions, including the automatic transaction per step, if any.
SDK_INTERNAL_ERROR | Failed to report wasted time |
mMilliSeconds | wasted time in milliseconds |