VuGen functions
This section contains useful VuGen functions that you may want to add to your script while debugging or preparing your script for load testing.
VuGen code
When you record a Vuser script, VuGen generates different types of Vuser functions and inserts them into the script:
Together, the general Vuser functions and the protocol-specific functions form the VuGen API. This API enables Vusers to communicate directly with a server. VuGen displays a list of all of the supported protocols when you create a new Vuser script.
For syntax and other information about all of the Vuser functions, see the Function Reference.
Obtain Vuser information
You can add the following functions to your Vuser scripts to retrieve Vuser information:
Function
|
Description
|
---|---|
lr_get_attrib_string
|
Returns a command line parameter string.
|
lr_get_host_name
|
Returns the name of the machine running the Vuser script.
|
lr_get_master_host_name
|
Returns the name of the machine running Controller. Not applicable when working with OpenText AI Operations Management.
|
lr_whoami
|
Returns the name of a Vuser executing the script. Not applicable when working with OpenText AI Operations Management.
|
In the following example, the lr_get_host_name function retrieves the name of the computer on which the Vuser is running.
my_host = lr_get_host_name( );
Send messages to output
Using the Message type functions in your Vuser script, you can send customized error and notification messages to the output and log files, and to the Test Report summary. For example, you could insert a message that displays the current state of the client application. You can also save these messages to a file.
When working with OpenText AI Operations Management, you can use Message type functions to send error and notification messages to the website or OpenText Business Process Monitoring log files. For example, you could insert a message that displays the current state of the web-based application.
Note: Do not send messages from within a transaction as this may lengthen the transaction execution time and skew the transaction results.
You can use the following message functions in your Vuser scripts:
Function
|
Description
|
---|---|
lr_debug_message
|
Sends a debug message to the Output window or the log files.
|
lr_error_message
|
Sends an error message to the Output window or the log files.
|
lr_get_debug_message
|
Retrieves the current message class.
|
lr_log_message
|
Sends an output message directly to the log file, output.txt, located in the Vuser script folder. This function is useful in preventing output messages from interfering with TCP/IP traffic.
|
lr_output_message
|
Sends a message to the Output window or the log files.
|
lr_set_debug_message
|
Sets a message class for output messages.
|
lr_vuser_status_message
|
Sends a message to the Vuser status area in Controller. Not applicable when working with OpenText AI Operations Management.
|
lr_message
|
Sends a message to the Vuser log and Output window or the log files.
|
The behavior of the lr_message, lr_output_message, and lr_log_message functions are not affected by the script's debugging level in the Log runtime settings—they will always send messages.
See also: