You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by unjc email <un...@gmail.com> on 2012/07/16 17:50:07 UTC

Sharing Variables Between Thread-Group

Hello,

I have two thread groups set up in my test plan.  The first test group
is for initializing variables for the test plan at start; it is
configured with a dummy debug sampler.  The second group is where the
actual test samplers are placed.  I try to pass the variables from
thread-group 1  via __setProperty to thread-group 2, but I always have
"void" value from __P calls.   Could someone please advise the proper
way to pass variables from one group to another?


Test Plan (with 2 thread groups)

Thread-Group1 (with 1 thread)
> Dubug Sampler
> BeanShell PreProcessor
   Script:
              tmp = "abc";
              ${__setProperty(key,tmp)};
              log.info("Group 1 key = " + ${__P(key)});


Thread-Group2 (with 2 threads)
> HTTP Sampler
> BeanShell PreProcessor
   Script:
              log.info("Group 2 key = " + ${__P(key)});


2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
started: Thread Group 1-1
2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
started: Thread Group 2-1
2012/07/16 15:47:32 INFO  - jmeter.util.BeanShellTestElement: Group 1 key = abc
2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
finished: Thread Group 1-1
2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: Ending
thread Thread Group 1-1
2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: All
threads have been started
2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
started: Thread Group 2-2
2012/07/16 15:47:32 INFO  - jmeter.util.BeanShellTestElement: Group 2
key = void
2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
finished: Thread Group 2-1
2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: Ending
thread Thread Group 2-1
2012/07/16 15:47:32 INFO  - jmeter.util.BeanShellTestElement: Group 2
key = void
2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
finished: Thread Group 2-2
2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: Ending
thread Thread Group 2-2




Thanks,
Jacky

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


Re: Sharing Variables Between Thread-Group

Posted by Cyril SANTUNE <cy...@gmail.com>.
Hi,

You can try jmeter plugin "InterThreadCommunication"
on http://code.google.com/p/jmeter-plugins/

Cyril

On Mon, Jul 16, 2012 at 5:50 PM, unjc email <un...@gmail.com> wrote:
> Hello,
>
> I have two thread groups set up in my test plan.  The first test group
> is for initializing variables for the test plan at start; it is
> configured with a dummy debug sampler.  The second group is where the
> actual test samplers are placed.  I try to pass the variables from
> thread-group 1  via __setProperty to thread-group 2, but I always have
> "void" value from __P calls.   Could someone please advise the proper
> way to pass variables from one group to another?
>
>
> Test Plan (with 2 thread groups)
>
> Thread-Group1 (with 1 thread)
>> Dubug Sampler
>> BeanShell PreProcessor
>    Script:
>               tmp = "abc";
>               ${__setProperty(key,tmp)};
>               log.info("Group 1 key = " + ${__P(key)});
>
>
> Thread-Group2 (with 2 threads)
>> HTTP Sampler
>> BeanShell PreProcessor
>    Script:
>               log.info("Group 2 key = " + ${__P(key)});
>
>
> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
> started: Thread Group 1-1
> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
> started: Thread Group 2-1
> 2012/07/16 15:47:32 INFO  - jmeter.util.BeanShellTestElement: Group 1 key = abc
> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
> finished: Thread Group 1-1
> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: Ending
> thread Thread Group 1-1
> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: All
> threads have been started
> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
> started: Thread Group 2-2
> 2012/07/16 15:47:32 INFO  - jmeter.util.BeanShellTestElement: Group 2
> key = void
> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
> finished: Thread Group 2-1
> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: Ending
> thread Thread Group 2-1
> 2012/07/16 15:47:32 INFO  - jmeter.util.BeanShellTestElement: Group 2
> key = void
> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
> finished: Thread Group 2-2
> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: Ending
> thread Thread Group 2-2
>
>
>
>
> Thanks,
> Jacky
>
> ---------------------------------------------------------------------
> 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: Sharing Variables Between Thread-Group

Posted by sebb <se...@gmail.com>.
On 16 July 2012 16:50, unjc email <un...@gmail.com> wrote:
> Hello,
>
> I have two thread groups set up in my test plan.  The first test group
> is for initializing variables for the test plan at start; it is
> configured with a dummy debug sampler.

Should be a setUp Thread Group.

> The second group is where the
> actual test samplers are placed.  I try to pass the variables from
> thread-group 1  via __setProperty to thread-group 2, but I always have
> "void" value from __P calls.   Could someone please advise the proper
> way to pass variables from one group to another?

Should work using __setProperty/__P.

