1

I Have 5 HTTP request in single thread, I want to run first request multiple times and then other request only single time

I can't use multiple thread as all request are depends on each other.

2 Answers 2

3

Depending on what you're trying to achieve:

  1. Put the request which needs to be run only once under Once Only Controller, this way the Sampler will be executed only during first iteration of the Thread Group

    enter image description here

  2. If you want more complex/flexible criteria - put the request which needs to be executed only once under the If Controller, this way you will be able to specify whatever criteria you want. For example if you want to run a Sampler only during 5th iteration use the following condition:

    ${__jexl3("${__jm__Thread Group__idx}" == "5",)} 

    enter image description here

    this way the sampler(s) which is (are) under the If Controller will be executed only if the condition is met:

    enter image description here

Sign up to request clarification or add additional context in comments.

Comments

1

Put first request under Loop Controller with Loop Count as the times you want to repeat

JMeter will loop through them a certain number of times, in addition to the loop value you specified for the Thread Group. For example, if you add one HTTP Request to a Loop Controller with a loop count of two, and configure the Thread Group loop count to three, JMeter will send a total of 2 * 3 = 6 HTTP Requests.

Choose request(s) you want to execute multiple times and then:

Right Click -> Insert Parent -> Logic Controller -> Loop Controller

4 Comments

Loop Controller can be added for the entire thread, not for the particular request, Can you please tell how to add loop controller for particular http request
@Rock Right Click -> Insert Parent -> Logic Controller -> Loop Controller
Thank you very much user7294900,It solved my problem and got the solution but I have the scenario where I have 10 http request, first request should run single time and other 9 request should run muliple times, Now If I pass No. of thread 100 then also my first request should run single times and other 9 request should run 100 times, please help in this.
@Rock similarly you can mark multiple requests and insert Loop controller as parent

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.