Wednesday, August 1, 2012

Creating LoadRunner Dynamic Transaction Names


Today I wanted to use parameterized transaction names within a LoadRunner script. 

1) As I thought that a particular transaction was failing after a particular number of iterations. 

2) For Capturing the response time of  request having different keyword searches for each keyword 

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 {IterationNo}"));
lr_end_transaction(lr_eval_string("Do Something {IterationNo}"), LR_AUTO);

Example

lr_start_transaction(lr_eval_string("Response Time for search of {Keyword_Param}"));

web_url("autoSuggestion", 
"URL=http://lalitgarg.com/json/search/autoSuggestion?q={Keyword_Param}&catId=0&v=", 
"TargetFrame=", 
"Resource=1", 
"RecContentType=application/json", 
"Referer=", 
"Snapshot=t1.inf", 
LAST);

 lr_end_transaction(lr_eval_string(" Response Time for search of {Keyword_Param}"), 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);

3 comments:

  1. Thanks for your post; selenium is most trusted automation tool to validate web application and browser. This tool provides precise and complete information about a software application or environment. Selenium Training in Chennai | Selenium Course in Chennai | Best Selenium training institute in Chennai

    ReplyDelete

plz give ur comments !!!!!!