If it doesn't, double check the code.

>
> Test Plan (with 2 thread groups)
>
> Thread-Group1 (with 1 thread)
>> Dubug Sampler
>> BeanShell PreProcessor
>    Script:
>               tmp = "abc";
>               ${__setProperty(key,tmp)};
>               log.info("Group 1 key = " + ${__P(key)});
>

What is the value of 'key' here?

> Thread-Group2 (with 2 threads)
>> HTTP Sampler
>> BeanShell PreProcessor
>    Script:
>               log.info("Group 2 key = " + ${__P(key)});
>

What is the value of 'key' here?

Are you 100% sure the key variables have the same value?
Have you logged the key values?

> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
> started: Thread Group 1-1
> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
> started: Thread Group 2-1
> 2012/07/16 15:47:32 INFO  - jmeter.util.BeanShellTestElement: Group 1 key = abc
> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
> finished: Thread Group 1-1
> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: Ending
> thread Thread Group 1-1
> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: All
> threads have been started
> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
> started: Thread Group 2-2
> 2012/07/16 15:47:32 INFO  - jmeter.util.BeanShellTestElement: Group 2
> key = void
> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
> finished: Thread Group 2-1
> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: Ending
> thread Thread Group 2-1
> 2012/07/16 15:47:32 INFO  - jmeter.util.BeanShellTestElement: Group 2
> key = void
> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
> finished: Thread Group 2-2
> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: Ending
> thread Thread Group 2-2
>
>
>
>
> Thanks,
> Jacky
>
> ---------------------------------------------------------------------
> 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: Sharing Variables Between Thread-Group

