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.
Under careful examination of each request, note that each request has a single or several factors in common with another 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.
Run the test scenario and see what happens.
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?