HTTP(S) Test Script Recorder in JMeter
JMeter supports recording HTTP(S) Requests using HTTP(S) Test Script Recorder. JMeter Recorder can be utilized to record Web Applications quickly and easily. Throughout this story, We wil have some hands on session wiith recording web application.
Normally, what happens inside the Web browser is it sends the HTTP request to our application and the Response is received from the Application to the Web browser.
Now let’s see, how it works in the proxy environment. All the requests go through the JMeter proxy server and JMeter understands the Requests going through it. JMeter can create the Test plan and it will be recording all the Requests. After that Test Plan is available for the user to configure and reuse.
Now we are going to test https://jmeter.apache.org/ and record each page of the website.
- Create Script for Recording
In there we can use JMeter Templates to create Scripts.
File →Templates →Select Recording from Template dropdown→Create
A complete Test Plan is created
Next, return to the HTTP(S) Test Script Recorder and have look at the two main sections.
Port: This is the port going to be assigned for the proxy JMeter. The proxy will be running on this TCP port and listening for HTTP Requests. We can use Different Port if we want. The default is 8888.
Target Controller: This is the place we are going to categorize our sampler Results according to the Web site testing. By default, it is the User Recording Controller. But we can change it as we prefer from the dropdown.
Then keep the other rest of components as it is.
Now we can click the start button before that we have to do few more things.
2. Configure the browser to use the JMeter Proxy
First, we need to set up the Browser proxy. Previously we have selected the 8888 port in HTTPS TestScript Recorder. So now we should set up the proxy to this particular port in our browser.
In there, I will use the Firefox browser and I will show you how to set up it.
First, open Firefox, click on the Application menu in the top right corner and select the Settings option. Then search the proxy and click on its Settings option.
Then configure the Proxy setting as below and click ok.
After setting the browser proxy we have to install the Root certificates.
For that, go to the Firefox browser, search for Certificate and click on the View Certificates.
Under the Authorities tab click on the ‘Import’ button
And import the “ApacheJMeterTemporaryRootCA” file in the bin folder of your apache-Jmeter folder.
And click on the “Trust this CA to identify websites” check box and click ok.
Now We are done with our proxy setup and root certificate installation.
3. Start the Test in JMeter
We are going to record the home, Download release, and Release notes pages of https://jmeter.apache.org/ website.
Before starting the record, adds the below samplers to view the results.
1.Summary Report
2.View Results in Table
3.View Results Tree
Now we are ready to record our test.
First, go to the JMeter GUI and navigate to the HTTP(S) Test Script Recorder. Then select Target Controller as,
“Test Pan> Thread Group>Recording Controller”.
Click on the ‘Start button and then Record: Transactions control box will pop up. You can give a Transaction Name as you prefer.
Now you have started the recording and the firefox browser will be recorded in to the Transaction controller.
After that, go the firefox and enter Apache.jMeter and wait till the page is loaded. After loading is successful, stop the recording and check the Recording controller.
As you can see, the controller has recorded a number of samplers related to the loading of the home page.
Likewise, you can also record the other pages. After recording all the test pages, You can run the test with the following thread groups.
Go to the Thread Groups and give the below values to the Thread property.
Number of Threads- Number of users that we are going to test under a certain time
Ramp-up period- The ramp-up period tells how long it takes to ramp up to the full number of threads
Loop count- How many iterations do we want to do for the test.
Now we are going to run for 5 users within 1 second for 1 loop count. Let’s start the test by clicking the green button on the main toolbar.
If you are runing the script correctly and all the tests are passed we can assume our web application is peforming well for the five concurrent users.