On Fri, May 13, 2011 at 9:00 AM, sebb <seb...@gmail.com> wrote: > On 13 May 2011 15:49, Janine DeBeradinis <jdeberadi...@higherone.com> > wrote: > > Hello Again - > > > > I have another question regarding passing variables in JMeter between > different thread groups in a test plan. It looks like if a variable is > defined on the Test Plan itself, all Thread Groups have access to that > variable. If a variable is defined as a User Defined Variable, then only > the Thread Group that defined that variable has access to that variable (no > other Thread Groups can see that variable). Is my understanding correct? > > Yes, you have understood the scope correctly. > > Howver, note that variable values are local to a thread. A thread that > changes the variable will only change it for that thread. > > I have a sampler for that ;-)
You can attach a reference to a java object to a jmeter variable if you're so inclined. It takes a little trickery, but then you can do things to it in all threads. I suggest meditating on the design of your test if it's this complex though. Sometimes it's the right thing to do, sometimes there's a more simple way to go about it. > > Also, if you have two thread groups in a Test Plan, and thread group one > calls another test with an include controller, and gets some variables back > from that test via an XPath Extraction, the second thread group in the Test > Plan does not have access to those variable. It this understanding correct? > > Not sure what the include controller has to do with it. > Otherwise same as above. > > Well the include controller, you see, in some jmeter versions, will include a thread group if you save your test like a regular test in the thread group. I'm pretty sure jmeter 2.4 removes the test plan and thread group node from the included test, but previous ones will run the included test in a different thread group. So I could see that it could potentially make a difference whether the include controller was used or not. In any event, as you said, jmeter variables are local to the thread, so changes made in other threads will not be seen in your current one (Barring trickery :-) -- Bruce Ide flyingrhenqu...@gmail.com