Home > Performance Testing > JMeter > Core JMeter Components and its Uses

Core JMeter Components and its Uses

1. Test Plan – When we launch a JMeter and click on create new script then first component that gets added by default is Test Plan. Test plan forms the base of any JMeter script and all other components are children of the Test Plan.
Test plan will have basic core components like Thread Group, Samplers and Listeners. Test Plan will serve as parent to these elements. Using Test Plan, we can execute test cases step by step.
Here is an example of Test Plan: Suppose we have a test case in which we want to check the performance of website for 100 users. We need a Thread Group which will have 100 users configured, HTTP Sampler to send request to website and Listener to capture the result and response data.
Here Test plan will come into use as all these components like Thread Group, Sampler and Listener will be added under Test Plan. From the below image, we can get clear idea about above example mentioned.
 

 

 

2.Thread Group – consists of set of threads(users). Each thread will send one separate request to the server. Request can be http request, jdbc request, ftp request depending on the type of sampler added. For adding Thread Group to Test Plan user needs to follow below steps:
Right click on Test Plan -> Click on Add -> Click on Threads -> Select Thread Group from list
Below picture will give clear idea about how to add Thread Group to Test Plan

 

In Thread Group, we can configure number of users, ramp up period and loop count. Thread Group will also help us to decide what action to be taken if any sample error occurs, it will give us options like whether to continue, start next thread loop, stop thread or stop test.
Fields present in Thread Group:
Number of Threads(Users): In this field, user can enter the total number of threads/users that are required to perform the test
Ramp Up Period: it is the time taken to start all threads
In the below example, Number of Threads are 100 and Ramp up period is 10 seconds. So after every 0.1 second new thread will start and for completely starting all 100 threads 10 seconds will be required
Loop Count: it indicates how many times the test case should be executed

Suppose any user wants to execute the test plan for only specified amount of time then ‘Scheduler Configuration’ can be used. For using ‘Scheduler Configuration’ user needs to tick the checkbox of Scheduler.
Fields present in Scheduler Configuration are:
Duration(Seconds): Here user can specify the amount of time for which test plan should run
Startup Delay(Seconds): How much time the thread should wait before starting the execution

3.Samplers – Samplers play a vital role in the test plan execution. Without sampler test script is not complete and script cannot be executed. Samplers helps JMeter to send requests to server. When requests are sent to server, then user can also add parameters to request if required.

Samplers can send different types of requests like: HTTP requests, FTP requests, JDBC requests, Java request etc.
For adding Sampler to Thread Group: Thread Group -> Sampler -> HTTP Request. Below is the image of how HTTP request sampler is added to Thread Group

Example format for HTTP Request: Below are few fields of HTTP Requests:

Server Name/IP: Here user can mention the name of the server to which request needs to be sent
Method: Here user can select the type of method for HTTP request. Methods can be GET, POST, DELETE etc.
Path: User can mention the detail path of the website to which request needs to be sent.
Example: If we want to navigate to https://mundrisoft.com/tech-bytes/ then ‘/techbytes’ need to be added in the Path section and ‘mundrisoft.com’ in the Server Name section.
Parameters: User can add parameters to the request in the parameters section.

4. Listeners – Listeners play a vital role in JMeter as they help in displaying results in various formats to the end user
Different types of Listeners are present in JMeter. Most common types of Listeners are Summary Report, Tree and Table.
Listeners can be added to each sampler request separately, they can also be added to Thread Group directly
For adding Tree Listener to Thread Group user needs to follow below steps:
Right click on Thread Group -> Click on Add -> Click on Listener -> Click View Result in Tree from list
Below picture will give clear idea about how to add Tree Listener to Thread Group

View Results Tree Listener is most common type of Listener. This listener displays Sample Result, Request made to server alongwith parameters that are passed if any and Response data returned from server side.
Using View Results Tree Listener, user can easily differentiate between requests that are passed and requests that are failed. If Request is passed, then the request is displayed in Green colour and if failed, then the request is displayed in Red colour along with the explanation of why the request was failed.

This Article is TAGGED in . BOOKMARK THE permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">