You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Shing Hing Man <ma...@yahoo.com> on 2014/02/08 21:46:04 UTC

How to pass a value to two Http Request Samplers.

Hi,
I am using JMeter 2.9.
I have a test plan  :
ThreadGroup (no of threads 2,  loop count =1) 
Simple controller
BeanShell PrePocessor  :  vars.put("myId",  "${__UUID}")
hashHttpRequest 
dataHttpRequest
In both hashHttpRequest,    dataHttpRequest sampler,  I want to set a http get parameter impId=${myId} .
In other words,  in each iteration each thread sends a hashHttpRequest,    dataHttpRequest with a common impld  value.
But from "View Result Tree",    the value of impId in hashHttpRequest is different from the one in dataHttpRequest.
Eg :
http://localhost:8081/test/hash?imp_id=7a0509dc-b362-4fc0-8229-a8c692d16dd9
http://localhost:8081/test/data?imp_id=a85374d8-7a46-4eda-b1c4-44fbf4081db1&name0=foo0


May I know how to get imp_id in both http request to be the same ?
Thanks in advance for any assistance !
Shing 

Re: How to pass a value to two Http Request Samplers.

Posted by Shing Hing Man <ma...@yahoo.com>.

Hi  John,
   I have tried out your suggestion and it works !

For the record, I now have :

ThreadGroup (no of threads 2,  loop count =1) 
      BeanShell Sampler :  vars.put("myId",  "${__UUID}")
      Simple controller
          ViewResultsTree
          Simple controller 
                 hashHttpRequest 
                 dataHttpRequest


Thanks !

Shing




On Saturday, February 8, 2014 8:55 PM, John_schulz <jo...@aol.com> wrote:

Shing,

Bean shell preprocessor is executed for each sampler call. If you want to have the same value throughout the loop use a bean shell sampler instead. Note, this may produce extra samples into your reporting so in that case use a simple controller below the bean shell sampler and put your listener inside the scope of the simple controller with the samplers.

John

Sent from my iPad


> On Feb 8, 2014, at 3:46 PM, Shing Hing Man <ma...@yahoo.com> wrote:
> 
> Hi,
> I am using JMeter 2.9.
> I have a test plan  :
> ThreadGroup (no of threads 2,  loop count =1) 
> Simple controller
> BeanShell PrePocessor  :  vars.put("myId",  "${__UUID}")
> hashHttpRequest 
> dataHttpRequest
> In both hashHttpRequest,    dataHttpRequest sampler,  I want to set a http get parameter impId=${myId} .
> In other words,  in each iteration each thread sends a hashHttpRequest,    dataHttpRequest with a common impld  value.
> But from "View Result Tree",    the value of impId in hashHttpRequest is different from the one in dataHttpRequest.
> Eg :
> http://localhost:8081/test/hash?imp_id=7a0509dc-b362-4fc0-8229-a8c692d16dd9
> http://localhost:8081/test/data?imp_id=a85374d8-7a46-4eda-b1c4-44fbf4081db1&name0=foo0
> 
> 
> May I know how to get imp_id in both http request to be the same ?
> Thanks in advance for any assistance !
> Shing

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

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


Re: How to pass a value to two Http Request Samplers.

Posted by John_schulz <jo...@aol.com>.
Shing,

Bean shell preprocessor is executed for each sampler call. If you want to have the same value throughout the loop use a bean shell sampler instead. Note, this may produce extra samples into your reporting so in that case use a simple controller below the bean shell sampler and put your listener inside the scope of the simple controller with the samplers.

John

Sent from my iPad

> On Feb 8, 2014, at 3:46 PM, Shing Hing Man <ma...@yahoo.com> wrote:
> 
> Hi,
> I am using JMeter 2.9.
> I have a test plan  :
> ThreadGroup (no of threads 2,  loop count =1) 
> Simple controller
> BeanShell PrePocessor  :  vars.put("myId",  "${__UUID}")
> hashHttpRequest 
> dataHttpRequest
> In both hashHttpRequest,    dataHttpRequest sampler,  I want to set a http get parameter impId=${myId} .
> In other words,  in each iteration each thread sends a hashHttpRequest,    dataHttpRequest with a common impld  value.
> But from "View Result Tree",    the value of impId in hashHttpRequest is different from the one in dataHttpRequest.
> Eg :
> http://localhost:8081/test/hash?imp_id=7a0509dc-b362-4fc0-8229-a8c692d16dd9
> http://localhost:8081/test/data?imp_id=a85374d8-7a46-4eda-b1c4-44fbf4081db1&name0=foo0
> 
> 
> May I know how to get imp_id in both http request to be the same ?
> Thanks in advance for any assistance !
> Shing

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