2
votes

I am trying to run http samplers sequentially for multiple requests. Where the output of 1 API response is the input of next API request. My concern is when I run with 5 users (for. e.g), then at given point of time it first executes 1st API with 5 users then second API with 5 users, in this process the API where input is required gets lost. Please help me on this. I need a solution, where all the samplers are first executed for first user, then for second thread all the samplers are executed and so on.

4

4 Answers

2
votes

Dzizu is correct, threads are independent so you are going to run into problems with this approach.

Since you are using 5 users across the test, it would be better to have one thread group with 5 users, and then have Simple controllers (or Transaction controllers) that hold the HTTP samplers and whatever else you are using. This will ensure that the samplers are executed concurrently, but they can still share data if required.

Simple example below:

Sample Jmeter Test Plan

0
votes

Threads usually are independent. The easiest way in my opinion is to put full process in one thread and then multiply threads in thread groups.

0
votes

Eventually I tried to solve this by using loop count option. For example if I want to simulate 5 users in 1 second, I set values as loop count=5,threads=1,ramp-up=.2.
This worked for me so give it a try.

enter image description here

0
votes

Use the Transaction Controller or Simple Controller to group your samplers together and run them in sequence without worrying about the number of threads. For me, it is working as expected :).

adding transaction controller

management