#TECH

How To Do Mobile Performance Testing Using JMeter?

Performance Testing Using JMeter

What comes to our mind for the very first time when we hear about JMeter? Is it Performance Testing? Or Web App Load Testing? Well, most of us are unaware that JMeter can also be used for performance testing of Android/iOS apps. It’s quite similar to recording scripts like in case of web apps, all we have to do is to configure a proper proxy on mobile devices.

So here in this post we would be listing down the process to record a performance test script in JMeter for Android and iOS platforms.

Prerequisites : JMeter version 3.0, Android phone (versions above Jellybean) or iPhone (version 8.0 onwards)

JMeter Configurations

1.  Launch JMeter -> Navigate to File option ->  Templates -> Select Recording -> Click on Create (So now we have added all the necessary parameters for Recording scripts)

JMeter Configurations JMeter Configurations

 

2. Go to HTTPS Test Script Recorder -> Set port to 8080

Now find your IP Address by ifconfig for Linux and ipconfig for Windows. We will load up this IP address on our phone Android/iOS phone to setup proxy.

ifconfig

 

Mobile side Configurations

iOS proxy configuration:

iOS proxy configuration

  • Go to Settings–>Wi-Fi option.
  • Click on your connected network.
  • Select ‘Manual’ option from HTTP Proxy section.
  • Set ‘Server’ value as your computer’s IP address and ‘Port’ value to 8080 as JMeter configuration. Refer above image to get an idea about this setup.
  • We need appropriate JMeter Certificate and save it to our phone. ApacheJMeterTemporaryRootCA.crt can be downloaded from https://gist.github.com/borisguery/9ef114c53b83e553b635
  • Install this certificate on your iPhone.

Android proxy configuration:

 

  • We need appropriate JMeter Certificate and save it to our phone. ApacheJMeterTemporaryRootCA.crt can be downloaded from https://gist.github.com/borisguery/9ef114c53b83e553b635
  • Download zip file for the certificate and send the certificate on mail. And install through mail. Once the certificate is installed phone will ask to apply a lock. And a notification appears showing Network may be monitored.
  • Now click on Wi-fi Settings -> Long press on the Network you are connected to -> Click on Modify Network -> Advanced Settings -> Change Proxy to Manual -> In Proxy Host name enter the IP of your computer -> Set Proxy to 8080 -> click save
  • Now we are set to start recording and running the scripts.
  • Go to Jmeter -> HTTP(S) Test Script Recorder click Start (this would start the recording). Remember that the port  in JMeter Global Settings and Mobile must be the same.
  • Add a Listener -> Add Result Tree to HTTP(S) Test Script Recorder
  • Perform any actions on mobile devices and user can see the actions getting recorded on JMeter.

Mobile action recorded on JMeter

Replay the actions by increasing the load and monitor the performance

In JMeter go to thread groups and alter number of threads, Ramp up period and Loop count.

  • Thread means the number of active users.
  • Ramp-Up is the amount of time JMeter must take to send threads for execution.
  • Loop Count is used to specify the number of times to execute the Performance Test.

JMeter thread groups

Adding Appropriate Listeners and analyzing the performance on different loads. Listener that we have used here is Response time over time Listener.

These Listeners don’t come by default with JMeter we need to download the jar and put it into JMeter’s lib/ext directory.  Now restarting JMeter shows these Listeners in JMeter’s list of Listeners.

Jars can be downloaded from https://jmeter-plugins.org/wiki/PluginsManager/

JMeter script for mobile performance testing

Advantages of using JMeter for mobile performance testing

  • First of all JMeter is an open source software. So zero investment.
  • It’s very user friendly with a interactive UI
  • It’s easy to learn
  • Every test script results can be best monitored using different Listeners in JMeter
  • By far the easiest though effective way to check mobile performance

Hope you were able to record JMeter script for mobile performance testing after following above mentioned steps. Please drop your comments if you face any difficulty.