Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jmeter - weighted random values?

How can I go about running tests/controllers based on random weight? For instance, have two tests, one with a weight of 25%, the other with 50%. The one with 50 should run twice as often.

Perhaps throughput controller mixed with random somehow?

like image 640
Dominic Bou-Samra Avatar asked Mar 30 '11 04:03

Dominic Bou-Samra


2 Answers

I think you can use Throughput Controllers configured someway like the following:

Throughput Controller

Throughput values are pre-set, either from configuration properties or generated in acceptable range of values (0..100 in this case).

like image 73
Aliaksandr Belik Avatar answered Oct 24 '22 16:10

Aliaksandr Belik


For some simple weightings you can use the fact the switch controller defaults to the first child to your advantage. Eg 50% 25% 25% like so

Switch Controller - ${__Random(0,3)}
 - Child 0 (and 3)
 - Child 1
 - Child 2
  • http://jmeter.apache.org/usermanual/component_reference.html#Switch_Controller
  • http://jmeter.apache.org/usermanual/functions.html#__Random

You take this one step further by grouping tasks in Random and Simple controllers as the children.

like image 30
KCD Avatar answered Oct 24 '22 14:10

KCD