JMeter - HTTP Request Defaults Config Element

HTTP request defaults in jmeters is one of the configuration element. You can set default values for HTTP Requests using jmeter http request defaults in your software load test plan. Let's say, You have software load test plan with 10 HTTP requests and all requests are being sent to same server. In this case, You can add http request defaults jmeter and set server name in Server Name or IP field of http request default in jmeter. Then you do not need to set Server Name or IP in all 10 HTTP requests. HTTP requests will inherit Server Name or IP field's value from HTTP Request Defaults. Let's see how it works with practical example.

Add jmeter HTTP request defaults In Software Load Test Plan

You can add http request defaults jmeter parallel to request or controller. For adding HTTP Request Defaults under Thread group,
  • Right click on Thread Group -> Add -> Select Config Element -> HTTP Request Defaults. See bellow given image.

It will add HTTP request defaults in jmeter under Thread Group.

Example : Using HTTP Request Defaults In Jmeter Software Load Test Plan

I have prepared sample jmeter software load test plan to show you how HTTP Request Defaults actually works and when to use it.

I have test plan with 3 HTTP requests(/index.html, /site/contact.html and /site/guidelines.html) and all 3 requests are being sent to same server jakarta.apache.org. So i will add HTTP Request Defaults in my test plan and set Server Name or IP = jakarta.apache.org as shown in bellow image.


Now in all three HTTP requests, I need to set only remaining path. Server name will be automatically inherited from HTTP Request Defaults in all three HTTP requests as shown in bellow image.


You can see that i have not set server name in any of the request. So server name will be inherited automatically from HTTP Request Defaults when you run test and create full URL of page. See result bellow.


All three requests are pass. Also you can see that it has created full URL(Server name + Path) of index page.

This way you can use http request default in jmeter for your software load test plan.
<< PREVIOUS || NEXT >>

No comments:

Post a Comment