Posted by sebb <se...@gmail.com>.
On 16 July 2012 19:42, unjc email <un...@gmail.com> wrote:
> Guys, thanks for your replies.
>
> I don't know if anyone have this experience.  I found that
> ${__setProperty}/${__P} pair would work between thread groups IF I use
> constant value ("abc" like below example) or system variables (like
> $__time(HMS). When I use a local variable ("tmp" as like in my
> example) in the $__setProperty call, it doesn't work.
>
>               tmp = "abc";
>               ${__setProperty(key,tmp)};                           //
> THAT DOES NOT WORK!!
>               ${__setProperty(key,"abc")};
> // THAT WORKS!!
>
>
> I also found that it is NOT the variable value that is shared between
> the thread group, it's the reference.  When I put ${__time(HMS)} in
> the __setProperty call and run the test, the "key" values are
> different between the two thread group.  Does anyone know how to pass
> a local-defined variable value using setProperty call?
>
>
> Test Plan (with 2 thread groups)
>
> Thread-Group1 (with 1 thread)
>> Dubug Sampler
>> BeanShell PreProcessor
>    Script:
>               ${__setProperty(key,${__time(HMS)})};
>        // USING TIMESTAMP
>               log.info("Group 1 key = " + ${__P(key)});
>         //2012/07/16 18:31:36 INFO  -
> jmeter.util.BeanShellTestElement: Group 1 key = 183136
>
>
> Thread-Group2 (with 2 threads)
>> HTTP Sampler
>> BeanShell PreProcessor
>    Script:
>               log.info("Group 2 key = " + ${__P(key)});
>          //2012/07/16 18:31:36 INFO  -
> jmeter.util.BeanShellTestElement: Group 2 key = 183119
>
> Note that it is not the same value being logged.

Sorry, I saw that you were using function references within the
script, but did not realise the implications.

Such references are processed *before* the script is passed to
BeanShell, so won't have access to the values set up by BeanShell.

It's best not to mix function references with script elements such as
BeanShell, as the behaviour is harder to follow.

To set a property using BeanShell, use:

props.put("propname", "value");

or using variables:

key="propname";
val="value";
props.put(key, value);

Property setting is documented at:

http://jmeter.apache.org/usermanual/component_reference.html#BeanShell_Sampler

>
>
> Regards,
> Jacky
>
> On Mon, Jul 16, 2012 at 12:48 PM, Jomebrew <ai...@gmail.com> wrote:
>> I documented how I do in a blog post a while back.  I still use this 100%
>> of the time.  I run several instances on a machine in GUI mode and each
>> instance has 250 users per thread group (two thread groups, same users for
>> each group) for a total 500 threads/connections per instance.
>>
>> I think this was problem #2 for me in this post.
>>
>> http://www.jomebrew.com/2011/10/jmeter-random-transactions-and-sharing.html
>>
>> /Joe
>>
>> On Mon, Jul 16, 2012 at 8:50 AM, unjc email <un...@gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I have two thread groups set up in my test plan.  The first test group
>>> is for initializing variables for the test plan at start; it is
>>> configured with a dummy debug sampler.  The second group is where the
>>> actual test samplers are placed.  I try to pass the variables from
>>> thread-group 1  via __setProperty to thread-group 2, but I always have
>>> "void" value from __P calls.   Could someone please advise the proper
>>> way to pass variables from one group to another?
>>>
>>>
>>> Test Plan (with 2 thread groups)
>>>
>>> Thread-Group1 (with 1 thread)
>>> > Dubug Sampler
>>> > BeanShell PreProcessor
>>>    Script:
>>>               tmp = "abc";
>>>               ${__setProperty(key,tmp)};
>>>               log.info("Group 1 key = " + ${__P(key)});
>>>
>>>
>>> Thread-Group2 (with 2 threads)
>>> > HTTP Sampler
>>> > BeanShell PreProcessor
>>>    Script:
>>>               log.info("Group 2 key = " + ${__P(key)});
>>>
>>>
>>> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
>>> started: Thread Group 1-1
>>> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
>>> started: Thread Group 2-1
>>> 2012/07/16 15:47:32 INFO  - jmeter.util.BeanShellTestElement: Group 1 key
>>> = abc
>>> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
>>> finished: Thread Group 1-1
>>> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: Ending
>>> thread Thread Group 1-1
>>> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: All
>>> threads have been started
>>> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
>>> started: Thread Group 2-2
>>> 2012/07/16 15:47:32 INFO  - jmeter.util.BeanShellTestElement: Group 2
>>> key = void
>>> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
>>> finished: Thread Group 2-1
>>> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: Ending
>>> thread Thread Group 2-1
>>> 2012/07/16 15:47:32 INFO  - jmeter.util.BeanShellTestElement: Group 2
>>> key = void
>>> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
>>> finished: Thread Group 2-2
>>> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: Ending
>>> thread Thread Group 2-2
>>>
>>>
>>>
>>>
>>> Thanks,
>>> Jacky
>>>
>>> ---------------------------------------------------------------------
>>> 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
>

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


Re: Sharing Variables Between Thread-Group

Posted by sebb <se...@gmail.com>.
On 17 July 2012 08:32, Sergio Boso <se...@bosoconsulting.it> wrote:
> Il 16/07/2012 20:42, unjc email ha scritto:
>
>> Guys, thanks for your replies.
>>
>> I don't know if anyone have this experience.  I found that
>> ${__setProperty}/${__P} pair would work between thread groups IF I use
>> constant value ("abc" like below example) or system variables (like
>> $__time(HMS). When I use a local variable ("tmp" as like in my
>> example) in the $__setProperty call, it doesn't work.
>>
>>                tmp = "abc";
>>                ${__setProperty(key,tmp)};                           //
>> THAT DOES NOT WORK!!
>
> hi
> I think it should be:
>
>               ${__setProperty(key,${tmp})};

That won't work, because tmp is not a JMeter variable, it is a
BeanShell variable.
Besides, the entire construct is resolved before it is passed to
BeanShell for processing - BSH will see the return value from the
function which is the empty string.

> regards
>
>
>>                ${__setProperty(key,"abc")};
>> // THAT WORKS!!
>>
>>
>> I also found that it is NOT the variable value that is shared between
>> the thread group, it's the reference.  When I put ${__time(HMS)} in
>> the __setProperty call and run the test, the "key" values are
>> different between the two thread group.  Does anyone know how to pass
>> a local-defined variable value using setProperty call?
>>
>>
>> Test Plan (with 2 thread groups)
>>
>> Thread-Group1 (with 1 thread)
>>>
>>> Dubug Sampler
>>> BeanShell PreProcessor
>>
>>     Script:
>>                ${__setProperty(key,${__time(HMS)})};
>>         // USING TIMESTAMP
>>                log.info("Group 1 key = " + ${__P(key)});
>>          //2012/07/16 18:31:36 INFO  -
>> jmeter.util.BeanShellTestElement: Group 1 key = 183136
>>
>>
>> Thread-Group2 (with 2 threads)
>>>
>>> HTTP Sampler
>>> BeanShell PreProcessor
>>
>>     Script:
>>                log.info("Group 2 key = " + ${__P(key)});
>>           //2012/07/16 18:31:36 INFO  -
>> jmeter.util.BeanShellTestElement: Group 2 key = 183119
>>
>> Note that it is not the same value being logged.
>>
>>
>>
>> Regards,
>> Jacky
>>
>> On Mon, Jul 16, 2012 at 12:48 PM, Jomebrew <ai...@gmail.com> wrote:
>>
>
> --
>
> Ing. Sergio Boso
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> 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: Sharing Variables Between Thread-Group

Posted by Sergio Boso <se...@bosoconsulting.it>.
Il 16/07/2012 20:42, unjc email ha scritto:
> Guys, thanks for your replies.
>
> I don't know if anyone have this experience.  I found that
> ${__setProperty}/${__P} pair would work between thread groups IF I use
> constant value ("abc" like below example) or system variables (like
> $__time(HMS). When I use a local variable ("tmp" as like in my
> example) in the $__setProperty call, it doesn't work.
>
>                tmp = "abc";
>                ${__setProperty(key,tmp)};                           //
> THAT DOES NOT WORK!!
hi
I think it should be:

               ${__setProperty(key,${tmp})};

regards

>                ${__setProperty(key,"abc")};
> // THAT WORKS!!
>
>
> I also found that it is NOT the variable value that is shared between
> the thread group, it's the reference.  When I put ${__time(HMS)} in
> the __setProperty call and run the test, the "key" values are
> different between the two thread group.  Does anyone know how to pass
> a local-defined variable value using setProperty call?
>
>
> Test Plan (with 2 thread groups)
>
> Thread-Group1 (with 1 thread)
>> Dubug Sampler
>> BeanShell PreProcessor
>     Script:
>                ${__setProperty(key,${__time(HMS)})};
>         // USING TIMESTAMP
>                log.info("Group 1 key = " + ${__P(key)});
>          //2012/07/16 18:31:36 INFO  -
> jmeter.util.BeanShellTestElement: Group 1 key = 183136
>
>
> Thread-Group2 (with 2 threads)
>> HTTP Sampler
>> BeanShell PreProcessor
>     Script:
>                log.info("Group 2 key = " + ${__P(key)});
>           //2012/07/16 18:31:36 INFO  -
> jmeter.util.BeanShellTestElement: Group 2 key = 183119
>
> Note that it is not the same value being logged.
>
>
>
> Regards,
> Jacky
>
> On Mon, Jul 16, 2012 at 12:48 PM, Jomebrew <ai...@gmail.com> wrote:
>

-- 

Ing. Sergio Boso






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


Re: Sharing Variables Between Thread-Group

Posted by unjc email <un...@gmail.com>.
Guys, thanks for your replies.

I don't know if anyone have this experience.  I found that
${__setProperty}/${__P} pair would work between thread groups IF I use
constant value ("abc" like below example) or system variables (like
$__time(HMS). When I use a local variable ("tmp" as like in my
example) in the $__setProperty call, it doesn't work.

              tmp = "abc";
              ${__setProperty(key,tmp)};                           //
THAT DOES NOT WORK!!
              ${__setProperty(key,"abc")};
// THAT WORKS!!


I also found that it is NOT the variable value that is shared between
the thread group, it's the reference.  When I put ${__time(HMS)} in
the __setProperty call and run the test, the "key" values are
different between the two thread group.  Does anyone know how to pass
a local-defined variable value using setProperty call?


Test Plan (with 2 thread groups)

Thread-Group1 (with 1 thread)
> Dubug Sampler
> BeanShell PreProcessor
   Script:
              ${__setProperty(key,${__time(HMS)})};
       // USING TIMESTAMP
              log.info("Group 1 key = " + ${__P(key)});
        //2012/07/16 18:31:36 INFO  -
jmeter.util.BeanShellTestElement: Group 1 key = 183136


Thread-Group2 (with 2 threads)
> HTTP Sampler
> BeanShell PreProcessor
   Script:
              log.info("Group 2 key = " + ${__P(key)});
         //2012/07/16 18:31:36 INFO  -
jmeter.util.BeanShellTestElement: Group 2 key = 183119

Note that it is not the same value being logged.



Regards,
Jacky

On Mon, Jul 16, 2012 at 12:48 PM, Jomebrew <ai...@gmail.com> wrote:
> I documented how I do in a blog post a while back.  I still use this 100%
> of the time.  I run several instances on a machine in GUI mode and each
> instance has 250 users per thread group (two thread groups, same users for
> each group) for a total 500 threads/connections per instance.
>
> I think this was problem #2 for me in this post.
>
> http://www.jomebrew.com/2011/10/jmeter-random-transactions-and-sharing.html
>
> /Joe
>
> On Mon, Jul 16, 2012 at 8:50 AM, unjc email <un...@gmail.com> wrote:
>
>> Hello,
>>
>> I have two thread groups set up in my test plan.  The first test group
>> is for initializing variables for the test plan at start; it is
>> configured with a dummy debug sampler.  The second group is where the
>> actual test samplers are placed.  I try to pass the variables from
>> thread-group 1  via __setProperty to thread-group 2, but I always have
>> "void" value from __P calls.   Could someone please advise the proper
>> way to pass variables from one group to another?
>>
>>
>> Test Plan (with 2 thread groups)
>>
>> Thread-Group1 (with 1 thread)
>> > Dubug Sampler
>> > BeanShell PreProcessor
>>    Script:
>>               tmp = "abc";
>>               ${__setProperty(key,tmp)};
>>               log.info("Group 1 key = " + ${__P(key)});
>>
>>
>> Thread-Group2 (with 2 threads)
>> > HTTP Sampler
>> > BeanShell PreProcessor
>>    Script:
>>               log.info("Group 2 key = " + ${__P(key)});
>>
>>
>> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
>> started: Thread Group 1-1
>> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
>> started: Thread Group 2-1
>> 2012/07/16 15:47:32 INFO  - jmeter.util.BeanShellTestElement: Group 1 key
>> = abc
>> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
>> finished: Thread Group 1-1
>> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: Ending
>> thread Thread Group 1-1
>> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: All
>> threads have been started
>> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
>> started: Thread Group 2-2
>> 2012/07/16 15:47:32 INFO  - jmeter.util.BeanShellTestElement: Group 2
>> key = void
>> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
>> finished: Thread Group 2-1
>> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: Ending
>> thread Thread Group 2-1
>> 2012/07/16 15:47:32 INFO  - jmeter.util.BeanShellTestElement: Group 2
>> key = void
>> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
>> finished: Thread Group 2-2
>> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: Ending
>> thread Thread Group 2-2
>>
>>
>>
>>
>> Thanks,
>> Jacky
>>
>> ---------------------------------------------------------------------
>> 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: Sharing Variables Between Thread-Group

Posted by Jomebrew <ai...@gmail.com>.
I documented how I do in a blog post a while back.  I still use this 100%
of the time.  I run several instances on a machine in GUI mode and each
instance has 250 users per thread group (two thread groups, same users for
each group) for a total 500 threads/connections per instance.

I think this was problem #2 for me in this post.

http://www.jomebrew.com/2011/10/jmeter-random-transactions-and-sharing.html

/Joe

On Mon, Jul 16, 2012 at 8:50 AM, unjc email <un...@gmail.com> wrote:

> Hello,
>
> I have two thread groups set up in my test plan.  The first test group
> is for initializing variables for the test plan at start; it is
> configured with a dummy debug sampler.  The second group is where the
> actual test samplers are placed.  I try to pass the variables from
> thread-group 1  via __setProperty to thread-group 2, but I always have
> "void" value from __P calls.   Could someone please advise the proper
> way to pass variables from one group to another?
>
>
> Test Plan (with 2 thread groups)
>
> Thread-Group1 (with 1 thread)
> > Dubug Sampler
> > BeanShell PreProcessor
>    Script:
>               tmp = "abc";
>               ${__setProperty(key,tmp)};
>               log.info("Group 1 key = " + ${__P(key)});
>
>
> Thread-Group2 (with 2 threads)
> > HTTP Sampler
> > BeanShell PreProcessor
>    Script:
>               log.info("Group 2 key = " + ${__P(key)});
>
>
> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
> started: Thread Group 1-1
> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
> started: Thread Group 2-1
> 2012/07/16 15:47:32 INFO  - jmeter.util.BeanShellTestElement: Group 1 key
> = abc
> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
> finished: Thread Group 1-1
> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: Ending
> thread Thread Group 1-1
> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: All
> threads have been started
> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
> started: Thread Group 2-2
> 2012/07/16 15:47:32 INFO  - jmeter.util.BeanShellTestElement: Group 2
> key = void
> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
> finished: Thread Group 2-1
> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: Ending
> thread Thread Group 2-1
> 2012/07/16 15:47:32 INFO  - jmeter.util.BeanShellTestElement: Group 2
> key = void
> 2012/07/16 15:47:32 INFO  - jmeter.threads.JMeterThread: Thread
> finished: Thread Group 2-2
> 2012/07/16 15:47:32 INFO  - jmeter.engine.StandardJMeterEngine: Ending
> thread Thread Group 2-2
>
>
>
>
> Thanks,
> Jacky
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>