user3669660
user3669660

Reputation: 13

How to add pacing dynamically in a HP LoadRunner script

I am working on a performance testing project using HP load runner, my requirement is to add pacing dynamically through script for each and every iteration. I did lost of research, but couldn't find one solution for this. Can someone please help in this?

Upvotes: 1

Views: 2870

Answers (4)

Ray Dodier
Ray Dodier

Reputation: 11

If you want actual script pacing and # of seconds is accurate enough you could use something like this -

int i, iPacing;

iPacing = 5; // Number of seconds to wait between passes of the script

lr_save_datetime("%H%M%S",DATE_NOW,"dCurTime");

i = atoi(lr_eval_string("{dCurTime}")) - atoi(lr_eval_string("{dStartTime}"));       

if (i >= iPacing){
   Action1();
   Action2();
   Action3();   
   lr_save_datetime("%H%M%S",DATE_NOW,"dStartTime");
} 

That very last line also goes in the vuser.init to set the initial start time.

Upvotes: 1

James Pulley
James Pulley

Reputation: 5682

If you want direct controlled pacing which will not be affected by your thinktime settings then you can use sleep(milliseconds); for a delay. You should also be able to pull the iteration number using a parameter.

I have used this type of model for a decayed pacing model with a sleep() at the end of the iteration with a fixed value divided by iteration number.

Upvotes: 0

Sahil Chaudhary
Sahil Chaudhary

Reputation: 1

Use the following code at the beginning or at the end of your action block:

lr_thinktime(atoi(lr_eval_string("{paramname}")));

paramname is the name of a parameter which will be a random number type. you can easily create a parameter with the help of parameter file settings.

Upvotes: 0

Thomas
Thomas

Reputation: 51

There is an LR function in load runner LR_thinktime(), it takes second as parameter input. Example: LR_thinktime(5), will make your script think for 5 seconds. You can use this function to induce required pacing in you vugen script. Have some logic to calculate pacing in seconds and pass it to LR_thinktime(). Hope this helps you!!

Upvotes: 1

Related Questions