jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruce Ide <>
Subject Re: Setting a varaiable on a thread group stopping
Date Fri, 06 May 2011 20:42:32 GMT
I usually set variables with a BSF sampler and groovy --
vars.put("variablename", "value");

Variables are thread local so if you're running more than one thread you'll
need a different strategy.

I always have to stop and think if I really want to do something as a thread
when I'm writing tests. They often make things much more complicated and a
lot of the time you can use a loop instead. You can group code into simple
controllers inside your loops, which make it easier to read at a high level.

If using threads is how you want (or need) to do it, I have a couple of
jmeter plugins for thread sync and (very) basic cross-thread data sharing at that might come in handy. If you're got
Jmeter 2.3.4 or 2.4 you should be able to install them by dropping the jar
files in  your jmeter lib/ext directory, or you can try to build them from
source if you want to.

My thread-sync plugin could be used to insure that your setup thread runs
prior to your test threads. If you have 3 test threads in different thread
groups, you could create a thread sync data element and set its starting
value to 3. Then you'd put a thread sync sampler at the start of  your test
threads and at the end of your setup thread. When it runs, the first two
threads will decrement the counter to 1 and go to sleep. When the setup
thread hits the sampler, it'll decrement to 0 and wake the sleeping threads.

Bruce Ide

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message