I want to create JMeter script in which some API calls are made only after the response to the API calls which it is dependent upon is received successfully. Is it possible in JMeter? And if yes then please let me know how?
To determine whether previous sampler was successful or not you can use If Controller and the following condition:
${JMeterThread.last_sample_ok}
Something like:
- Request 1
- If Controller with the above condition
- Request 2
- Request 3
Assuming the above configuration
Request 2
will be executed only ifRequest 1
is successful.Request 3
will be executed alwaysIn regards to adding a delay between requests there are 2 ways:
- Test Action sampler in
Pause
mode. It doesn't generate sample result and you can use it for pausing thread(s) between request - JMeter provides variety of Timers. Timers respect scoping rules and produce delay before sampler(s) in scope is(are) executed.
- Test Action sampler in