In jmeter, How can manage the execution of thread groups - jmeter

There are 3 thread groups as threadGroup1, threadGroup2 & threadGroup3. now i need to execute the threadGroup1 - 1 time, threadGroup2 - 5 times & threadGroup3 - 10 times.
please suggest how can achieve above scenario.

As per Thread Group documentation:
Loop Count
Number of times to perform the test case. Alternatively, "forever" can be selected causing the test to run until manually stopped.
So set the following Loop Counts:
threadGroup1 - 1
threadGroup2 - 5
threadGroup3 - 10
Also you can control whether JMeter will execute all Thread Groups at the same time or consecutively upside down using "Run Thread Groups Consecutively" checkbox at Test Plan level
See Running JMeter Samplers with Defined Percentage Probability article for comprehensive information on running thread groups or individual samplers with different distribution values.

You need to set the loop count property.
Setting the loop count to 10 will execute the threadgroup 10 times.
-1 is forever.

Related

Running thread groups sequentially in Jmeter

I am trying to run a script with two thread groups each for multiple users. script looks like
Test Plan
Thread group 1 (10 users, ramp up period 5 sec and loop count 1)
Samplers
Thread group 2 (10 users, ramp up period 5 sec and loop count 1, thread startup delay 3 sec)
samplers.
both thread groups share some parameters. So I am using Inter thread communication plugin. My requirement is that for first user I want to run thread group1 and then run thread group2 . then start threadgroup1 for second user. Is this possible?
You cannot, an "user" belongs to Thread Group, they don't share any context.
User 1 of Thread Group 1 and user 2 of Thread Group 2 are different beasts.
Normally you should not be passing anything between thread groups, if you need - most probably the test is badly designed and you need to move Samplers under a single Thread Group.
If thread groups "share" some parameters - take a look at User Defined Variables
If thread groups "share" some test steps - take a look at Test Fragments and Module Controller

How i can be sure that JMeter is not using the same sample more than one time at same time?

I'm using JMeter to test my applications, and I desire to use the same sample N times.
For example, lets say I have 100 different samples how I'll use to test my Login, and want to use these samples 10 times.
I'm using 100 threads, and 10 loops for that.
How I can be sure that the second loop using a sample will start just after that the first loop of that sample has finished (and not have the same sample running simultanious)?
I'm having some troubles to understand how JMeter lead to this scenario.
JMeter acts as follows:
Each thread (virtual users) executes Samplers upside down (or according to the Logic Controllers)
When there are no more Samplers to execute:
-if there is > 1 loop in the Thread Group - the thread starts executing Samplers once again
if there are no more loops to iterate - the thread is being shut down
You can track which thread is executing which sampler by adding __threadNum() function to the sampler name. The Thread Group iteration can be tracked by adding the special JMeter Variable ${__jm__Thread Group__idx}
If you don't want user 1 and user 2 to execute sampler1 at the same time - put this sampler under the Critical Section Controller, but in this case you will not have any concurrency.

Introducing a delay between two thread groups in jmeter

I want to introduce some delay between two thread groups.
My test plan is-
Thread Group 1 -
a. Thread 1
b. Thread 2
c. Thread 3 (loop controller is added as a parent to thread 3. Loop controller is designed to run Forever)
Thread Group 2
My plan is to start thread group 1 and then start thread group 2 after some delay. Once both thread group have started they should keep on running. I need to introduce a delay between thread group 1 and 2.
I have tried 2 methods below, but they did not serve my purpose.
I selected Run Thread Groups consecutively from test plan, and introduced a test Action Sampler at the end of thread group 1 with
Target: All Threads
Action: Pause
Duration: 5000
and added Synchronizing Timer as a child of the Test Action sampler and set Number of Simultaneous Users to Group by to the number of threads (virtual users) in the Thread Group 1.
Simply added a Constant Timer before start of Thread Group 2.
What is a good solution for this?
Your solution 1 is very good however you need to add a Test Action sampler to the very beginning of the Thread Group 2 as your current setup assumes it running in the end of Thread Group 1 like:
Thread Group 1
Wait 5 seconds
Thread Group 2
Adding a Constant Timer between thread groups is absolutely not something you want to do as given you have the constant timer at the same level as Thread Groups it means the delay will be applied to each and every sampler. You need to move the timer to be a child of the first request of Thread Group 2. Timer will execute before the request which seems to be something you're looking for. See Advanced Load Testing Part 3 - Top 4 Timers article to learn more about timers use cases and best practices
And finally probably the fastest and the easiest solution would be setting a Startup delay for 2nd Thread Group. It can be done under "Scheduler" section:
as per the documentation:
If the scheduler checkbox is selected, one can choose a relative startup delay. JMeter will use this to calculate the Start Time, and ignore the Start Time value.

How to run multiple thread groups one after another for a particular period of time using scheduler in jmeter?

I am doing volume testing for an application for which I have to prepare a lot of a data using a jmeter script. So I want to automate the script so that it runs for a period of time specified.
My Testplan contains 10 Thread Groups:
ThreadGroup 1
ThreadGroup 2
ThreadGroup 3
.
.
.
ThreadGroup 10
What I have been trying is that I want my ThreadGroup 1 to run for 1st 30 minutes, then ThreadGroup 2 runs for next 30 minutes and so on till ThreadGroup 10 runs for last 30 minutes.
How can I achieve this configuration using scheduler in jmeter?
Any help would be appreciated.
Tick Run Thread Groups consecutively box in the Test Plan
In each of your Thread Groups specify "Duration" of 1800 seconds, Also make sure you have "Loop Count" set to Forever or -1 otherwise Thread Group will execute only this number of loops which is defined (by default 1)
This way your Thread Groups will run one-by-one and each Thread Group will last for 30 minutes.
Check out Getting Started with JMeter - A Basic Tutorial to get familiarized with JMeter essential components

RAMP UP in Thread Group of Jmeter

I have issue with setting ramp-up in jmeter.
My test scenario described below.
There are 3 thread groups:
Thread Group1 - 2 Users - Ramp up 10
Thread Group2 - 3 users - Ramp up 15
Thread Group3 - 5 users - Ramp up 25
Problem i'm facing with above scenario is the following.
First user of all the thread groups is kicked off at a same time.
But i don't want like that, i want the following:
In first 10 seconds, 2 users of first thread group should kick off.
After 10 seconds to the test, thread group 2 should kick off their users.
After 25 seconds to the test, third group should kick off their users.
I have seen one option in Jmeter that "Run thread groups consecutively" but if i set that thread group 2 will never start until thread group1 users should complete their requests execution.
jMeter Plugins' Ultimate thread group and Stepping thread group give you far more control over threads.
Add a startup delay to second and third thread group:
http://jmeter.apache.org/usermanual/component_reference.html#Thread_Group
This should do the job.
You can put anything in Start Time and End Time as these will be overriden by startup delay and duration.
Also note:
Start Time If the scheduler checkbox is selected, one can choose an absolute
start time. When you start your test, JMeter will wait until the specified start time
to begin testing. Note : The Startup Delay field over-rides this - see below.
Note particularly:
Note: the Startup Delay field over-rides this - see below.

Resources