Record Your First Script

To Record Script we need to add Thread Group, HTTP Request Default and HTTP Proxy Server.

Don’t be panic I will explain why we need to add all these things.

Download Jmeter and Install it on your System.

Follow the instruction to record your first script :

 Add Thread Group :

Thread group is nothing but the Total Number of users who are going to hit the website at a time.

Right Click on Test Plan option and go to-

 Test Plan –> Add –> Threads (Users) –> Thread Group.

Once the thread group will be added the window will look like-

Number of Threads– Number of Threads is total number of users which are going to hit the server. Supper you want 5 users to hit the server at a time we need to make it 5 instead of 1.

 Ramp-Up Period– Ramp up period is the time give for each users. Let it make it more easy to understand. Suppose you have 5 users ( Number of Thread) and Ramp up period is 5. The we are giving each user 1 second to hit the server.

 Loop Count– Suppose you want to execute the same process 2 times continuously then you need to increase the loop count as 2. It mean 5 people will hit the server two times.

So now lets configure Jmeter  for 5 users.

Add HTTP Request Defaults :

If you are going to send multiple requests to the same web server, consider using an HTTP Request Defaults Configuration Element so you do not have to enter the same information for each HTTP Request. As we are going sent the same request again and again to the server so by this configuration we are making Jmeter to understand the it has to send every time http request only.

Right Click on WorkBench –> Add–> Config Elements –> HTTP Request Defaults.

Once the HTTP Request Defaults will be added the page will look like-

 Now you have to change three things here-

      •  Server Name or IP.
      • Port Number.
      • Protocol.

 

Server Name or IP :Server name or IP is nothing but this is url of your web site on which you want to perform load. For example if I want to perform load on testingfreak.com then I need to mention testingfreak.com as server name or IP. (Don’t write as http://testingfreak.com).

Port Number : The default port number is 8080. So just mention in Port Number field as 8080.

Protocol [http]  : As you are going to send HTTP request so just mention Protocol as http. Don’t mention as in caps.

Next screen shot is shown with configuration-

 

Add HTTP Proxy Server  :

 The Proxy Server allows JMeter to watch and record your actions while you browse your web application with your normal browser . JMeter will create test sample objects and store them directly into your test plan as you go (so you can view samples interactively while you make them).

Right Click on Workbench–> Add–> Non-Test Elements –> HTTP Proxy Server.

Once HTTP proxy server is added the window will look like this-

On this page you need to change-

 Port.
Target Controller.
URL pattern to Include.
URL pattern to Exclude.

Port- We need to change the port as 9090 as sometimes the default port 8080 will be busy once your system is open. So we reserve one port for Jmeter which always be free. It can be any other port also but generally Jmeter works fine with 9090 port.

 Target Controller- Where your recorded scripts will be added. So we are making Jmeter to understand that what operation that has to perform. How many user that has to use or what are the time specified for the load.

 URL Pattern to Include– Once your webiste page loads it loads with all the images. So to perform it perfectly we restrict the images to load or we allow the images to load. So in Include I am going to include all the images and for this we need to put ( .* ) . To add this you need to click on Add button.

 URL Pattern to Exclude- We generally exclude png or gif images so that it could perform well and load fast. So in this field I am going to put (*.gif) and (*.png).  To add more click on Add button.

 See the configuration in the next screen shot-

 Here we are almost done.

 Now we need to add some Listeners so that we could see our result and performance of Jmeter. We have lots of listeners that we can use for the report purpose. We can generate the report in Graph or Table or whatever useful and comfortable for you.

Add Listener :

Right click on Thread Group–> Add –> Listener –> View Results Tree.

You can add more than one listeners.

Right click on WorkBench–> Add –> Listener –> View Results in Table.

Right click on WorkBench–> Add –> Listener –> Graph Results.

Right click on WorkBench–> Add –> Listener –> Summary Report.

Please add at lease View Result in Table and Summary Report to see the complete report.

Finally Before running the script we need to Record the script. And for recording the script we need to do little change in our Browser. Recording the script needed only one time and we can use recorded script to perform load as many we want.

Browser Proxy Configuration :

1)  Open Firefox Browser.

2)  Click on Tools shown at the top menu.

3)  Click on Options shown under Tools

 

4)  Click on Network tab shown on the window after clicking Options.

5)  Click on Settings Button.

6)  Click on Manual proxy configuration

7)  Type HTTP Proxy as localhos and Port 9090.

8)  Click on checkbox “Use this proxy server for all protocols”.

9) Close all the windows by clicking on OK button.

 Wow we are done with all the settings and going to record the script.

Record the Script :

 1) Type the url in Firefox browser and hit Enter. The page will not load and will show the error message.

2) Now go to the Jmeter and click on HTTP Proxy Server option shown at the left side.

3) At the bottom there is a Start button. Click on it. Once you will click on start button the Jmeter will start recording.

4) Now go to the Firefox and reload the page testingfreak.com

5) Do any operation whatever you want. For example navigate some pages.

6) Go to the Jmeter and Click on Stop Button.

7) Now you can see the script has been recorded for your operations done in the browser.

Click on the key to view the recorded script.

 

8) Now you are ready with the recorded script. Click on the Save Icon or press Ctrl + s to save the recorded script.

9)  Press Ctrl + r or click on start button

Once you will run the script you can see the green light at the top right corner.

After sometime the green color will get changed brown color that mean Jmeter has completed running the script and load has been performed.

 

View Result :

 Now its time to view the result

 Click on Summary Report-

 

Click on View Result in Table :

Click on Aggregate Graph — > Display Graph

Here we are done with recording our first script…

 

 

<<Previous      Next >>

 

 

 

.