{"id":68,"date":"2023-09-09T12:45:55","date_gmt":"2023-09-09T12:45:55","guid":{"rendered":"https:\/\/softwaretestingstuff.com\/?p=68"},"modified":"2023-09-10T11:17:29","modified_gmt":"2023-09-10T11:17:29","slug":"c-vuser-functions-in-loadrunner","status":"publish","type":"post","link":"https:\/\/www.softwaretestingstuff.com\/2009\/03\/c-vuser-functions-in-loadrunner.html","title":{"rendered":"C Vuser Functions in LoadRunner"},"content":{"rendered":"\n
In LoadRunner, you can add C Vuser functions to any Vuser script in order to enhance the script. VuGen generates only a few of the general Vuser functions while you record. If required, the remaining functions can be manually programmed into a script.<\/p>\n\n\n\n
As per my knowledge, below is a list of general API functions for ANSI C scripts. It includes all protocols except for Java, VB, and GUI: 1. lr_end_sub_transaction –> Marks the end of a sub-transaction for performance analysis.<\/p>\n\n\n\n 2. lr_end_transaction –> Marks the end of a transaction.<\/p>\n\n\n\n 3. lr_end_transaction_instance –> Marks the end of a transaction instance for performance analysis.<\/p>\n\n\n\n 4. lr_fail_trans_with_error –> Sets the status of open transactions to LR_FAIL and sends an error message.<\/p>\n\n\n\n 5. lr_get_trans_instance_duration –> Gets the duration of a transaction instance specified by its handle.<\/p>\n\n\n\n 6. lr_get_trans_instance_wasted_time –> Gets the wasted time of a transaction instance by its handle.<\/p>\n\n\n\n 7. lr_get_transaction_duration –> Gets the duration of a transaction by its name.<\/p>\n\n\n\n 8. lr_get_transaction_think_time –> Gets the think time of a transaction by its name.<\/p>\n\n\n\n 9. lr_get_transaction_wasted_time –> Gets the wasted time of a transaction by its name.<\/p>\n\n\n\n 10. lr_resume_transaction –> Resumes collecting transaction data for performance analysis.<\/p>\n\n\n\n 11. lr_resume_transaction_instance –> Resumes collecting transaction instance data for performance analysis.<\/p>\n\n\n\n 12. lr_set_transaction_instance_status –> Sets the status of a transaction instance.<\/p>\n\n\n\n 13. lr_set_transaction_status –> Sets the status of open transactions.<\/p>\n\n\n\n 14. lr_set_transaction_status_by_name –> Sets the status of a transaction.<\/p>\n\n\n\n 15. lr_start_sub_transaction –> Marks the beginning of a subtransaction.<\/p>\n\n\n\n 16. lr_start_transaction –> Marks the beginning of a transaction.<\/p>\n\n\n\n 17. lr_start_transaction_instance –> Starts a nested transaction specified by its parent\u2019s handle.<\/p>\n\n\n\n 18. lr_stop_transaction –> Stops the collection of transaction data.<\/p>\n\n\n\n 19. lr_stop_transaction_instance –> Stops collecting data for a transaction specified by its handle.<\/p>\n\n\n\n 20. lr_wasted_time –> Removes wasted time from all open transactions.<\/p>\n\n\n\n 1. lr_get_attrib_double –> Retrieves a double type variable used on the script command line.<\/p>\n\n\n\n 2. lr_get_attrib_long –> Retrieves a long type variable used on the script command line.<\/p>\n\n\n\n 3. lr_get_attrib_string –> Retrieves a string used on the script command line.<\/p>\n\n\n\n 1. lr_user_data_point –> Records a user-defined data sample.<\/p>\n\n\n\n 2. lr_whoami –> Returns information about a Vuser to the Vuser script. Not applicable for Application Management.<\/p>\n\n\n\n 3. lr_get_host_name –> Returns the name of the host executing the Vuser script.<\/p>\n\n\n\n 4. lr_get_master_host_name –> Returns the name of the machine running the LoadRunner Controller or Tuning Console. Not applicable for Application Management.<\/p>\n\n\n\n 1. lr_eval_string –> Replaces a parameter with its current value.<\/p>\n\n\n\n 2. lr_save_string –> Saves a null-terminated string to a parameter.<\/p>\n\n\n\n 3. lr_save_var –> Saves a variable length string to a parameter.<\/p>\n\n\n\n 4. lr_save_datetime –> Saves the current date and time to a parameter.<\/p>\n\n\n\n 5. lr _advance_param –> Advances to the next available parameter.<\/p>\n\n\n\n 6. lr _decrypt –> Decrypts an encoded string.<\/p>\n\n\n\n 7. lr_eval_string_ext –> Retrieves a pointer to a buffer containing parameter data.<\/p>\n\n\n\n 8. lr_eval_string_ext_free –> Frees the pointer allocated by lr_eval_string_ext.<\/p>\n\n\n\n 9. lr_save_searched_string –> Searches for an occurrence of string in a buffer and saves a portion of the buffer, relative to the string occurrence, to a parameter.<\/p>\n\n\n\n 1. lr_debug_message –> Sends a debug message to the Output window or the Business Process Monitor log files.<\/p>\n\n\n\n 2. lr_error_message –> Sends an error message to the Output window or the Business Process Monitor log files.<\/p>\n\n\n\n 3. lr_get_debug_message –> Retrieves the current message class.<\/p>\n\n\n\n 4. lr_log_message –> Sends a message to a log file.<\/p>\n\n\n\n 5. lr_output_message –> Sends a message to the Output window or the Business Process Monitor log files.<\/p>\n\n\n\n 6. lr_set_debug_message –> Sets a debug message class.<\/p>\n\n\n\n 7. lr_vuser_status_message –> Generates and prints formatted output to the Controller or Console Vuser status area. Not applicable for Application Management.<\/p>\n\n\n\n 8. lr_message –> Sends a message to the Vuser log and Output window or the Business Process Monitor log files.<\/p>\n\n\n\n 1. lr_load_dll –> Loads an external DLL.<\/p>\n\n\n\n 2. lr_peek_events –> Indicates where a Vuser script can be paused.<\/p>\n\n\n\n 3. lr_think_time –> Pauses script execution to emulate think time\u2014the time a real user pauses to think between actions.<\/p>\n\n\n\n 4. lr_continue_on_error –> Specifies an error handling method.<\/p>\n\n\n\n 5. lr_rendezvous –> Sets a rendezvous point in a Vuser script. Not applicable for Application Management.<\/p>\n\n\n\n
<\/p>\n\n\n\n<\/figure>\n\n\n\n
Transaction Functions:<\/strong><\/h2>\n\n\n\n
Command Line Parsing Functions:<\/strong><\/h2>\n\n\n\n
Informational Functions:<\/strong><\/h2>\n\n\n\n
String Functions:<\/strong><\/h2>\n\n\n\n
Message Functions:<\/strong><\/h2>\n\n\n\n
Run-Time Functions<\/strong><\/h2>\n\n\n\n