How do I pass a variable from one Thread Group to another in JMeter

后端 未结 9 1622
星月不相逢
星月不相逢 2020-11-27 04:54

I have a JMeter test with 2 Thread Groups - the first is a single thread (which creates some inventory) and the second has multiple threads (which purchase all the inventory

9条回答
  •  南笙
    南笙 (楼主)
    2020-11-27 05:17

    JMeter Bean Shell Assertion

    Just add a bean shell assertion use a property function to assign the value to a variable (like a global variable) which will hold the value even after it goes to other thread.

    thread group >> Add >> Assertions >> Bean Shell Assertion

    ${__setProperty(Global_variable_Name,${Variable_name_whose_Value_to_be_Passed})}
    

    and then in the other thread you can to call this global variable and can use it

    below is the function you need to use to call the stored value:

    ${__property(global_variable_name)}
    

    https://medium.com/@priyank.it/jmeter-passing-variables-between-threads-a4dc09903b59

提交回复
热议问题