Important LoadRunner Utility Functions

Following is the list of important LoadRunner Utility Functions which are frequently used in the script.

1. lr_abort: This function stops the execution. If any specific error comes and Vuser needs to be stopped then lr_abort is used.

2. lr_advance_param: It returns the next value available in the parameter list. Once this function is called, the next available value in the parameter list is passed in the next occurrence of the parameter. It is not suitable for Table type parameter (having multiple values in a row).

3. lr_continue_on_error: This function is used when runtime setting option “Continue on Error” needs to be overridden for a specific transaction/code. The input arguments are 0, 1, 2, 3 and 4.

4. lr_convert_string_encoding: To convert the string into a specific format like utf-8 and ucs-2.

5. lr_convert_double_to_integer: To convert the string value of double datatype into integer datatype.

6. lr_db_connect: To connect with the database.

7. lr_db_disconnect: To disconnect from the database.

8. lr_db_getValue: To retrieve a value from a dataset.

9. lr_db_executeSQLStatement: To execute the SQL statement.

10. lr_debug_message: Instruct LR to write the debug message to the log file.

11. lr_enable_ip_spoofing: To enable IP spoofing.

12. lr_start_transaction: To start a new transaction.

13. lr_end_transaction: To end a started (open) transaction.

14. lr_start_sub_transaction: To start a new sub-transaction under a main transaction

15. lr_end_sub_transaction: Call this function to end a started (open) sub-transaction before ending the main transaction.

16. lr_stop_transaction: To stop a transaction.

17. lr_resume_transaction: To re-start the transaction. It is used after lr_stop_transaction function only.

18. lr_start_timer: To start a timer.

19. lr_end_timer: To end a started timer.

20. lr_error_message: To write an error message in the output window or log file.

21. lr_eval_string: To evaluate a parameter in the given string and return output in the string format.

22. lr_exit: To exit the Vuser from a script, iteration and action.

23. lr_get_host_name: To return the name of the machine on which script is executing.

24. lr_get_transaction_duration: This function provides the duration of the transaction. Using transaction duration another operation can be performed.

25. lr_get_transaction_status: It is as similar as lr_get_transaction_duration function. The only difference is it returns the transaction status.

26. lr_get_transaction_wasted_time: To get the elapsed time for running the logic inside a transaction.

27. lr_get_vuser_ip: To get Vuser IP address. It is helpful when IP spoofing is enabled.

28. lr_log_message: Instruct LR to write logs in a file.

29. lr_message: To send the message to the output window as well as the log file.

30. lr_next_row: It advances the value of all the parameters listed in a row.

31. lr_output_message: To print the message in the log file and output window. It is specially used for debugging purpose to verify the parameter value.

32. lr_paramarr_random: It is used to pick a random value from the list (array) of correlation parameter values.

33. lr_param_unique: To generate a unique string and saved in a parameter which can be accessed through its name.

34. lr_rendezvous: To insert a rendezvous point into the script where a desired number of Vusers halted and released in a group.

35. lr_save_datetime: To get the current date and time in a required format. The value is saved into a parameter. An offset can also be used to generate past or future date and time.

36. lr_save_timestamp: To get current timestamp in epoch format.

37. lr_save_string: To save a string into a parameter.

38. lr_think_time: To insert a wait time or delay. The LR pauses for the given time and then resume the execution.

39. lr_whoami: This function gives the information of the Vuser.

Note: These LoadRunner Utility Functions are not specific to protocolĀ i.e. these functions are common for all the available protocols in LoadRunner.

Leave a Comment