Using HTTP(S) Test Script Recorder in JMeter

Manul Wickramanayaka
Test Automation Hub
6 min readMay 12, 2021

HTTP(s) Test Script Recorder is an element in JMeter that helps us to record our HTTP request. So instead of manually adding our request in an HTTP sampler, we can very quickly do a recording and everything will get added.

With the help of this function, we can just browse and do the actions and everything will get recorded. So it will save a lot of time. Let’s see how this function works….

Before we start let's have an idea about what we are going to do here.
We are going to test https://ikman.lk/ site and record each page of the website into different recording controllers. (ex: Home, Electronics, Property, Vehicles, Jobs)

ikman.lk

1.Adding Test Script Recorder

First, create a Test Plan, then right-click on it.
Test Plan →Add →Non-Test Elements →HTTP(S) Test Script Recorder

Adding HTTP(S) Test Script Recorder

Let's have a look at the editor section of this element.

HTTP(S) Test Script Recorder editor

Mainly there are two sections we are going to clear now.
There is an option to give a port. We can give any port and by default, it's 8888.
And there’s a drop-down to select our target controllers which will be cover in the next topic.
Just keep in mind that this is the place we are going to categorize our sampler results according to the page we are testing.

There is few other options in the editor but for now, let's keep everything as it is.

2.Using Recording Controllers

Recording controllers helps us to categorize and store all of our events from every page separately when recording our tasks. We can add multiple recording controllers per page.

First, add a Thread Group for our test plan and right-click on it.
Thread Group →Add →Logic Controllers →Recording Controller

Adding Recording Controller

We can always rename recording controllers with our preferred names.
Now create 5recording controllers and renamed each of them as follow.

3.Setting up the Proxy

Previously we have added port number 8888 in the HTTP(S) Test Script Recorder editor. So in our browser, we should set up the proxy for this particular port.
I will show you how to change the proxy settings in chrome which is the same as our system’s proxy settings and also in the firefox browser.

If you are in chrome go to the 3 dots icon on the top right corner of the window and go to settings. Then search for proxy. You will find “Open your computer’s proxy settings” which is the same as our systems proxy settings.

Here you can select the “use a proxy server” under the Manual proxy setup. The address should be localhost and the port number will be 8888, which is the same port we have used on JMeter.

system proxy setup

If you are in Firefox go to the 3 dots icon on the top right corner of the window and go to options. Search for proxy and go for its settings window.
choose Manual proxy configuration and configure the proxy as follow.

Firefox proxy settings

The main difference between chrome and firefox is that it is easy to set up a proxy in firefox because it can be configured at the browser level rather than going into the system level.
For this test, I’ll go with firefox.

The next part is adding the SSL Certificate. You have to add this certificate to your browser. You can add this by going into the options and search for a certificate.
options →search for ‘certificate’ →view certificates
under ‘Authorities’ tab in the Certificate manager click ‘import’

Firefox Certificate Manager

And import the file “ApacheJMeterTemporaryRootCA.crt” in the bin folder of your Apache JMeter folder.
apache-jmeter →bin →ApacheJMeterTemporaryRootCA.crt

Firefox Certificate Manager

And tick the following checkbox.

Firefox Certificate Manager

Now our proxy setup is done. The same procedure can be applied to the Chrome browser to add the SSL certificate.

4. Let's Record our test in JMeter

We are going to record the Home, Electronics, Property, Vehicles, Jobs sections of ikman.lk site and I think you can now understand why we created 5 recording controllers naming each of the above. We are going to record each section separately and store it in the relevant recording controller.

First, go to your JMeter GUI and select HTTP(S) Test Script Recorder.
For our first test let's select “home” as our target controller because it's the first action we are going to record. Then we can go to each section separately.

HTTP(S) Test Script Recorder editor

Click on the start button.
And Recorder: Transaction Control will popup.
Now you have started your recording. All the actions you perform on the firefox browser will be recorded into the transaction controller.

You can also give a Transaction name. I gave it as “home” because the samples we are getting belong to the home page loading.

Recorder: Transaction Control

Now go to the firefox browser and search for ikman.lk. And wait till the whole page is loaded. After the loading is complete click cancel because JMeter has collected all the samples by now.

Let's have a look at our Home recording controller.

home Recording controller

As you can see here controller had collected a lot of samplers related to page loading of the home page. we can identify them by the prefix.

So let's move on to our next section which is Electronic. same as before choosing your target controller as Electronics and run the test.

HTTP(S) Test Script Recorder editor

You can see it will also collect a lot with the prefix electronics.

electronics Recording controller

Likewise, collect samples for the other three recording controllers.

Now after recording all to the controller's let's add the following samples to see the results.
Thread Group →Add →Listener →view results tree/view results in table

To run this test go to Thread Group and give 5 users and 5 seconds of Ramp-up time. Let's keep the loop count as 1.

Thread Properties

All good and now we can start the test by clicking the green arrow button on the main toolbar.

The process will take few minutes because as you can see there are a lot of samples are generated from this site. If you did it correctly then all the tests should be a pass.

View Results in a Table

Here we see that tests are passing. And the samples are categorized perfectly with the prefix.

Hope this article cleared all your doubts regarding HTTP(S) Test Script Recorder and Recording Controllers.

THINK QUALITY!

--

--