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
- Start JMeter
- Select Templates on the Menu
- 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.
- Start your Browser (Firefox / Chrome), choose Tool > Options > Settings > Network Settings > Enter HTTP proxy: localhost, port: 8888, check: Socks v5
- Check Use this proxy server for all protocols
Step 2) Record the Test Plan
- With your browser (Firefox), in the Address bar at the top, enter http://example.com/index.html (replace example.com with your websites address). and hit the enter key. (JMeter still open)
- Click on a few links on your sites pages.
- Back to JMeter, in HTTP Proxy Server, click Stop when finished
- After finishing recording, you will see JMeter automatically created a new HTTP request
- Click File > Save your Test Plan as
- 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
- Select Thread Group > Add > Listener > Summary Report
- The Summary Report will show some basic statics
- 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
- Click Save Table Data to save test result to file
- Enter the name of test result and click Save. Test Result in JMeter is saved in *.csv format as default
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.