You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by frank <hw...@windowslive.com> on 2012/08/29 10:42:19 UTC

use extraction result in other thread group

i have a test plan like next : 

Test Plan
     |__UDV
     |
     |__thread group 1
     |       |
     |       |__soap/xml-rpc request
     |                |
     |                |__xpath extractor
     |
     |__thread group 2
                |
                |__http request

i want to define a variable 'test' in UDV, then i want to extract something
from xml-rpc request and store the extraction result into the variable
'test' which defined in UDV, assume the extraction result is '123',

then i want to use the extraction result '123' in thread group 2, 

i defined the 'reference name' is 'test' too in xpath extractor, but
actually in thread group 2, the ${test} is not the extraction result,

so how can i do?  or is there any other solution?

Thanks in advance
     



--
View this message in context: http://jmeter.512774.n5.nabble.com/use-extraction-result-in-other-thread-group-tp5714575.html
Sent from the JMeter - User mailing list archive at Nabble.com.

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


Re: use extraction result in other thread group

Posted by Adrian Speteanu <as...@gmail.com>.
On Thu, Aug 30, 2012 at 5:16 AM, frank <hw...@windowslive.com> wrote:

> thanks for your reply, maybe as you said " due to synchronization, i can't
> get the new value in thread group 2 ".
>

read sebb's explanation, I was mistaken about how that variable is handled
in a different thread group.

>
> and sorry, i read the 'beanshell server', but i think it's not useful for
> me.
>
>
>
>
>
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/use-extraction-result-in-other-thread-group-tp5714575p5714587.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>

Re: use extraction result in other thread group

Posted by frank <hw...@windowslive.com>.
thanks for your reply, maybe as you said " due to synchronization, i can't
get the new value in thread group 2 ".

and sorry, i read the 'beanshell server', but i think it's not useful for
me.





--
View this message in context: http://jmeter.512774.n5.nabble.com/use-extraction-result-in-other-thread-group-tp5714575p5714587.html
Sent from the JMeter - User mailing list archive at Nabble.com.

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


Re: use extraction result in other thread group

Posted by Adrian Speteanu <as...@gmail.com>.
hi,

the variable defined in UDV and by post-processors is global and therefore
accessible in all threads. but due to synchronization, you might need it in
thread group 2 sooner then it is actually updated in thread group 1. this
is why you didn't get what you expected in thread group 2 and, btw, it is
normal behaviour.

if you actually need thread group 2 to synchronize with what is happening
in thread group 1, then you will need to add more logic to your test plan.
and if both thread groups have more then 1 threads active at the same time,
things will get really complicated. however, if this is the way you want to
do it, consider this (as it might be very useful):
http://jmeter.apache.org/usermanual/best-practices.html#beanshell_server

--Adrian S.


On Wed, Aug 29, 2012 at 11:42 AM, frank <hw...@windowslive.com> wrote:

> i have a test plan like next :
>
> Test Plan
>      |__UDV
>      |
>      |__thread group 1
>      |       |
>      |       |__soap/xml-rpc request
>      |                |
>      |                |__xpath extractor
>      |
>      |__thread group 2
>                 |
>                 |__http request
>
> i want to define a variable 'test' in UDV, then i want to extract something
> from xml-rpc request and store the extraction result into the variable
> 'test' which defined in UDV, assume the extraction result is '123',
>
> then i want to use the extraction result '123' in thread group 2,
>
> i defined the 'reference name' is 'test' too in xpath extractor, but
> actually in thread group 2, the ${test} is not the extraction result,
>
> so how can i do?  or is there any other solution?
>
> Thanks in advance
>
>
>
>
> --
> View this message in context:
> http://jmeter.512774.n5.nabble.com/use-extraction-result-in-other-thread-group-tp5714575.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
> For additional commands, e-mail: user-help@jmeter.apache.org
>
>

Re: use extraction result in other thread group

Posted by frank <hw...@windowslive.com>.
apc wrote
> 
> Take a look at this features:
> http://code.google.com/p/jmeter-plugins/wiki/InterThreadCommunication
> You can set up named inter-thread communication queues with it
> 

thanks, i tried, i think it's the same as ${_setProperty(,)} and
${_property(,)}, right?




--
View this message in context: http://jmeter.512774.n5.nabble.com/use-extraction-result-in-other-thread-group-tp5714575p5714616.html
Sent from the JMeter - User mailing list archive at Nabble.com.

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


