You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Laurent Perez <ha...@gmail.com> on 2008/09/29 12:18:14 UTC
Unable to use variables in Thread group duration/startup delay
Hi
Does the Thread group element support variables inside Calendar
duration/startup delay fields ?
I'm using a beanshell postprocessor like :
u1duration = 180;
u1delay = 10;
vars.put("u1duration", String.valueOf(u1duration));
vars.put("u1delay",String.valueOf(u1delay));
print(cal.getTime() + "u1: " + vars.get("u1duration") + "/" +
vars.get("u1delay"));
-> the output here is : Tue Sep 30 12:14:23 CEST 2008u1: 180/10
However, when I use ${u1duration} and ${u1delay in fields}, they are
not used by the thread group : the group just starts, then stops,
without performing anything.
Are variables supported in thread group element ?
Thanks
laurent
--
<a href="http://in-pocket.blogspot.com">http://in-pocket.blogspot.com
- Mobile world, technology and more</a>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: Unable to use variables in Thread group duration/startup delay
Posted by sebb <se...@gmail.com>.
On 29/09/2008, Laurent Perez <ha...@gmail.com> wrote:
> >> I'm using a beanshell postprocessor like :
>
> <snip>
>
> > By the time the beanshell post-processor is invoked, the test has
> > already started.
>
>
> Sorry, I meant, I'm using a beanshell PREprocessor (very wrong typo)
>
Same applies to the Pre-Processor. No test elements are processed
until the test starts.
> But it sounds like the preprocessor is invoked once the test has
> started, too ; I've made a very simple jmx scenario, and bsh variables
> are not seen.
>
> Is it the expected behaviour, does a preprocessor only precedes once
> the thread group has started ?
PreProcessors are processed before any Samples in scope - not before the test.
> My use case is that I'd like to be able to compute thread group
> duration/startup delay variables in a single place (i.e a bsh script)
> before starting the groups : I have many groups (~20 of them, to mimic
> various scenarios), and expressing things like "group1 will start and
> live for 30 minutes, group2 will start 15 minutes after group1 has
> started and live for 5 minutes, and so on" is very tedious when I have
> to setup each and every group timers independently.
>
I don't have the code to hand, but I'm fairly sure you can use the
beanshell initialisation script for this.
Just define the property beanshell.init.file in jmeter.properties.
If you include a print() statement you can check whether the script is
processed before the test is started.
Or use a scripting language to create the appropriate entries in a
properties file and pass that to JMeter.
> Thanks
> laurent
>
> --
> <a href="http://in-pocket.blogspot.com">http://in-pocket.blogspot.com
> - Mobile world, technology and more</a>
>
> ---------------------------------------------------------------------
> 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
Re: Unable to use variables in Thread group duration/startup delay
Posted by Laurent Perez <ha...@gmail.com>.
>> I'm using a beanshell postprocessor like :
<snip>
> By the time the beanshell post-processor is invoked, the test has
> already started.
Sorry, I meant, I'm using a beanshell PREprocessor (very wrong typo)
But it sounds like the preprocessor is invoked once the test has
started, too ; I've made a very simple jmx scenario, and bsh variables
are not seen.
Is it the expected behaviour, does a preprocessor only precedes once
the thread group has started ?
My use case is that I'd like to be able to compute thread group
duration/startup delay variables in a single place (i.e a bsh script)
before starting the groups : I have many groups (~20 of them, to mimic
various scenarios), and expressing things like "group1 will start and
live for 30 minutes, group2 will start 15 minutes after group1 has
started and live for 5 minutes, and so on" is very tedious when I have
to setup each and every group timers independently.
Thanks
laurent
--
<a href="http://in-pocket.blogspot.com">http://in-pocket.blogspot.com
- Mobile world, technology and more</a>
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
Re: Unable to use variables in Thread group duration/startup delay
Posted by sebb <se...@gmail.com>.
On 29/09/2008, Laurent Perez <ha...@gmail.com> wrote:
> Hi
>
> Does the Thread group element support variables inside Calendar
> duration/startup delay fields ?
Yes.
> I'm using a beanshell postprocessor like :
> u1duration = 180;
> u1delay = 10;
> vars.put("u1duration", String.valueOf(u1duration));
> vars.put("u1delay",String.valueOf(u1delay));
> print(cal.getTime() + "u1: " + vars.get("u1duration") + "/" +
> vars.get("u1delay"));
> -> the output here is : Tue Sep 30 12:14:23 CEST 2008u1: 180/10
>
> However, when I use ${u1duration} and ${u1delay in fields}, they are
> not used by the thread group : the group just starts, then stops,
> without performing anything.
You need to define the variables on the Test Plan (or use properties
and define them on the command-line or jmeter.properties.)
By the time the beanshell post-processor is invoked, the test has
already started.
> Are variables supported in thread group element ?
>
> Thanks
> laurent
>
>
>
> --
> <a href="http://in-pocket.blogspot.com">http://in-pocket.blogspot.com
> - Mobile world, technology and more</a>
>
> ---------------------------------------------------------------------
> 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