Raxon
Raxon

Reputation: 33

In Jmeter, how to run either of one Http request from 2 Https request samplers?

I have 3 HTTP requests in total. I need to run the 1st request every time. After 1st request is executed, I need to run request 2 or request 3. Request 2 should run only for 25% of time and rest 75% is Request 3.

How do I achieve this scenario in Jmeter for single user.

Upvotes: 0

Views: 439

Answers (2)

Dmitri T
Dmitri T

Reputation: 168147

The buitl-in option is using 2 Throughput Controllers

enter image description here

a little bit more handy solution is going for the Weighted Switch Controller plugin, this way you will avoid copying and pasting

enter image description here

Upvotes: 2

Singularity
Singularity

Reputation: 34

You can try with a counter (from 1 to 4) and if clause. Example:

  • If Counter == 1 => execute Request 2, else (3,4,5) - skip executing of Request 2;
  • If Counter == 3,4,5 => execute Request 3, else (1) - skip executing of Request 3.

But in this case you'll have the same requests executed every time. You have to think about some kind of randomization, but in that case sometimes some of the requests can be executed more frequent, sometimes not... It's up to your needs.

Upvotes: 0

Related Questions