Monday, February 3, 2014

Remove waste time in a transaction



In load testing, we all start and end transactions to measure the time of particular activity. 

For example: We may invoke HDFC netbanking site. Enter User name and Password. Now, we wish to measure how much time does it take to login and then click on View Mini Statement link. What we would do is, insert Start Transaction just before hitting the Login button. Click on the Mini Statement link and insert End Transaction.

However, in real life, we may have to insert few validations on the page viewed after Login i.e. before clicking Mini Statement link. We may wish to check that the correct person name is being shown, Welcome message is displayed, Mini Statement link is available, etc.. All these validations will eat up some micro or milli seconds of time.
Hence, the transaction timing noted would be combination of actual transaction and time spent in validating few strings.

If, we want to measure actual time, Load Runner has provided below approach (from Wilsonmar).
Double time_elapsed, duration, waste; //Variable declaration
Merc_timer_handle_t timer;
.
.
lr_start_transaction(“XYZ”);
web_url(...);
web_submit_data(...);
timer = lr_start_timer();
// Do all the validations
Web_reg_find(...);
Web_reg_find(...);
time_elapsed = lr_end_timer(timer); //Calculate wasted time
waste = time_elapsed*1000; //Convert milliseconds to seconds
lr_wasted_time(waste); //Remove wasted time
lr_end_transaction(“XYZ”,LR_AUTO);


No comments:

Post a Comment