How to record Performance Test Scenarios with JMeter

Apache  Jmeter.png

HTTP(S) Test Script Recorder Tutorial

What is HTTP(S) Test Script Recorder?

•  The HTTP(S) Test Script Recorder allows the user to record the network traffic between the server and the client. As a result, the tester can quickly develop a performance testing script without the need for manually recording the traffic

•  The HTTP(S) Test Script Recorder allows JMeter to record the user activity while the user interacts with the web application under test in a standard browser.

How it works?

  • First up, we will configure the browser to use JMeter proxy
  • Next, we will record a test plan with JMeter.
  • Finally, we will run the test suite and save the test results. 

Step 1) Configure the browser to use JMeter proxy

  1. Start JMeter
  2. Select Templates on the Menu
  3. Select Recording template from the list

4. Click Create and a complete Test Plan is generated.

5. Accept the defaults to create the test plan

6. In the HTTP Request Defaults element:

Server name or IP

Enter: domain name of the application under test

Path: leave blank

7. Return to HTTP(S) Test Script Recorder, and click the Start button at the top.

This will start the JMeter proxy server which is used to intercept the browser requests. A file called ApacheJMeterTemporaryRootCA.crt will be generated in JMETER_HOME/bin folder.

  1. Start your Browser (Firefox / Chrome), choose Tool > Options > Settings > Network Settings > Enter HTTP proxy: localhost, port: 8888, check: Socks v5
  2. Check Use this proxy server for all protocols

Step 2) Record the Test Plan

  1. With your browser (Firefox), in the Address bar at the top, enter (replace with your websites address). and hit the enter key. (JMeter still open)
  2. Click on a few links on your sites pages.
  3. Back to JMeter, in HTTP Proxy Server, click Stop when finished
  4. After finishing recording, you will see JMeter automatically created a new HTTP request
  5. Click File > Save your Test Plan as
  6. A Dialog box display > enter a name of your test plan at File Name field > Click Save. Now your Test Plan is saved under name RecordingTestPlan.jmx

Step 3) Validate the Test Script

Now we need to validate the script before to run our test plan. Save the test plan.

Right click on the Thread Group Validate

Check with View Results Tree element if all is ok.

Step 4) Run the Test Plan

  1. Select Thread Group > Add > Listener > Summary Report
  2. The Summary Report will show some basic statics
  3. Select Thread Group, enter information as follows:
  • Loop Count: 1
  • Number of threads:    100
  • Ramp-up period (in seconds): 10

4. Before you start the test, select “Summary Report”. When you ready to run test, select Run > Start (Ctrl+R). JMeter will playback your activity for 100 users. As the test runs, the statistics will change until the test is done.

Step 5) Save the Test Result

  1. Click Save Table Data to save test result to file
  2. Enter the name of test result and click Save. Test Result in JMeter is saved in *.csv format as default
JMeter Report CSV

Alternatively, you can run the test plan from the command line, use jmeter -n -t [jmx file] -l [results file] -e -o [Path to output folder]

At the end of the test, an HTML report will be generated and available in [Path to output folder] used in command line.

Sr. SDET M Mehedi Zaman

Currently working as Sr. SDET at Robi Axiata Limited, a subsidiary of Axiata Group.

Leave a Reply

Your email address will not be published. Required fields are marked *