You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by luke tarr <lu...@hotmail.com> on 2010/12/20 16:17:26 UTC

IF or WHILE Contoller to limit requests by current time

Hi, 
I’m after a bit of help with Jmeter. 
I have a time parameter that is sent with a request which effectively looks like this 
TIME=2010-12-07T09:00:00 
I have used the time function within the parameter so that the year, month, date and time(HH) are all sourced from the system clock and are therefore always up-to-date; the parameter that is now passed is shown below.
TIME=${__time(yyyy)}-{__time(MM)}-${__time(dd)}T${__time(HH)}:00:00 
This works fine but I would like to limit when the HTTP request is used depending upon the minutes past the hour; there is a cycle of four differing images that are available, changing every 15 minutes e.g. T09:00:00 is image 1, T09:15:00 is image 2 etc).
My initial thought was to use either an IF of WHILE controller that would tell the HTTP request to only function if the actual minutes are within a given range (there would be a HTTP request set for each 15 minute window and each would have a controller) but I can’t figure it out. 
So, for the first 15 minute window I went along the lines of ‘${__time(mm)}<15’ for IF and ‘${__javaScript(${__time(mm)}<15)}’ for WHILE to see if the request could be limited to a certain part of the hour (it would poll every minute up to the point in time when the next 15min period starts).  The instance would be left running for fairly long durations of time to see that the images (content changed/were available in a timely fashion).
Any ideas would be greatly appreciated.
 
Many thanks,
 
Luke 		 	   		  

Re: IF or WHILE Contoller to limit requests by current time

Posted by sebb <se...@gmail.com>.
On 20 December 2010 15:17, luke tarr <lu...@hotmail.com> wrote:
>
> Hi,
> I’m after a bit of help with Jmeter.
> I have a time parameter that is sent with a request which effectively looks like this
> TIME=2010-12-07T09:00:00
> I have used the time function within the parameter so that the year, month, date and time(HH) are all sourced from the system clock and are therefore always up-to-date; the parameter that is now passed is shown below.
> TIME=${__time(yyyy)}-{__time(MM)}-${__time(dd)}T${__time(HH)}:00:00

Why don't you use:

TIME=${__time(yyyy-MM-ddTHH00:00)}

to create the time?

> This works fine but I would like to limit when the HTTP request is used depending upon the minutes past the hour; there is a cycle of four differing images that are available, changing every 15 minutes e.g. T09:00:00 is image 1, T09:15:00 is image 2 etc).
> My initial thought was to use either an IF of WHILE controller that would tell the HTTP request to only function if the actual minutes are within a given range (there would be a HTTP request set for each 15 minute window and each would have a controller) but I can’t figure it out.
> So, for the first 15 minute window I went along the lines of ‘${__time(mm)}<15’ for IF and ‘${__javaScript(${__time(mm)}<15)}’ for WHILE to see if the request could be limited to a certain part of the hour (it would poll every minute up to the point in time when the next 15min period starts).  The instance would be left running for fairly long durations of time to see that the images (content changed/were available in a timely fashion).
> Any ideas would be greatly appreciated.

I would probably use the switch controller, and convert the time into
0-3 quarters.

> Many thanks,
>
> Luke

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org