How to Transfer/Refer Jmeter Variables from one Thread Group to another Thread Group?

In many situations, we encounter in referring the variables from one thread group to another. Even I found myself every time I end up in searching for the solution. Finally, I have decided to write it here, there are many ways to transfer variables, I preferably choose the following method.

1) Set up Thread Groups
2) Add a “BeanShell Assertion” to the sampler where you are extracting the value
3) In the Script area of BeanShell Assertion specify as
${__setProperty(SG_Id2,${SG_Id1})} where SG_Id2 is a variable in which we are storing the value of
SG_Id1 , so that we can refer this value anywhere in the testplan across all the thread groups.
4) Now go to next Thread Group sampler where you want to pass the value and give as
5) Now run the test and check the value passed from one thread group to another thread group


  1. Thanks lot sir

  2. Where do we add this Bean shel Assertion after the value is generated or before? Also is there anything more to do as this doesnot work?

    • Sandeep Sadanandan

      March 6, 2017 at 2:11 pm

      It depends when you need the variable after the request for the next sampler or before it gets called (Pre/Post). can you give more details, if it is still not resolved.

  3. Shivani Shukla

    April 13, 2018 at 5:10 pm

    thanks a nice solution and nicely explained

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

© 2018 technix

Theme by Anders NorénUp ↑