Scripts: Starting a new transaction during iterations
0 Comments Published by Hs on Monday, July 9, 2007 at 1:45 PM.Recently one of my load testing projects required us to monitor the time taken to upload a file into the application. This sounds simple and straight forward with the implementation of the lr_start_transaction and the lr_end_transaction. However, the catch is that the action block be iterated 10 times and within the 10 iterations, one of the iteration is to upload a different file of different size (thus causing different response time), which they want to measure.
What we did was implement a if-then-else to check the file and perform a lr_start_transaction when the script is uploading the different file and end the transaction with the lr_end_transaction when the submission completes. The snippet of the code is as followed:
if (!strcmp(lr_eval_string("{file}"), lr_eval_string("{set_file}")))
{ lr_start_transaction("tx_check_upload_different_file");
}else
{
lr_start_trasaction("tx_tx_check_same_upload_file");
}...
... \\other codes
......
if (!strcmp(lr_eval_string("{file}"),lr_eval_string("{set_file}")))
{if (!strcmp(lr_eval_string("{file}"),lr_eval_string("{set_file}")))
lr_end_transaction("tx_check_upload_different_file",LR_AUTO);
}else
{
lr_end_trasaction("tx_check_same_upload_file",LR_AUTO);}
The code detects the if the uploaded file is different and will start tracking the timing for the upload transaction. Hope it's useful to you.
Related Topics
Scripts: Duplicating Files on the FlyScripts: Step Download Timeout
Scripts: VIEWSTATEScripts: Auto or Manual Correlation?
Scripts: Remove Think TimeScripts: Set Debug Mode in Script
Scripts: Replay Failure – Use Full Extended Log!Labels: iterations, LoadRunner, lr_end_transaction, lr_start_transaction, script, transactions





0 Responses to “Scripts: Starting a new transaction during iterations”
Post a Comment