Thread Group in JMeter Test Plan

 Thread Group in JMeter Test Plan

Thread Group elements are the beginning points of your test plan. As the name suggests, the thread group elements control the number of threads JMeter will use during the test. 

Thread Groups is a collection of Threads. Each thread represents one user using the application under test. Basically, each Thread simulates one real user request to the server.

We can also control the following via the Thread Group −

  • Setting the number of threads
  • Setting the ramp-up time
  • Setting the number of test iterations

"Action to be taken" , no. of concurrent user, Ramp-up time b/w 2 or more thread are the important part of Thread Group.

What is Thread Group in JMeter?

A Thread Group is a set of threads executing the same scenario. Set the number of iterations in the configuration. Thread behaviour is defined according to ramp up and destroyed once the number of iterations per thread has elapsed. This is how a Thread Group Element looks:


Thread Group elements are the initial steps of JMeter Test Plan. A number of threads(users) can be defined in a Thread Group. Each thread simulates a real user requesting to the server under a test.

If you set the number of threads as 10; JMeter will create and simulate 10 virtual users during the load test. A diagram here can help us understand it better

 



How to Create a Thread Group Element in JMeter Test Plan?

In the previous chapter we learnt that how to create a test plan. Thread Group is a element of test plan. To create a Thread Group it is required to have the Test Plan created.

  • Start JMeter
  • Select Test Plan on the tree
  • Add Thread Group

Open the thread group panel by Right Click on Test Plan and then going to Add >> Threads >> Thread Group. As shown in the image below:


Components of Thread Group

The Thread Group Panel holds the following components −

1) Action to be taken after a Sampler Error

If JMeter catch any sampler error during test execution, you can tell it how to react in that scenario from the following available options.

  • Continue, to ignore error and move to the next element in the tree
  • Start Next Thread Loop to stop current Thread and Start Next
  • Stop Thread, to stop the current Thread execution.
  • Stop Test, to stop entire test execution.
  • Stop Test Now, the entire test will be stopped abruptly.
Default is Continue.

2) Thread Properties

  • Number of Threads (users): Simulates the number of users or connections to your server application.
  • Ramp-Up Period (in seconds): Tells JMeter how long to take ramp-up to the full number of threads chosen. For Example: If you set “Number of Threads” to “10”, and “Ramp-Up Period to “40” seconds, then JMeter will wait till 40 seconds to make all threads up and running. That means each thread will start 4 seconds late after the previous thread was started.
  • Formula: Ramp-Up Period / Number of Threads i.e. 40 / 10 = 4 (seconds)
  • Loop Count: the number of times the test to be executed. If you need to run the test forever, then select the “Forever” check box.
  • Scheduler: To schedule test execution. Scheduler Configuration bottom panel will get enabled when you select this checkbox. The schedule feature is also very helpful in soak/endurance testing.

3) Specify Thread lifetime

You can configure test duration and start up delay of your load test plan using Specify Thread lifetime. To enable this area of configuration, Specify Thread lifetime check box must be selected as you can see in below screenshot:

Thread Group configuration panel is as follows:

  • Duration (seconds): This tell the JMeter to execute the test for the specific duration of time. If the duration is set to 60 secs, JMeter will keep the execution on for 60 secs and ends it once the time is elapsed. It also ignores or override the End Time and All threads has completed its test or not. 
  • Startup delay (seconds): This tells JMeter to wait for specified time before starting the test. If the StartUp time is set to 10 secs, JMeter will not start loading the Users till the time 10 secs are over.




Post a Comment

0 Comments