JMeter HTTP Request Sampler Example

In the previous tutorial, we have seen some basic information on sampler. Here we will try to understand in detail about most commonly used sample which is HTTP Request sampler with example.

Let us now create a plan to test an web page using HTTP Request Sampler. This sampler lets us to send an HTTP/HTTPS request to a web server. If we want to send multiple requests to the same web server, we should consider using an HTTP Request Defaults Configuration Element so that we do not have to enter the same information for each HTTP Request.

Step 1:- Add Thread group to execute the components of the test and configure thread group properties. Refer Thread Group details with example
Right Click on Test Plan -> Add -> Thread ->Thread Group

Apache JMeter Thread group Structure

Step 2:- Add HTTP Request Sampler for this thread. Right Click on Thread Group - Add -> Sampler -> HTTP Request
After adding the request, we need to define the properties for this request as below:

Apache JMeter HTTP Request Structure

Step 3:- Set the name of the serve that we want to test. Example google.com, Path as /about and Protocol[http] as https

Apache JMeter HTTP Request Structure

Step 4:- Add Listener for this thread. Right Click on Thread Group > Add > Listener > View Results Tree. This shows a tree of all sample responses, allowing us to view the response for any sample in the tree. We can also see the time the request took to get this response along with response codes.

Apache JMeter HTTP Request Structure

Step 5:- Save the Test Plan and Run button or we can use Ctrl + R to run the test

Apache JMeter HTTP Request Results Tree

This will make request for the about page (https://google.com/about/) which we can see in the highlighted section of View Results Tree. If we set Path as blank or / then it will make request for (https://google.com/) only.

We can add multiple samplers in the same Test plan like if we want to access the home page and about page of google, just add (https://google.com/) in Server Name and / in Path of one HTTP Request and add (https://google.com/) in Server Name and /about in Path of another HTTP Request.

JMeter Tutorials: 

Comments

Hi admin,
I run jmeter with config : 16 threads in 1s about 1 hour ( about 9000 sample) but after run finish then report display about 35000 samples
Is jmeter can send more request in 1s ( >16 threads) ?

Awesome!! Simple and easy, thank you a lot!!

Add new comment

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.