lr functions
TRANSCRIPT
![Page 1: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/1.jpg)
www.stctek.com
Informational Functions lr_get_host_name ( ) lr_get_master_host_name ( ) lr_get_vuser_ip( ) lr_start_timer () lr_end_timer
![Page 2: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/2.jpg)
www.stctek.com
lr_get_host_name ( )
Returns the name of the host executing the Vuser script.
Examplechar * my_host; my_host = lr_get_host_name( ); lr_output_message("%s", my_host);
/*sends the message to the output window*/
![Page 3: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/3.jpg)
www.stctek.com
lr_get_master_host_name ( )
Returns the name of the machine running the Controller .
Examplechar * controller_host;
controller_host=lr_get_master_host_name();
![Page 4: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/4.jpg)
www.stctek.com
lr_get_vuser_ip( )
Returns the IP address of the current Vuser.
Example char *ip; ip = lr_get_vuser_ip(); lr_output_message("The IP address is %s", ip);
![Page 5: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/5.jpg)
www.stctek.com
lr_start_timer () & lr_end_timer () starts and stops a timer that calculates
the passage of time in seconds. Example
Double timer , time_elapsedtimer = lr_start_timer(); /* script */time_elapsed =
lr_end_timer(timer);
![Page 6: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/6.jpg)
www.stctek.com
Message Functions
lr_message() lr_error_message() lr_vuser_status_message()
![Page 7: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/7.jpg)
www.stctek.com
lr_message()
Sends a message to the Output window.
Examplelr_message (“Login
completed”);
![Page 8: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/8.jpg)
www.stctek.com
lr_error_message()
Sends an error message to the Output window.
Example lr_error_message(“Login
Failed”);
![Page 9: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/9.jpg)
www.stctek.com
lr_vuser_status_message()
Sends a message to the Vuser status area in the Controller.
Examplelr_vuser_status_message (“Started”);
![Page 10: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/10.jpg)
www.stctek.com
Run-Time Functions
lr_abort( ) lr_rendezvous() lr_think_time ()
![Page 11: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/11.jpg)
www.stctek.com
lr_abort( )
Aborts Vuser script execution. Example
if (transaction = = LR_FAIL) {
lr_abort();}
![Page 12: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/12.jpg)
www.stctek.com
lr_rendezvous()
Creates a rendezvous point in the Vuser script.
Examplelr_rendezvous (rendezvous name);
![Page 13: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/13.jpg)
www.stctek.com
lr_think_time ()
Pauses execution between commands in a Vuser script.
Examplelr_think_time (double
time);
![Page 14: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/14.jpg)
www.stctek.com
String Functions
lr_decrypt () lr_save_string() lr_save_datetime()
![Page 15: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/15.jpg)
www.stctek.com
lr_decrypt ()
Decrypts an encoded string Example
lr_decrypt("38620da61ca1093e7aa7ec");
![Page 16: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/16.jpg)
www.stctek.com
lr_save_string() Saves a string to a parameter. Example
lr_save_string("777", “Id"); Result
Saves 777 to the parameter Id.
![Page 17: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/17.jpg)
www.stctek.com
lr_save_datetime()
Assigns the current date and time to a parameter.
Example lr_save_datetime(" %B %d %Y", DATE_NOW,
“tdate")
OutputSaves the date in month/date/year format in the parameter tdate
![Page 18: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/18.jpg)
www.stctek.com
Transaction Functions
lr_start_transaction() lr_end_transaction() lr_get_transaction_status() lr_get_transaction_duration()
![Page 19: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/19.jpg)
www.stctek.com
lr_start_transaction()
Marks the beginning of a transaction Example
lr_start_transaction("deposit");
![Page 20: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/20.jpg)
www.stctek.com
lr_end_transaction()
Marks the end of a transaction and records the amount of time it took to perform the transaction.
Examplelr_end_transaction("deposit",
LR_FAIL);
Status
![Page 21: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/21.jpg)
www.stctek.com
lr_get_transaction_status()
Returns the current status of a transaction.
Exampleif (lr_get_transaction_status() ==
LR_FAIL) { lr_output_message(“Transaction
Failed”); }
![Page 22: LR Functions](https://reader033.vdocuments.us/reader033/viewer/2022061121/546e8c18b4af9f631d8b471b/html5/thumbnails/22.jpg)
www.stctek.com
lr_get_transaction_duration()
Returns the duration of a transaction. Exampledouble trans_time;lr_start_transaction ("Flight"); trans_time=lr_get_transaction_duratio
n("Flight"); lr_end_transaction("Flight", LR_PASS);