You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Erez Naim <er...@theneura.com> on 2015/05/10 11:15:45 UTC

communication between thread groups

Hello all,

 

I am building a script which contain json responses which from them I am
extracting a value which being used in other thread_group , in order to do
that I am using  Inter-Thread Communication PreProcessor and  Inter-Thread
Communication PostProcessor, I have noticed that there is no synchronization
between two of the thread - groups for some reason. I am getting errors, but
some of them are correct, what should I do to fix it? Maybe other  approach
of doing so. 

 

I have tried to use Beanshell pre and post processor (using setProperty and
property functions, gave me same errors). Any help on this will be
appreciated. 

 

BR,

 


Erez Naim  |  QA Lead  |
<http://www.linkedin.com/profile/view?id=34323263>
<http://www.theneura.com/vCards/gilad.vcf>
<http://twitter.com/#!/giladmeiri/>   




EL AL 2 Street | Herzliya  
mobile (+972) 50 9 555 686 | fax (408) 689.1366 | skype erez.neura

 


 <http://www.theneura.com/> website  |   <http://www.startupbitz.com/> blog
|   <https://twitter.com/intent/user?screen_name=theneura> twitter  |
<http://goo.gl/maps/ZRkg5> map    

 

 


Re: communication between thread groups

Posted by Flavio Cysne <fl...@gmail.com>.
Recently I had to create a script to test a Long-Polling HTTP request,
while also doing another HTTP request every 5 seconds. I added two Thread
Groups to the Test Plan: one for the authentication and the
5-seconds-repeating-request; another to the long-polling one.

I tried to use Inter-thread group communication components (pre and
postprocessor) but it didn't go as expected (probably I misused the
components). My second approach was to control the simcronization using
thread-specific variables such as jsessionid_${__theadNum()} and
stop_test_${__theadNum()}.

I passed the variables from one thread group to the other using a BeanShell
sampler. I passed jsessionid_${__threadNum()} and ${jsessionid} as
arguments and used the code "props.put(bsh.args[0], bsh.args[1]);" to share
the thread variables as properties.

The tricky part was to don't let the long-polling request be executed while
the jsessionid property, specific to that thread, isn't available. For that
I used a Loop Controller, looping forever, and inside it an If Controller
testing the property for unexpected values like empty, the default return
of the __P() function (when the property doesn't exist), the default value
when the expression extracting the jsessionid fails. And inside the If
Controller I put the Long-Polling HTTP request sampler.

P.S.: ATM I'm using my phone to answer your question, 'cause I can't use
gmail at work (damn firewall). When I get home I can share the Test plan.