3
votes

In JMeter, I have a test plan with a thread group. The thread group has number of threads and a loop count which can be set in the gui.

Is there anyway I can figure out dynamically what they have being set so I can pass them to variable?

Thanks.

3

3 Answers

2
votes

You can parametrize the thread count defining a property like

${__P(users, 1)}

and if you run the test plan from command line, you can specify its value as -Jusers=XX. If, instead, you run the test from JMeter gui, to verify the text plan for example, the users property assume the default value of 1.
Don't forget to reference the property in the thread count, with ${users}.

3
votes

Use BeanShell PostProcessor with following code:

vars.put("threads", Integer.toString(prev.getAllThreads()));

Or maybe you just looking for this: http://code.google.com/p/jmeter-plugins/wiki/ActiveThreadsOverTime

1
votes

You should parameterize your thread count at TestPlan level settings, then use that parameter (variable) both in ThreadGroup and Listener.

If the value varies and you want to pass it from command line use __P() function instead of variable.