jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Flavio Cysne <>
Subject Re: communication between thread groups
Date Mon, 11 May 2015 12:56:04 GMT
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

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.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message