Simultaneous requests in JMeter - jmeter

Assume I have two users in Thread Group and want them to fire two requests simultaneously. User 1 - HTTP Request A and User 2 - HTTP Request B.
Any ideas how to implement that ?

To trigger the requests simultaneously, you need to place your each requests in different thread group as shown below.
Also, make sure that in the Test Plan, below option is unchecked.
Above settings will execute the request simultaneously. Below is the sample output.

Just add Synchronizing Timer to your Thread Group and set Number of Simulated Users to Group by to 2 like:
The Synchronizing Timer will pause the first thread until second one is ready to execute the HTTP Request sampler so both threads will be run simultaneously. See Using the JMeter Synchronizing Timer article for more details.

Related

How to handle scenario dependency in Jmeter?

Using a ''requester'' role, I need to execute a scenario that will send a notification to another role to perform other actions. This scenario will act like a trigger of other two.
After all the notifications are sent (+100) I have to execute another two scenarios, for which 50 requests will be approved and 50 will be rejected.
How can I execute this scenario in such a way that the trigger scenario finishes first, so then I can perform the other two scenarios?
A timer can help for this case without affecting the load?
If you have all requests under the same Thread Group you could use a Flow Control Action sampler and Synchronizing Timer combination.
Add Flow Control Action sampler as the last sampler of the "requester" scenario (whatever it means) and set the "Number of simulated users to group by" to be equal to the number of threads in your Thread Group.
If "scenarios" are spread between different Thread Groups - take a look at Inter-Thread Communication Plugin.

How to execute requests sequentially running multiple JMeter Threads

I have a single thread group which has 3 requests and have set the Number of Threads(users) = 2.
I would like all the requests to be executed in sequential order for each user before it repeats these steps for the next user and so on.
Output expected:
HTTP Request 1_Thread 1
HTTP Request 2_Thread 1
HTTP Request 3_Thread 1
HTTP Request 1_Thread 2
HTTP Request 2_Thread 2
HTTP Request 3_Thread 2
However, the output results vary differently for each run and are not in the order I expect. How can this be corrected?
I have tried following but with no luck in achieving my output
1. Enable/disable "Run Thread Groups consecutively
2. Running the test in non-GUI mode
I have attached a screenshot as an image as I am not able to embed into this message yet.
Appreciate if anyone can help me with this query
Thanks
Output Screenshot
For execution of Sampler Request by only Single Thread at a time use Critical Section Controller.
For more info about Critical Section Controller Critical Section Controller
The Critical Section Controller ensures that its children elements (samplers/controllers, etc.) will be executed by only one thread as a named lock will be taken before executing children of controller.
Critical Section Controller takes locks only within one JVM, so if using Distributed testing ensure your use case does not rely on all threads of all JVMs blocking.
Practical Example:
Place all your request under Critical Section Controller
Run the test for any number of Threads you want
Observe the Result in View Results Tree
Note : If you want to run it sequentially from 1 thread to N, make sure you provide Ramp Up Period properly.

How can i make jmeter run all thread group before repeat?

I have a thread group with 2 http requests, the first one is for the user to log in and have two regular expression extractor so I can extract the credentials.
the second http request should use those credentials in the header.
This is all working except that jmeter is executing all login requests, and after that executes the second request.
I was expecting the login request to execute and after that the second request, and then repeat the whole thing.
Any sugestion?
If you just want to repeat your test flow set in Thread Group
Each thread will execute the test plan in its entirety and completely independently of other test threads. Multiple threads are used to simulate concurrent connections to your server application.
Number of Threads = 1 and Loop Count with the number of times you want to repeat.
This way you will execute the samplers sequentially.
If you set Number of Threads above 1 it will execute test flows in parallel, if you need it you will have to use Synchronizing Timer.
The purpose of the SyncTimer is to block threads until X number of threads have been blocked, and then they are all released at once.

Run Multiple requests of single thread group concurently

I want to simulate a scenario in which a page contains multiple requests for differ data. All runs concurrently. I created a Thread Group with all those requests and ran it for 10 users(Threads) in 0sec ramp up time. But in this Test Plan all users starts concurrent but they all process requests in sequential way i.e.(always completes first request then starts 2nd,then third,so on).
I want that all requests of each user starts at same time then completes according to their response time (Like if 3rd takes less time than first then it should complete before 1st and 2nd). I have tried Synchronize time.
I don't think it is possible at the moment, the relevant enhancement is being tracked as Bug 53159
In the mean time you have 2 options:
Use different Thread Groups to kick off the requests. If you need to synchronize the requests you can use i.e. Inter-Thread Communication plugin.
Develop some custom code using JSR223 Sampler or even create your custom sampler, see How to Load Test AJAX/XHR Enabled Sites With JMeter for details on how this can be done.

How to send the consecutive requests in JMeter?

How to send the consecutive HTTP requests in JMeter? The consecutive requests means that the new request will be sent after the previous one's respond arrived.
Simply set "Run Thread groups consecutively" check-box in the Test Plan element's (root element) details enabled.
This is default JMeter behavior within a single thread group.
If you have multiple thread groups, you can set the groups to run Consecutively or Concurrently by modifying the Test Plan options.

Resources