Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
satyarafi Absent Member.
Absent Member.
2138 views

insert delay between requests

how do we insert delay between requests while running load test

0 Likes
5 Replies
chongSilk2013 Absent Member.
Absent Member.

RE: insert delay between requests

use wait funcationality. for example: wait (2.0) //wait for 2 second before next one

0 Likes
satyarafi Absent Member.
Absent Member.

RE: insert delay between requests

thanks! but that would be always fixed delay. i want 500ms delay between first and second, then 600 between 2nd and 3rd and so on..

Can it be achieved ?

0 Likes
Micro Focus Contributor
Micro Focus Contributor

RE: insert delay between requests

You could still do that with a wait:

WebPageUrl();

Wait 0.5;

WebPageUrl();

Wait 0.6;

Or use thinktimes:

WebPageUrl();

ThinkTime(0.5);

WebPageUrl();

ThinkTime(0.6);

If using a wait, the number you use is the amount of wait you will get.  If using a thinktime its a bit more flexible in terms of how you can simulate the behaviour.  Active profile settings for thinktimes will determine what behaviour you get.  

In any event, the transaction busy time received for your test will be the transaction response times minus the thinktime/wait time - meaning you can still get transaction response time values without your added waits and thinktimes included.  

0 Likes
ckim9 Absent Member.
Absent Member.

RE: insert delay between requests

I would do it by creating a global variable for the vuser. Say you create a global variable called "gnIter: number". Then you can initialize it to 1 in TInit. Then within TWork transaction, check the value of the global variable and decide how many milliseconds you want to delay using the Wait statement. Then increment the global variable before leaving your transaction (gnIter := gnIter + 1;) For example,

dcltrans

 transaction TWork

 var

 begin

   if gnIter = 1 then Wait 0.5;

   elseif (gnIter > 2) and (gnIter < 5) then Wait 0.6;

   elseif (gnIter > 5) and (gnIter < 10) then Wait 0.7;

   else Wait 0.3; end;

   // your transaction code

   ...

   gnIter := gnIter + 1;

 end;

0 Likes
Highlighted
donbonin Absent Member.
Absent Member.

RE: insert delay between requests

As an option, you may want to consider using thinktime with the OPT_THINKTIME_FORCEEXACT parameter.

There are a few interesting differences between wait and "ThinkTime with OPT_THINKTIME_FORCEEXACT" but the one that made me go with "ThinkTime with OPT_THINKTIME_FORCEEXACT"   was the fact that your concurrent user count will drop when WAIT is invoked for a vuser.

You can prove this by setting up a simple test with multiple users.  Graph the active users and you will see a nice saw tooth as the active user count goes down as they WAIT.  

If you use ThinkTime(fWaitTime, OPT_THINKTIME_FORCEEXACT);  the concurrent user count is not effected and it makes for a better graph.  I got tired of explaining why my concurrent user graph looked like a saw tooth!

 var

   fWaitTime : float;

 begin

   fWaitTime := 0.5;

   ThinkTime(fWaitTime, OPT_THINKTIME_FORCEEXACT);

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.