Recording a Scenario in Mobile Applications

Recording a Scenario in Mobile Applications

Mobile app users are demanding high performance at all times and they rarely give a second chance to an app that performs poorly. For this…

Recording a Scenario in Mobile Applications

Mobile app users are demanding high performance at all times and they rarely give a second chance to an app that performs poorly. For this reason, you have to make sure to prepare your app in advance by executing a proper load testing process. To start with, here we will show you the steps you can take to record the scenario in a mobile app with JMeter.

Prerequisites:

First of all, you have to connect your mobile device and Jmeter installed a computer on the same network. By doing so you enable your computer to be a proxy for your mobile device.

Let’s Start Recording

Step 1) Configure

Create a blank Test Plan and add an HTTP(S) Test Script Recorder to record mobile devices’ activity.

You need to set an unused port value. Generally, 8888 should work fine in case you have nothing running on it.

Step 2) Creating the Test Plan

You need to add a Thread Group to your JMeter file.

Then you should add a “Recording Controller” under it, to store the request captured from the proxy.

Step 3) Configure Mobile Devices

You need to setup your mobile device’s proxy settings

In an iOS device, follow these steps;

  • Settings → Wi-Fi → Your connected network
  • Choose Manual from HTTP Proxy section
  • Add server value, Server = Computer’s IP address
  • Add Port value , Port = JMeter’s Port value

In an Android device, follow these steps;

  • Settings → Wi-Fi → Your connected network
  • Show advanced options
  • Choose Manual from HTTP Proxy section
  • Add Proxy hostname value, Proxy hostname = Computer’s IP address
  • Add Proxy Port value, Proxy Port = JMeter’s Port value

Now your device will use your computer as a proxy in the defined port and ip address.

Step 4) Start Recording

Open the HTTP(S) Test Script Recorder and click the Start button. Right now, JMeter is running as a proxy and able to capture any request coming from the device that’s connected to its IP.

When you click on the Start button, you’ll receive a message about the “Root CA certificate ApacheJMeterTemporaryRootCA created bin directory” dialogue.

Just click the OK button. In case you don’t add this certificate to your device, you will not be able to capture HTTPS traffic. You’ll only capture HTTP ones.

Step 5) Install the Certificate

Just send this certificate located in the bin folder of your JMeter root folder to the mobile device and install it by clicking on it.

Step 6) Analyze the recorded script

Just start the application or your mobile browser and execute your scenario on it. You will notice that every request will be stored under the “Recording Controller”. All you need to do is to clean the unnecessary request coming from other app’s running on the device cause JMeter proxies them too. Then manipulate the script with dynamic variables for a realistic performance test script.

Originally published at loadium.com on March 14, 2018.