Friday 21 June 2013

Creating LoadRunner Dynamic Transaction Names


Today I wanted to use parameterized transaction names within a LoadRunner script. As I thought that a particular transaction was failing after a particular number of iterations. Luckily this was pretty simple in LoadRunner. It was just a case of using lr_eval_string in the call to the transaction wrapper.

lr_start_transaction(lr_eval_string("Do Something {pIteration}"));

lr_end_transaction(lr_eval_string("Do Something {pIteration}"), LR_AUTO);

You have to be careful above to make sure that start and end transaction names are the same. To overcome that problem I created a string variable to hold the LoadRunner transaction name.

char sTranName[20];

sprintf(sTranName,lr_eval_string("TransactionA_{pIteration}"));
lr_start_transaction(sTranName);

lr_end_transaction(sTranName,LR_AUTO);

1 comment:

Unknown said...

Hi,
Could you please help me to parameterize URL
. I want read URL parameter from text file and put it in web_url function. please help me on this
web_url("login.aspx", "URL=http://Google.com",
"Resource=0", "RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
EXTRARES, "URL=../Images/bg/Templates.jpg", ENDITEM,
LAST)