Loadrunner Functions


Loadrunner Functions
Below are some frequently used functions


lr_output_message()
Through this function, you can get the value of the "parameter" which is substituted in the script during the run
lr_output_message("Value: %s", lr_eval_string("{Value}"));


lr_error_message()
This will give only error messages during run.

lr_eval_string()
Converting a string to a parameter
Declare your string at the beginning of your script:
 char String [500] = "Value to be saved";

Use the lr_save_string function to save this value to a parameter:
  lr_save_string(String, "NameOfParam");

Using this function you could also simply type in the string using 
  lr_save_string("Value to be saved", "NameOfParam");

Converting a parameter to a string
Again declare a string at the top of the script make sure that the array has enough values to hold all the characters in the parameter + 1 (the extra one is required because ‘C’ strings require an extra space for a null character to terminate the string).

  char String[500];

You then need to use the sprintf function to save your parameter to a string:
 sprintf(String, "%s", lr_eval_string("{NameOfParam}"));

Above functions are some important Loadrunner functions which you might use. Below is the list of all Loadrunner functions. Functions highlighted in yellow are the ones I would suggest you to remember.


Advances to the next available parameter.
Sends a debug message to the LoadRunner output window or Business Process Monitor agent log file.
Decrypts an encoded string.
Returns an Variant whose value is Empty.
Marks the end of a sub-transaction.
Marks the end of a transaction.
Sends an error message to the log file and LoadRunner output window with location details.
Returns the double value of the parameter.
Returns the integer value of a parameter.
Returns the long value of the parameter.
Returns the string argument after evaluating embedded parameters.
Exits from the script, action, or iteration.
Returns the value of a command line parameter as a double
Returns the value of a command line parameter as a long integer.
Returns the value of a command line parameter as a string.
Returns the current message logging settings
Returns the name of the LoadRunner Vuser's group.
Returns the name of the host executing the script.
Returns the name of the machine running the LoadRunner Controller or Console.
Returns the duration of a transaction.
Returns the think time of a transaction.
Returns the IP address of a LoadRunner Vuser.
Sends a message to the log file of the Business Process Monitor agent or LoadRunner Vuser.
Sends a message to the Business Process Monitor agent log file or the LoadRunner Vuser log.
Sends a message to the log file and output window.
Returns an Variant whose value is Missing.
Advances to the next row in the parameter data file.
Sends a message to the log file and output window with location details.
Indicates a point to search for events.
Resumes reporting transaction data within a script.
Saves a double value as a parameter.
Saves an integer as a parameter.
Saves a long value as a parameter.
Saves a null-terminated string as a parameter.
Sets the message level.
Creates a completed transaction.
Starts a sub-transaction specified by its parent's name.
Marks the beginning of a transaction.
Freezes reporting of transaction data.
Pauses execution between commands in a script.
Returns the name of the Vuser group.
Returns the Vuser ID.
Sends a message to the Vuser Status area in the LoadRunner Controller or Console window.
Records a user-defined data sample.

Informational Functions

Stops a timer.
Returns the name of the host executing the script.
Returns the name of the machine running the LoadRunner Controller or Tuning Module Console .
Returns the IP address of the current Vuser. Not applicable for products that do not run Vusers.
Starts a timer.
Records a user-defined data sample.
Records a user-defined data sample and enables logging option.
Records a user-defined data sample and correlates it to a transaction instance.
Records a user-defined data sample and enables logging option.
Returns information about a Vuser executing the script. Not applicable for products that do not run Vusers.

o   Message Functions

Sends a debug message to the LoadRunner output window or Application Management agent log file.
Sends an error message to the LoadRunner output window or Application Management agent log file.
Returns the current message logging settings.
Sends a message to the Vuser log file.
Sends a message to the log file and output window.
Sends a Vuser message to the log file and output window with location information.
Sets a message class for output messages.
Sends a message to the Vuser status area in the LoadRunner Controller or Tuning Module Console.

Informational Functions

Returns the name of the host executing the script.
Returns the name of the LoadRunner Vuser's group.
Returns the name of the machine running the LoadRunner Controller or Console.
Returns the IP address of a LoadRunner Vuser.
Returns the name of the Vuser group.
Returns the Vuser ID.
Records a user-defined data sample.

Run-Time Functions

Aborts script execution.
Specifies an error handling method.
Disables IP Spoofing.
Enables IP Spoofing.
Exits from the script, action, or iteration.
Loads an external DLL.
Increments the value of a numerical parameter
Indicates a point to search for LoadRunner events..
lr_rendezvous
Sets a rendezvous point in a Vuser script.
Pauses execution between commands in a script.

Transaction Functions

Marks the end of a sub-transaction.
Marks the end of a transaction.
Marks the end of a transaction instance.
Sets the status of open transactions to LR_FAIL and sends an error message.
Returns the duration of a transaction instance specified by its handle.
Returns the current status of a transaction instance.
Gets the think time of a transaction instance specified by its handle.
Gets the wasted time of a transaction instance by its handle.
Gets the duration of a transaction by its name.
Gets the current status of a transaction.
Gets the think time of a transaction by its name.
Gets the wasted time of a transaction by its name.
Resumes collecting transaction data.
Resumes collecting transaction instance data.
Create a transaction manually.
Sets the status of a transaction instance.
Sets the status of open transactions.
Sets the status of a transaction.
Marks the beginning of a sub-transaction.
Marks the beginning of a transaction.
Starts a nested transaction specified by its parent's handle.
Stops the collection of transaction data.
Stops collecting data for a transaction specified by its handle.
Removes wasted time from all open transactions.

 

Comments

Popular posts from this blog

Analyzer in LoadRunner Part1

Neo Load Performance testing Tool