You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by jada <ji...@navy.mil> on 2007/06/13 19:26:19 UTC

Using variable in Timer

Hello all,

I would like to use different delays for different cases in my test plan.
I generate a random number up front and use an If Controller to select
cases.
I save the random number (0-60) in a variable "delayTime" and use it as time
delay.

Here is the problem:
I tried Test Action's Duration field with ${delayTime} but it changed back
to zero.
So I tried to add a Constant Timer as a Test Action's child and entered
${delayTime}*1000 in the Thread Delay field. The field accepted the variable
but it did not delay at all when the test ran.

Below is a reduced scenario for testing purpose:

Thread Group (1 thread, 2 loops)
- HTTP Cookie Manager
- User Parameters
    Name: delayTime
    User_1: ${__log(delayTime = ${__Random(0,60,delayTime)},OUT)}
- HTTP Request
- Test Action (Duration: 0)
   - Constant Timer (Thread Delay: ${delayTime}*1000)

Please note that the test loops twice without any delay even though the
delayTime is not zero.
I assume that the variable value will be automatically converted as needed
because it is the case when I use it in the If Controller (Condition:
${delayTime} =< 30).

My conclusion is that both the Test Action and the Constant Timer do not
accept variables. Is it true?
If they don't accept variables, they should reject right away or else it
would be misleading.

Is BeanShell Timer the only one which accepts variables?

Please advise. Thanks
Jada



-- 
View this message in context: http://www.nabble.com/Using-variable-in-Timer-tf3916281.html#a11104461
Sent from the JMeter - User mailing list archive at Nabble.com.


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


Re: Using variable in Timer

Posted by sebb <se...@gmail.com>.
Timers do accept variables, but the result after substitution of the
value must be a number, not an arithmetic expression.

e.g. you cannot use 10*1000 in a timer, so you cannot use ${T}*1000 either.

S.
On 13/06/07, jada <ji...@navy.mil> wrote:
>
> Hello all,
>
> I would like to use different delays for different cases in my test plan.
> I generate a random number up front and use an If Controller to select
> cases.
> I save the random number (0-60) in a variable "delayTime" and use it as time
> delay.
>
> Here is the problem:
> I tried Test Action's Duration field with ${delayTime} but it changed back
> to zero.
> So I tried to add a Constant Timer as a Test Action's child and entered
> ${delayTime}*1000 in the Thread Delay field. The field accepted the variable
> but it did not delay at all when the test ran.
>
> Below is a reduced scenario for testing purpose:
>
> Thread Group (1 thread, 2 loops)
> - HTTP Cookie Manager
> - User Parameters
>    Name: delayTime
>    User_1: ${__log(delayTime = ${__Random(0,60,delayTime)},OUT)}
> - HTTP Request
> - Test Action (Duration: 0)
>   - Constant Timer (Thread Delay: ${delayTime}*1000)
>
> Please note that the test loops twice without any delay even though the
> delayTime is not zero.
> I assume that the variable value will be automatically converted as needed
> because it is the case when I use it in the If Controller (Condition:
> ${delayTime} =< 30).
>
> My conclusion is that both the Test Action and the Constant Timer do not
> accept variables. Is it true?
> If they don't accept variables, they should reject right away or else it
> would be misleading.
>
> Is BeanShell Timer the only one which accepts variables?
>
> Please advise. Thanks
> Jada
>
>
>
> --
> View this message in context: http://www.nabble.com/Using-variable-in-Timer-tf3916281.html#a11104461
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>

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