You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Ian Blavins <ib...@temenos.com> on 2008/09/07 16:46:02 UTC

Is there a way to set a local variable

G'day

 

Is there a way to give a value to a thread-specific variable via a test
plan element that is ordered, not hierarchical. 

 

At the moment to give a thread-specific variable a value I run a sampler
which returns the required value; I then parse the output of the sampler
into a local variable with a regular expression post processor. This
seems like a lot of work just to set a variable. But I can't see another
way other than the script samplers. These are slower than the Java
sampler I use and performance is important.

 

 

 

Ian Blavins
Software performance specialist

.

TEMENOS
The Banking Software Company

.

PeopleBuilding 2, Maylands Av

Hemel Hempstead   UK   HP2 4NW

.

T:  +44 (0) 1442 431 106
E:  iblavins@temenos.com

.

www.temenos.com <http://www.temenos.com> 

.

P Consider the environment. Please don't print this e-mail unless you
really need to.

 


Disclaimer:
If you have received this e-mail in error please notify the sender. 
Please note that any views or opinions presented in this e-mail are solely 
those of the author and do not necessarily represent those of TEMENOS. 
We recommend that you check this e-mail and any attachments against viruses. 
TEMENOS accepts no liability for any damage caused by any malicious code 
or virus transmitted by this e-mail.


Re: Is there a way to set a local variable

Posted by sebb <se...@gmail.com>.
On 07/09/2008, Ian Blavins <ib...@temenos.com> wrote:
> G'day
>
>  I looked at that initially but got put off by it being a pre-processor and strictly not meeting the requirement of being ordered rather than hierarchical.
>
>  But if I understand you correctly:
>
>  - attach the UDP to a sampler so that it inherits its scope from that

Yes, that will restrict when the element is evaluated.

>  - use the test action as the sampler because it is the cheapest of samplers to execute
>  - set the test action to be a zero length pause

Or you can use an existing sampler if there is one at the appropriate
place in the plan - that will be cheaper still.

>  - set up the UDP with a single column so each time around we know which value we are getting
>  - ensure that the value is per-thread
>  - the value can be a function
>
>  I think that might work. Much depends on the performance but I can easily check that.

It works for me.

You can temporarily add a Debug or Java Sampler to show the values of
any variables.

>
>
>
>
>
>  Ian Blavins
>  Software performance specialist
>  .
>  TEMENOS
>  The Banking Software Company
>  .
>  PeopleBuilding 2, Maylands Av
>  Hemel Hempstead   UK   HP2 4NW
>  .
>  T:  +44 (0) 1442 431 106
>  E:  iblavins@temenos.com
>  .
>  www.temenos.com
>
> .
>   Consider the environment. Please don't print this e-mail unless you really need to.
>
>
>
>  -----Original Message-----
>  From: sebb [mailto:sebbaz@gmail.com]
>  Sent: Sunday, 7 September 2008 5:12 PM
>  To: JMeter Users List
>  Subject: Re: Is there a way to set a local variable
>
>  On 07/09/2008, Ian Blavins <ib...@temenos.com> wrote:
>  > G'day
>  >
>  >
>  >
>  >  Is there a way to give a value to a thread-specific variable via a test
>  >  plan element that is ordered, not hierarchical.
>  >
>  >
>  >  At the moment to give a thread-specific variable a value I run a sampler
>  >  which returns the required value; I then parse the output of the sampler
>  >  into a local variable with a regular expression post processor. This
>  >  seems like a lot of work just to set a variable. But I can't see another
>  >  way other than the script samplers. These are slower than the Java
>  >  sampler I use and performance is important.
>  >
>  >
>
>  What about a User Parameters Pre-Processor?
>
>  http://jakarta.apache.org/jmeter/usermanual/component_reference.html#User_Parameters
>
>  Attach it to a Test Action element if necessary.
>
>  http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Test_Action
>
>
>  >
>  >
>  >
>  >
>  >
>  >  Ian Blavins
>  >  Software performance specialist
>  >
>  >  .
>  >
>  >  TEMENOS
>  >  The Banking Software Company
>  >
>  >  .
>  >
>  >  PeopleBuilding 2, Maylands Av
>  >
>  >  Hemel Hempstead   UK   HP2 4NW
>  >
>  >  .
>  >
>  >  T:  +44 (0) 1442 431 106
>  >  E:  iblavins@temenos.com
>  >
>  >  .
>  >
>  >  www.temenos.com <http://www.temenos.com>
>  >
>  >  .
>  >
>  >  P Consider the environment. Please don't print this e-mail unless you
>  >  really need to.
>  >
>  >
>  >
>  >
>  >  Disclaimer:
>  >  If you have received this e-mail in error please notify the sender.
>  >  Please note that any views or opinions presented in this e-mail are solely
>  >  those of the author and do not necessarily represent those of TEMENOS.
>  >  We recommend that you check this e-mail and any attachments against viruses.
>  >  TEMENOS accepts no liability for any damage caused by any malicious code
>  >  or virus transmitted by this e-mail.
>  >
>  >
>
>
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
>  For additional commands, e-mail: jmeter-user-help@jakarta.apache.org
>
>
>
>  Disclaimer:
>  If you have received this e-mail in error please notify the sender.
>  Please note that any views or opinions presented in this e-mail are solely
>  those of the author and do not necessarily represent those of TEMENOS.
>  We recommend that you check this e-mail and any attachments against viruses.
>  TEMENOS accepts no liability for any damage caused by any malicious code
>  or virus transmitted by this e-mail.
>
>

