top of page

JMeter Tutorial

JMeter Thread Group

What Is Thread Group In Jmeter ?

Thread group is the basic element of the JMeter test plan. It is a group of threads that are executing the same scenario and it is a sarting point of any test plan. Furthermore, a thread group holds other test elements like controllers, samplers, timers, config elements and also listeners. Each thread group independently executes all the elements under the thread group while running the test plan.

A number of threads(users) can be defined in a thread group where each thread simulates a real user requesting to the server under a test.

Here is the control panel of a thread group --




What are the Components of a Thread Group ?

The components of the thread group are comprised on its control panel, some of them are following :

  • Name

  • Comments

  • Action to be taken after a Sampler error

  • Thread Properties

    • Number of Threads(users)

    • Ramp-up period(seconds)

    • Loop Count

    • Same user on each iteration

    • Delay Thread creation until needed

    • Specify Thread lifetime

Name

This label is for specifying the name of a thread group. We can provide a name to our thread group by filling this field.

Comments

This is a non-executable part of the test. We can provide some description about our task under this component.

Action to be taken after a Sampler error

This part specifies an action that can be taken by a user when any error occcurs in Sampler. The actions to be taken are following :

  1. Continue - It is a default selected option that allows to continue to the next element when an error occurs.

  2. Start Next Thread Loop - It means stop this thread group and start executing next thread group of the test plan.

  3. Stop Thread - It stops the current thread.

  4. Stop Test - It means to stop the whole test completely if an error occurs.

  5. Stop Test Now - It also stops the entire test but forcefully.

Thread Properties

Thread properties can be specified, following are its properties :

  1. Number of Threads(users) - This is a count of threads. Each thread simulates a virtual user that are expecting to connect to the server. By default it is set to '1'.

  2. Ramp-up period(seconds) - It defines the time in which JMeter fetches the number of threads into the running state. The time would be in seconds and by default it is set to 1 second.

  3. Loop Count - It is the count of loop that defines the number of times each thread to be executed. Suppose, the number of thread is 2 and the loop count is 4 then thread one will be executed 4 times and of course thread two will be 4 times, hence 2*4=8 times the task will be performed. By default, the value is set to '1' and if you want to run your thread forever then just select the checkbox for 'Infinite'.

  4. Same user on each iteration - By default, this is checked.

  5. Delay Thread creation until needed - This is to be checked when the ramp-up delay and startup delay are to be performed even before the thread group is created. By default, this is not checked.

  6. Specify Thread lifetime - Here we can give the duration and startup delay to the threads.

How to Add Thread Group to Test Plan ?

To add a thread group, follow the given steps :

  • ​Launch JMeter by executing ' bin\jmeter.bat '.

  • When the GUI opens, it will initially show a test plan node.




  • Right-click on the test plan to select the options as : Test Plan >> Add >> Threads(Users) >> Thread Group as shown in below screenshot  -




  • Now, you can see the thread group is reflected under your test plan.





Refer next page JMeter Sampler

bottom of page