Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Recording a Scenario in Mobile Applications

DZone's Guide to

Recording a Scenario in Mobile Applications

Learn how to record scenarios in your mobile app to make for easier, more effective testing.

· Performance Zone ·
Free Resource

Sensu is an open source monitoring event pipeline. Try it today.

Mobile app users demand high performance at all times and 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.

Step 1: Configure

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

test script recorder

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

https_test_script

Step 2: Creating the Test Plan

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

add_thread_group

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

recording_controller

Step 3: Configure Mobile Devices

You need to set up 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

add_thread_group_jmeter

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.

test_plan_creation

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.

apache_jmeter

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.

http_request

You can test your mobile app's performance easily.

Happy load testing!

Sensu: workflow automation for monitoring. Learn more—download the whitepaper.

Topics:
jmeter ,stress testing ,mobile testing ,tutorial ,performance

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}