Hey all,
I often need to construct tests for a particular application service where I
need to test all the different API calls at a particular HPS for the server and
with the correct distribution of API calls. For example, applicationA supports
calls for call1, call2 and call3. I need to simulate 80 HPS for the server
between all three calls. call1 is 50% of the traffic, call2 is 25% of the
traffic and call3 is 25% of the traffic. In the past I have hard-coded these
distributions by using the throughput controller and setting an appropriate
percentage for each call. The problem is that production distributions can
change over time as features change, requiring the tester to calculate new
percentages and update the tests. Ultimately, I'd like our JMeter scripts to
have the ability to, at runtime, get the latest distributions from production
and use that in the test. To enable this, I need to be able to
programmatically set the throughput percentages rather than having it
hard-coded.
To this end, I thought to use properties. I have a Setup ThreadGroup that uses
a groovy script to set properties that represent each sampler target
distribution. The throughput controllers then reference their specific
distribution property. For example, the groovy script will set a property for
"call1distribution" to "100". The throughput controller that contains the
sampler for call1 would have its value set to
"${__property(call1distribution)}. However, when I run the script, it appears
that property values added after the loading of JMeter do not get picked up by
subsequent threads. That is, these property values are set in the Setup
ThreadGroup, but do not appear to be visible to the main ThreadGroup that
follows. Am I doing something wrong or is this a limitation of JMeter? If a
limitation of JMeter, is there some other way to set the value of a throughput
controller at runtime based on values calculated during the Setup ThreadGroup?
Thanks,
Glenn