Re: use extraction result in other thread group

Posted by apc <ap...@apc.kg>.
Take a look at this features:
http://code.google.com/p/jmeter-plugins/wiki/InterThreadCommunication
You can set up named inter-thread communication queues with it



-----
--
Andrey Pohilko
JP@GC Maintainer
--
View this message in context: http://jmeter.512774.n5.nabble.com/use-extraction-result-in-other-thread-group-tp5714575p5714594.html
Sent from the JMeter - User mailing list archive at Nabble.com.

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


Re: use extraction result in other thread group

Posted by frank <hw...@windowslive.com>.
sebb-2-2 wrote
> 
> Do you need to retrieve the value multiple times?
> 

sometimes, i need to retrieve the value multiple times, it depends on the
test plan which testers write.



> If so, why does it have to be in a separate thread group from where it is
> used?
> 

because the test plan which testers write has many test cases, and for me,
one test case correspond to one thread group, so maybe the extraction is in
a separate thread group, and the extraction result needs to be used in
another thread group.



> - How do you ensure that the thread groups run in the correct order?
> 
> Or fetch the value just once before the test starts?
> 

if i check 'Run Thread Groups consecutively' on 'Test Plan' control panel,
then the thread groups will run in the correct order.




--
View this message in context: http://jmeter.512774.n5.nabble.com/use-extraction-result-in-other-thread-group-tp5714575p5714615.html
Sent from the JMeter - User mailing list archive at Nabble.com.

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


Re: use extraction result in other thread group

Posted by sebb <se...@gmail.com>.
On 30 August 2012 03:28, frank <hw...@windowslive.com> wrote:
> thank you, i'm afraid i don't need setup thread group.

Do you need to retrieve the value multiple times?
- If so, why does it have to be in a separate thread group from where
it is used?
- How do you ensure that the thread groups run in the correct order?

Or fetch the value just once before the test starts?

> maybe ${_setProperty()} and ${_property()} is the only solution at present
>
> but i can't understand why we cannot use the new value of udv in other
> thread group, i think this is should be a normal scenario.

JMeter variables are local to the thread.
Threads represent independent users; they need their own variables.

>
>
> --
> View this message in context: http://jmeter.512774.n5.nabble.com/use-extraction-result-in-other-thread-group-tp5714575p5714588.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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: use extraction result in other thread group

Posted by frank <hw...@windowslive.com>.
thank you, i'm afraid i don't need setup thread group.
maybe ${_setProperty()} and ${_property()} is the only solution at present

but i can't understand why we cannot use the new value of udv in other
thread group, i think this is should be a normal scenario.



--
View this message in context: http://jmeter.512774.n5.nabble.com/use-extraction-result-in-other-thread-group-tp5714575p5714588.html
Sent from the JMeter - User mailing list archive at Nabble.com.

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


Re: use extraction result in other thread group

Posted by sebb <se...@gmail.com>.
On 29 August 2012 09:42, frank <hw...@windowslive.com> wrote:
> i have a test plan like next :
>
> Test Plan
>      |__UDV
>      |
>      |__thread group 1
>      |       |
>      |       |__soap/xml-rpc request
>      |                |
>      |                |__xpath extractor
>      |
>      |__thread group 2
>                 |
>                 |__http request
>
> i want to define a variable 'test' in UDV, then i want to extract something
> from xml-rpc request and store the extraction result into the variable
> 'test' which defined in UDV, assume the extraction result is '123',
>
> then i want to use the extraction result '123' in thread group 2,
>
> i defined the 'reference name' is 'test' too in xpath extractor, but
> actually in thread group 2, the ${test} is not the extraction result,
>
> so how can i do?  or is there any other solution?

JMeter variables are local to a single thread, not just a thread group.
Variables defined in a UDV are made available to all threads, but
changes are applied locally.

It's not entirely clear why the http request has to be in a separate
thread group from the soap request.
I assume that the soap request is needed to extract some setup
information that is then used in subsequent requests.

If so, then it sounds like you need a setUp Thread Group for the soap request.
Store the info in a property (using the __setProperty function):

http://jmeter.apache.org/usermanual/functions.html#__setProperty

This can be referenced in other thread groups using the __P() function.

> Thanks in advance
>
>
>
>
> --
> View this message in context: http://jmeter.512774.n5.nabble.com/use-extraction-result-in-other-thread-group-tp5714575.html
> Sent from the JMeter - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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