info@pragmatictesters.com +94 11 253 8512

HTTPS Recording with

Introduction

HTTP Test Script Recorder (JMeter proxy) is capable of intercepting HTTP and HTTPS traffic and recording them into a JMeter test plan (JMX). The technique can be used for recording local/remote web browser actions, mobile (android, iOS etc) traffic.

JMeter needs to use a certificate to authenticate the connection between the client (browser, device, application) and the server. JMeter generates its own certificate with a validity period of seven days. Generally this certificate is not trusted by the browsers. Hence the certificate needs to be installed on the browser/device as a trusted certificate.

Browser/Client checks 

  1. Server presented certificate is signed by a Certification Authority (CA)
  2. Check if the certificate is linked to one of it’s installed root certificates 
  3. Certificate is not expired 
  4. Certificate is for correct domain/host and it’s valid 

Above conditions should be satisfied during the HTTPS traffic recording. 

We will start with extending JMeter root certificate’s validation period and move into installing the certificate, configuring proxy on browser/devices and  recording HTTPS traffic. We will cover web browsers, Android and iOS mobile devices in this post.

Let’s get started

We need to have an active certificate throughout the test script recording. Usually the test script creation takes more than seven days. 

Default validity period of the JMeter temporary certificate is 7 days. You will have to recreate the certificate after every seven days. Following will help you to extend the validity period of your temporary certificate.

 1. Extend the validity period of the Temporary Certificate

Delete following files from MTER_HOME/bin folder if they exists 

Note : Above files will get created when you first start the JMeter HTTPS Test Script Recorder (JMeter proxy) 

Open user.properties file in a text editor 

Add following to the end of the file to extend the expiry period to 356 days and Save the file.  

Note : It is a good practice to add/update the properties in the 

JMETER_HOME/bin/user.properties file instead of  JMETER_HOME/bin/jmeter.properties.

Configure HTTP(S) Test Script Recorder Controller

Start with a new Recording template and select the HTTPS Test Script Recorder controller.

  1. Set proxy server port (default value, 8888 should be fine) 
  2. Set the HTTPS Domains 
  3. Set the Target Controller  

Configure the Request Filtering (if required)

Start Proxy Server

Click on the start button in HTTP(S) Test Script Recorder controller.

New certificates with the new validately period (365 days)  will be created when you start the HTTP(S) Test Script Recorder (proxy server).

Setting Browser Proxy

Launch Firefox 

  1. Type about:preferences in the address bar
  2. Type proxy in the search box 
  3. Click Settings button in the Network Settings area
  1. Select  Manual proxy configuration radio
  2. Set HTTP Proxy to localhost (or IP of the JMeter proxy server) 
  3. Set the port to 8888 (this should match with the port in HTTP(s) Test Script Recorder) 
  4. Check User this proxy server for all protocols   
  5. Click OK button to complete the configuration 

Installing the Certificate on Firefox

  1. Open Firefox 
  2. Type about:preferences in the address bar 
  3. Typer certificates in search box
  4. Click on View Certificate button 
  5. Select Authorities tab 
  6. Click on Import button 
  7. Select the certificate from your JMETER_HOME/bin folder 
  8. Check the first option in the popup (Trust CA to identify the websites)
  9. Click OK

Note : You may have to delete existing JMeter certificates if you have already installed a JMeter certificate 

  1. Select the JMeter Certificate 
  2. Click Delete or Distrust button to delete the certificate 

Now everything is ready and you can proceed to record the test scenarios. All the HTTPS traffic will get recorded to the target controller in the JMeter.

Same process can be used for the mobile devices and recording from other tools such as Postman. First you have to configure the device/tool proxy to the JMeter proxy. Secondly you have to install a valid JMeter certificate onto the device/tool. In the following sections you will learn them.

Install the certificate on mobile devices 

  1. Send the certificate to yourself by email (Gmail) from the desktop computer as an attachment
  2. Open a web browser and access the email through web client
  3. Click the certificate in the attachment and follow the instructions to install it. You will have to accept the security warning.

Configuring Proxy on iOS

Please ensure your device and the JMeter are on the same network.

  1. Click on Settings
  2. Select Wifi
  3. Select the network
  4. Scroll down to configure the proxy
  5. Select manual in the configuration
  6. Server should be the IP address of your JMeter machine
  7. Port should be JMeter proxy port ( default is 8888)

Configuring Proxy on Android

  1. Click on Settings
  2. Select Network and Internet
  3. Select the connected Wifi ( your mobile and Jmeter should be connected to a same network)
  4. Click the setting icon
  5. Click edit icon to open the advanced settings
  6. Open Advanced Settings
  7. Select proxy to manual
  8. Set the Proxy hostname to JMeter IP address
  9. Set Proxy port to Jmeter proxy port
  10. Click Save to save the settings

Author: Janesh Kodikara

Performance Tester | JMeter Trainer | Software Testing Service Provider

Your Turn To Talk

Leave a reply:

Your email address will not be published.