by Daniela Sztulwark
How do we use variables when there is more than one thread group in a test plan?
In the figure below we have a test plan containing two Thread Groups.

Before executing the test plan do not forget to set check-box “Run Thread Groups consecutively”. It is a must for executing Thread Groups one by one.
Let’s go to Regular Expression Extractor.
Result of Regular Expression will be stored in variable second_url. And now shuffle on over to BeanShell Assertion.

Note the interesting construction: ${__setProperty(second_url,${second_url})}.
- __setProperty() – is a built-in JMeter function that sets the value of a JMeter property. (A detailed description can be found here).
- second_url – name of the property that will be set.
- ${second_url} - is the variable that was stored in Regular Expression Extractor.
This is the line that is responsible for transferring the value between threads. From hereon out, the value of ${second_url} can be accessed from any other thread group.
How can we increase the value? Look to the second request in Second Thread Group.

To increase the property value, we use another JMeter function: __property().
It takes only one argument and the name of the property returns its value. A detailed description can be found here.
Got it? Good. Now let's execute the scenario!
Note that the second_url property value was set as Server Name. Great!
Knit one, pearl two. Bibbedy bobbedy boo.
Want to learn even more about JMeter, Performance and Load Testing?
Enter into our world of blazin' knowledge!
Are you a JMeter Guru looking for a flock?
Join our blazin' team

Add new comment