Thread Group in JMeter
As we know JMeter is a pure Java-based desktop tool to conduct load and performance testing. There are various test plan elements in JMeter like Thread group, controllers, listeners, timers, etc. In this article, we are going to learn about the Thread group element of JMeter.
Thread group is the basic element of the Jmeter Test plan. As said in the name Thread group is a group of threads that are executing the same scenario. This is considered the beginning point of a test plan. Thread group holds other test elements like controllers, samplers, config elements also the listeners. Each thread in the thread group will independently execute all the elements under the thread group while running the test plan. Here is the control panel of the thread group element.
Components of a Thread group
We can name the Thread group according to our test’s requirements.
Action to be taken after a Sampler error: These are the actions that can be taken by the user if an error occurs in any sampler. By default, this is set to Continue. let us see what all are the options that actually can be used
- Continue – To continue with the next element
- Start next Thread loop – which means stop this Thread group and continue with other thread groups of test plan
- Stop thread – To stop the current Thread
- Stop Test – If any error comes stop the test completely
- Stop Test Now – This is almost the same as above which means to stop the test immediately.
- Number of Threads – This is the count of virtual users that we are expecting to connect to the server. For example, if we give 5, Jmeter will simulate 5 virtual users that connect to the server and perform the same steps given. By default, it is set to 1 thread.
- Ramp-Up Period – This can be defined as the time in which JMeter can bring the number of threads mentioned above into the running state. This is given in seconds. For example, if we want to give 2 minutes we should enter 120 in the blank. By default, it is set to 1 second.
- Loop Count – This indicates how many times each thread was supposed to perform the task. If the number of threads is 4 and the loop count is 2 then the same task will be performed 8 times. If this value is set to infinity the task will continue to run until the test was stopped. By default is value is one iteration.
- below these properties, there are a few checkboxes among which “same user on each iteration” is checked by default.
- 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.
- Specify Thread lifetime – Here we can give the duration and startup delay to the threads.
Note: In all properties of the thread group the time is taken in seconds, not in minutes or milliseconds.
How to Add Thread Group to Test Plan?
Before we learn completely about thread groups, let us quickly see how to add thread groups to a test plan.
- Launch JMeter by executing bin\jmeter.bat file
- When the application opens you can initially see the test plan as shown in the following image.
- In the select test plan and give a right-click, you can see a lot of options following add. Now click on add which shows many options following Thread then select thread now we can find the Thread group option. Finally, select the thread group. In short, the path is like this Test plan >> Add >> Threads( users) >> Thread Group as shown in the image.
- Then you can see the thread group is added to the test plan.
Please Login to comment...