Monday, January 20, 2020

Share variables between thread groups

I was not able to do this with variables (since those are local to individual threads). However, I was able to solve this problem with properties!
Again, my first ThreadGroup does all of the set up, and I need some information from that work to be available to each of the threads in the second ThreadGroup. I have a BeanShell Assertion in the first ThreadGroup with the following:
${__setProperty(storeid, ${storeid})};
The ${storeid} was extracted with an XPath Extractor. The BeanShell Assertion does other stuff, like checking that storeid was returned from the previous call, etc.
Anyway, in the second ThreadGroup, I can use the value of the "storeid" property in Samplers with the following:
${__property(storeid)}
Works like a charm!

No comments: