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);

No comments:

Post a Comment