Jmeter, Performance Testing

Understanding of Basic Jmeter Features – Part 2

Jmeter

This article is continuation of “Understanding of Basic Jmeter Features – Part 1”. We will go through below mentioned Jmeter features in this article :

1) HTTP Request Defaults
2) HTTP Cookie Manager
3) User Defined Variables
4) Listeners

HTTP Request Defaults

HTTP Request Defaults is one of the Key element in Jmeter Test Plan. By effectively using this component you can avoid data duplication and can maintain parameters which are common across all requests.


Let’s say You have a Test Script consist of 50 HTTP Requests. All the requests will be pointing to same Server. Now you need to execute same test script on another server. In such case, you need to provide new domain name/IP to each HTTP Request manually. What if you script is having more than 50 HTTP requests ? May be 150 or even more than that ?

HTTP Request Defaults allows you to configure such parameters and each request will inherit these values during execution.

Apart from “Server Name or IP” you can also configure “Port Number” and “Parameters”.

How to Add HTTP Request Defaults ?

Right Click on Thread Group > Add > Config Element > HTTP Request Defaults.

jmeter_http_request_defaults_Add

Once HTTP Request Defaults is added it will look like displayed in below image :

jmeter_http_request_defaults_Screen

HTTP Cookie Manager

Main function of Cookie Manager is storing the cookies to be used in all future Request transactions. If your Jmeter Script have HTTP Request and the response contains cookie withing, the Cookie Manager(If added) will store all these data automatically. Cookies do not appear on the Cookie Manager screen, but you can see them using View Result Tree listener.

Cookies can be saved as variables. To do that Go to Jmeter Installation folder > Open Bin Folder > Open jmeter.properties file in notepad > Set CookieManager.save.cookies=true. Jmeter will store all Cookies with the prefix “COOKIE_” so that if you want to fetch the value of cookie named “JSESSIONID” from “Cookie Storage Area”, use ${COOKIE_JSESSIONID}.

How to Add HTTP Cookie Manager ?

Right Click on Thread Group > Add > Config Element > HTTP Cookie Manager.

jmeter_cookiemanager_add

Once the HTTP Cookie Manager is added, you screen will look like this :

jmeter_cookiemanager_screen

There is an option to Clear the Cookies after each iteration. Server defined cookies are cleared after each Thread Group iteration. User defined cookies remain as it is.

CSV Dataset Config :

CSV Dataset Config is used when you have to Test a Web application with a set of Test Data for a single field. For Example, You have recorded a Jmeter script for Login function. Now to execute the same script with load of 20 Users, you will need a place where Test Data of 20 different users is stored and Jmeter will execute each Thread using separate User information.

Jmeter supports CSV files for reading the Test Data. Let’s look at the configuration required under CSV Datset Config.

– Filename : Exact File name (with .csv ext) containing test data for execution and located at the same place where the Jmeter script is.

– Variable Names : List of all variable names (comma-delimited) in the same order as mentioned in the CSV File.

– Delimiter : Provide ” , “.

– Recycle on EOF : If number of threads are more than the Test Data count, do you want to continue execution by start reading from beginning ?

– Stop thread on EOF : If set “True”, reaching on EOF will cause the thread to be stopped.

– Sharing Mode : The same file is shared between “All threads” OR each file is opened for each Thread Group OR each file is opened separately for each thread.

How to Add CSV Dataset Config ?

Right Click on Thread Group > Add > Config Element > CSV Data Set Config.

jmeter_csv_dataset_add

Listeners :

Jmeter gathers information of the execution while the script runs. These gathered response is showcased by Jmeter Listeners. There are multiple types of listeners available. “View Result Tree” provides details of sampler request and response in the form of HTML, XML, JSON etc. “Graph Listeners” showcase information in form of response Graph.

In some required conditions, you can extract data from response fetched by Listener and direct them as part of Request parameters for subsequent samplers.

How to Add Listeners ?

Right Click on Thread Group > Add > Listeners.

Here we are ending understanding of Basic Jmeter Features. In subsequent articles we will be focusing on each element separately in detail.

If you have any Questions regarding this article, please post your queries in the comment below or directly Contact Us.


Share This Article :

1 Comment

  1. Martins

    Job well done, i enjoy my time reading the step and procedure
    Thanks

Leave a Reply