Become a JMeter and Continuous Testing Pro

Start Learning

Test Your Website Performance NOW! |

arrowPlease enter a URL with http(s)
Jul 04 2013

Why It's SO Important To Use JMeter's HTTP Request Defaults


The HTTP Request Default is ONE OF THE key JMeter elements, occurring in nearly every testing scenario.

The main goals of using the HTTP Default Request is to:
1- Avoid data duplication in tests.
2- Make test scripts more (easily) maintainable.
For example.....You have a test script, which consists of let's say, 30 HTTP Requests. All which trigger the same test server,  BUT refer to different resources.

Now, imagine that you now need to reconfigure your test scenario  to use with another server. 
In this scenario, you will now need to adjust EACH of the 30 HTTP Requests to the new domain name/IP. Oy to the vey.
Of course, your actual script may contain MORE than just the original 30 HTTP Requests. Maybe even 100, maybe more.  
So what do you do?
Create a short script containing...say, 2 HTTP Requests. Just to see how it works.
Here are a couple of HTTP Samplers.
JMeter HTTP Request Samplers
Under careful examination of each request, note that each request has a single or several factors in common with another request.
HTTP Request Sampler 1
HTTP Request Sampler 2nd request
Here we see the obvious elements that both HTTP Requests have in common: 
Obviously, this element should be moved to the HTTP Request Defaults field.
JMeter HTTP Request Sampler Common Factors
Run the test scenario and see what happens.
HTTP Request Defaults from JMeter
As expected, the common elements of the URL were inserted directly from the HTTP Request Defaults. Way better option than doing each one manually, wouldn't you say?
arrowPlease enter a URL with http(s)

You might also find these useful:

Interested in writing for our Blog?Send us a pitch!