Jmeter - load testing multiple thread groups consecutively - jmeter

I have 1 thread group with 4 HTTP requests, each using separate csv to get input(json).
I want to run load testing with 100 users for 10 loops for all of them.
Expected result: run HTTP request 1 for 100*10 times then move to HTTP request 2 and run 100*10 times and so on.
First HTTP request is provided with correct values and second with incorrect values, So first HTTP request gives 0% error and 2nd thread gives 100% error.
Issue: While running thread, 2nd HTTP request is also giving 0% error instead of 100% as it is somehow picking values from same csv as the first HTTP request(they both have separate CSV data set config with separate csv files having different data), while they are working fine individually.
My test plan
CSV Data Set configuration

In the same Thread Group all threads will be running simultaneously, there's no configuration option that would allow HTTP requests in the same thread group to run sequentially. So you can fix it in one of the following ways:
Put each HTTP request in its own Thread Group, and use Run Thread Groups Consecutively option
Thread Group 1
HTTP Request 1
Thread Group 2
HTTP Request 2
...
Use controllers and timers to get each HTTP request executed in loop and all threads to wait before starting the next one:
Thread Group
Loop Controller <-- set Loop Count to 10
HTTP Request 1
Synchronizing Timer <-- set Group by parameter to 100, so you wait for all threads to finish with first loop
Loop Controller
HTTP Request 2
Synchronizing Timer
...

Related

Jmeter concurrency issue for a Thread of 7 Users

I have 1 thread Group, Within that I have 5 HTTP Request calls. 1st HTTP Request returns a value & that value is used in rest 4 HTTP Requests. The Thread Group Set Up with Number of Thread (Users) : 7 & Ramp-Up period : 5 & Loop Count : infinite. When I run the thread group it breaks due to concurrency.
Example:
When User Thread 1 executes -> Request 1,
Thread 2 executes -> Request 2 (It expects a value from Request 1, Which has not happened for thread 2, Hence it breaks).
Please find the Jmeter SetUp Images below,
Thread
HttpCookieManager
I am new to Jmeter please help me in this.
Each JMeter thread (virtual user) executes Samplers upside down (or according to the Logic Controllers
JMeter Variables are local for the thread (virtual user)
So there is no option that Thread 1 executes Sampler 1 and Thread 2 executes Sampler 2, all users will be executing all Samplers sequentially, it can be checked using __threadNum() function:
So my expectation is that either your extractor fails or Sampler 1 execution by Thread 2 fails somewhere somehow, check the requests and responses using View Results Tree listener, the JMeter Variables using Debug Sampler and jmeter.log file for any suspicious entries.

How to run multiple http requests sequentially multiple times

I'm using jmeter for testing. I have 1 thread group setup and multiple http requests under that thread group. Jmeter will run those requests sequentially. But how do I get them to run sequentially multiple times?
My setup is as follows:
Thread Group
-http request 1
* variables
* save file
* results tree
-http request 2
* variables
* save file
* results tree
-http request 3
* variables
* save file
* results tree
I want jmeter to run them multiple times in order. For example I want them to run twice. So I want request 1 to run, then request 2 and then request 3. Then I want request 1 to run, then request 2 and finally request 3.
jmeter test plan
updated test plan
http request defaults
http request defaults variables
http request 1
http request 1 variables
http request 2
htpp request 2 variables
Put the loop count to 2 in the thread group and then it will run in sequence twice.
Please check below:-
Updated:-

Jmeter: Parallelly running Thread Group execution gets delayed

I have 3 Thread Groups: Setup Thread Group, Thread Group 2(which has the http request which does the download of the file), Thread Group 3 under a single Test Plan. The thread count=3 for each. The checkbox 'Run consecutively' is deselected in the Test plan.
The Setup thread group has all the pre-requisite requests which are needed to be executed prior to Thread Group 2 and 3. The Setup Thread Group(having multiple https requests) writes some authentication tokens to 2 different csv files which will then be utilized by the other 2 thread groups respectively when they get executed in parallel at later point of time. So, csv file1 will be used by Thread Group 2 and csv file2 will be used by Thread Group 3.
First, the Setup Thread Group gets executed.Then the Thread Group 2 and Thread Group 3 get executed in parallel. Everything seems fine when all of the threads of Setup Thread Group get the successful response:200.
But when there is any erroneous response like 500 in one of the Setup Thread Group thread Response, the csv files get less number of entries(which is fine); and the Thread Group 2 and Thread Group 3 do not run in parallel. The Thread group 3 runs first. Then after some time gap, the Thread group 2 runs. What's the cause and resolution for this problem?
1) Set Up Thread: Extract the response code or any response message of the Last sampler of the Set Up Thread.
2) Before proceeding Thread group 2 or 3 add some constant time and a BSF pre-processor. validate the condition of the extracted value(either response code/response message).
If the anticipated value is found, proceed with Thread group 2 and 3.
If not Add some constant time within the BSF(define a condition).
3) do the simlar approach, to wait for Thread Group-3 to ensure Thread Group-2 has ran succesfully.

