Thread group in jmeter

We right click a test plan we click add and then add a thread group.

Thread Group is a group of threads/users executing the same scenario.We can give our thread group a name and give some comments etc.

Other options to look into in a thread group are

No of threads-No of users we want to run this flow.

Ramp up period-In how many secs should all the users hit this website.It is the period in which we want to put load on our system.It is a good idea to put load on the system gradually.So always put ramp-up period more than 1 for every thread group that has more than 1 users.For a thread group of 10 users put ramp-up period equal to 10 ,for 20 equal to 20 etc so that 1 user is added every 1 sec.

Loop count-Once all the users have completed the flow how many more times we want to test the flow again with same set of users.We can set the loop count to 1,2,3 etc or forever If we set the loop count to forever then we can click scheduler and in schedule configuration we can set the maximum no of secs as we don’t want our test to run for ever. i.e if we set schedule configuration to 60 for example then in 60 secs whatover loops will be completed the test will stop after that.

Then we have action to be taken after sample error.We mostly choose continue here i.e continue if some user fails while completing the flow. Other options are Start next thread loop ,Stop thread(stop that particular user ) or stop test.(stop all users).

After making a thread group we can right click it and add Sampler-->Java request and name it Request1. Note in the above step we directly added Sampler.We can do so without adding controller.Then we add another request and name it request2. Then we adda View Result tree listener as well.

Now let us make one more thread group named management users. Add two sampler requests to it called managementreq1 and managementreq2.Then let us add another listener but this time at the level of testplan by right clicking test plan itself.This way it will capture the results of both the thread groups.

But please note that the both the threads will runs at the same time.If we want the thread groups to run one after the other we will have to go to the test plan and click the option run thread groups consecutively.