RE: Is there a way to set a local variable

Posted by Ian Blavins <ib...@temenos.com>.
G'day

I looked at that initially but got put off by it being a pre-processor and strictly not meeting the requirement of being ordered rather than hierarchical.

But if I understand you correctly:

- attach the UDP to a sampler so that it inherits its scope from that
- use the test action as the sampler because it is the cheapest of samplers to execute
- set the test action to be a zero length pause
- set up the UDP with a single column so each time around we know which value we are getting
- ensure that the value is per-thread
- the value can be a function

I think that might work. Much depends on the performance but I can easily check that.




Ian Blavins
Software performance specialist
.
TEMENOS
The Banking Software Company
.
PeopleBuilding 2, Maylands Av
Hemel Hempstead   UK   HP2 4NW
.
T:  +44 (0) 1442 431 106
E:  iblavins@temenos.com
.
www.temenos.com
.
 Consider the environment. Please don't print this e-mail unless you really need to.


-----Original Message-----
From: sebb [mailto:sebbaz@gmail.com] 
Sent: Sunday, 7 September 2008 5:12 PM
To: JMeter Users List
Subject: Re: Is there a way to set a local variable

On 07/09/2008, Ian Blavins <ib...@temenos.com> wrote:
> G'day
>
>
>
>  Is there a way to give a value to a thread-specific variable via a test
>  plan element that is ordered, not hierarchical.
>
>
>  At the moment to give a thread-specific variable a value I run a sampler
>  which returns the required value; I then parse the output of the sampler
>  into a local variable with a regular expression post processor. This
>  seems like a lot of work just to set a variable. But I can't see another
>  way other than the script samplers. These are slower than the Java
>  sampler I use and performance is important.
>
>

What about a User Parameters Pre-Processor?

http://jakarta.apache.org/jmeter/usermanual/component_reference.html#User_Parameters

Attach it to a Test Action element if necessary.

http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Test_Action


>
>
>
>
>
>  Ian Blavins
>  Software performance specialist
>
>  .
>
>  TEMENOS
>  The Banking Software Company
>
>  .
>
>  PeopleBuilding 2, Maylands Av
>
>  Hemel Hempstead   UK   HP2 4NW
>
>  .
>
>  T:  +44 (0) 1442 431 106
>  E:  iblavins@temenos.com
>
>  .
>
>  www.temenos.com <http://www.temenos.com>
>
>  .
>
>  P Consider the environment. Please don't print this e-mail unless you
>  really need to.
>
>
>
>
>  Disclaimer:
>  If you have received this e-mail in error please notify the sender.
>  Please note that any views or opinions presented in this e-mail are solely
>  those of the author and do not necessarily represent those of TEMENOS.
>  We recommend that you check this e-mail and any attachments against viruses.
>  TEMENOS accepts no liability for any damage caused by any malicious code
>  or virus transmitted by this e-mail.
>
>

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


Disclaimer:
If you have received this e-mail in error please notify the sender. 
Please note that any views or opinions presented in this e-mail are solely 
those of the author and do not necessarily represent those of TEMENOS. 
We recommend that you check this e-mail and any attachments against viruses. 
TEMENOS accepts no liability for any damage caused by any malicious code 
or virus transmitted by this e-mail.


Re: Is there a way to set a local variable

Posted by sebb <se...@gmail.com>.
On 07/09/2008, Ian Blavins <ib...@temenos.com> wrote:
> G'day
>
>
>
>  Is there a way to give a value to a thread-specific variable via a test
>  plan element that is ordered, not hierarchical.
>
>
>  At the moment to give a thread-specific variable a value I run a sampler
>  which returns the required value; I then parse the output of the sampler
>  into a local variable with a regular expression post processor. This
>  seems like a lot of work just to set a variable. But I can't see another
>  way other than the script samplers. These are slower than the Java
>  sampler I use and performance is important.
>
>

What about a User Parameters Pre-Processor?

http://jakarta.apache.org/jmeter/usermanual/component_reference.html#User_Parameters

Attach it to a Test Action element if necessary.

http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Test_Action


>
>
>
>
>
>  Ian Blavins
>  Software performance specialist
>
>  .
>
>  TEMENOS
>  The Banking Software Company
>
>  .
>
>  PeopleBuilding 2, Maylands Av
>
>  Hemel Hempstead   UK   HP2 4NW
>
>  .
>
>  T:  +44 (0) 1442 431 106
>  E:  iblavins@temenos.com
>
>  .
>
>  www.temenos.com <http://www.temenos.com>
>
>  .
>
>  P Consider the environment. Please don't print this e-mail unless you
>  really need to.
>
>
>
>
>  Disclaimer:
>  If you have received this e-mail in error please notify the sender.
>  Please note that any views or opinions presented in this e-mail are solely
>  those of the author and do not necessarily represent those of TEMENOS.
>  We recommend that you check this e-mail and any attachments against viruses.
>  TEMENOS accepts no liability for any damage caused by any malicious code
>  or virus transmitted by this e-mail.
>
>

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