without using only once controller,i want the login request to be executed once

I am trying to do the load testing of the pages which can be access after login only.
As I am using Once Only Controller for login request ,when I changed Number of thread- 5 or more,login executes 5 times.
as Once Only Controller works for loopcount so I used loopcount but it slowdown my process and it executes the whole testplan.
My test-plan is:
login thread A- one time execution - how to do it?
http request B- multiple times(by using Number of threads)
http request C- multiple times(by using Number of threads)
What should I use for one time login execution and other successor requests needs to be executed multiple times without using Once Only Controller?
Kindly follow these steps:-
In Thread Group put number of threads:5 , Ramp-up:0 , Loop count: 1
Put your Login part in Once only controller
Right click on Your thread group > add > logic controller > loop controller
Now put your http request part in loop controller and set loop count of loop controller how many times you want to run
Then run the test you will get whatever you want
The Loop count in "Thread Group" is your full script Loop count not for your Transactions, for your transactions you have to put separate loop count before transaction starts.
Please do below
Your thread group setting should be below:
A.Number of threads :1
B:Ramp up period : 0 or as per application response.
C:Loop Count :5
Put your login request under Only once controller.
Request B and Request C should be at thread group Level.ie one step above it.
Run the request.
please find Sample Jmxsample Jmx for your reference Plse try. Hope it resolves your issue.

JMeter - Firing different requests in every iteration

I am currently using JMeter to simulate 5 users firing requests every 40 seconds. I have created 100 different requests but after every 40 seconds, each user is firing all 100 requests. I want to make it in such a way that after every 40 seconds, each user only fires 1 request and that request has to be different from the previous request. I would like to know what kind of controller to use (or anything else) to achieve this scenario.
Thanks
Try to use Random Controller.
The simplest way to implement your scenario:
Thread Group
Number of Threads = 5
Loop Count = N
. . .
Random Controller
HTTP Request 001
HTTP Request 002
HTTP Request 003
. . .
. . .
HTTP Request 100
Test Action
Target = Current Thread
Action = Pause
Duration = 40000
. . .
This will iterate 5 threads N times.
Random Controller will RANDOMLY pick up on each step http request from "requests pool" - all the samplers added as children to Random Controller.
Test Action will pause thread for 40 secs.
Updated:
working illustration for above scheme:
Thread Group
Number of Threads = 5
Ramp-Up Period = 0
Loop Count = 10
Constant Timer
Thread Delay (in ms) = 40000
You can download working example for described scheme from here: rc-plan.jmx.
This one works how you want (at least for me, Jmeter 2.5.1): it picks randomly ONE request from requests pool (in example - 10 requests) for EACH user (here - 5 users) on EACH step (here - 10 loops) and pauses each thread for 40 secs (Constant Timer).
You can also look into this mailing archive: Is their a way to randomize URL selection?.
Situation similar to your one seems to be described here.
...As per official documentation "Interactions between multiple controllers can yield complex behavior. This is particularly true of the Random Controller."
Another option for you may be to create a CSV file with parameters for your requests ahead of time and use CSV Data Set Config to parameterize a single http request.
That obviously depends on how different your http requests are, but if it fits your requirements there are some potential bonuses with maintaining 1 http request in your test plan vs. 100.
The other details would be the same as #Alies Belik laid out -- one thread group configured for your required number of threads and loops, with a constant timer at the end for your 40 second pause.

Resources