Skip to main content

Quality Assurance

Perform Load Test on Mobile App using Apache JMeter

Featured Image

In today’s era of increasing technology, we all know how important mobile apps are in our life. Therefore, in this growing era of mobile apps, it becomes necessary to test mobile app’s performance. Most of us are not be aware that JMeter can also be used for performance testing of Android/iOS apps. It is similar to recording scripts like in the case of web apps. All we need to do is to configure the proper proxy on mobile devices.

Load Test

Recording mobile application traffic is not different, we just need to do some configuration related to proxy for mobile applications. The remaining part is the same as recording a web application script.

Follow the steps below for Android or iOS mobile apps.

  1. Launch your JMeter.
  2. Right-click the Test Plan >> Add >> Threads (Users) >> Add Thread Group.Thread
  3. Right click the Thread group >> Add >> Logic Controller >> Add Recording Controller.Recording Controller
  4. Right-click the Threads>>Add>>Listener>>View Results Tree(To view the outcome of your script).Virew Results In Tree
  5. Add > Non-Test Elements > Add HTTP’s test script recorder.Http
  6. Go to HTTP(s) Test Script Recorder and set port to 8888 (or any available port).Port
  7. Click on the Start button displayed on HTTP(S) Script Recorder
  8. Dialog box gets opened to allow Root CA Certificate and just click the “OK” button.Root Ca

How to locate your IP Address

  • To locate your IP Address, launch the Command prompt and type ipconfig for Windows / ifconfig for Linux, and press ENTER button to get the IP address.
  • We will use this IP address on our mobile device- iOS or Android phone to set up the proxy.
  • Firstly, you will need an appropriate Apache JMeter Temporary Root CA Certificate to save it to your phone.
  • Download the zip file for the certificate for your required operating system and store it in the mail.
  • Install the certificate by mail on your mobile device. It will ask to apply the lock. Then a notification pop-up displaying the network can be monitored.
  • Now, let’s start the actual configuration process for the mobile.

Android device proxy configuration:

  1. On Android Mobile device go to Settings > Wi-Fi option (Shared Wi-Fi network should be same for both mobile and PC where JMeter is installed).
  2. Long tap on your current network connection and click the ‘Modify Network’ option.
  3. Check the checkbox for ‘Advanced Options’Proxy Mobile
  4. This will open the advanced settings from which we can modify the proxy manually. For this set the ‘Proxy’ option to ‘Manual’.Mobile Manual
  5. Now, set ‘Proxy Hostname’ as your PC IP address and ‘Proxy Port’ to 8888 as we have set up in the JMeter proxy server.Mobile Port
  6. Save the changes you made, Now, you can start running the application on your mobile device and its requests will be automatically recorded in JMeter.

iOS device configuration:

  1. On iOS device go to Settings > Wi-Fi option (Shared Wi-Fi network should be same for both mobile and PC where JMeter is installed).
  2. Click on the connected network.
  3. Select the ‘Manual’ option as HTTP Proxy.
  4. Set the ‘Server’ as your PC IP address and ‘Port’ to 8888 (or any available port) as the JMeter proxy server.
  5. Install the downloaded certificate for iOS.

Start Recording Your Mobile Web Application

By now you must have understood the mobile configuration process. Now, it’s time to open the web application you usually need to test and use.

  1. Launch the application on mobile and every request will be recorded in JMeter.
  2. Before running any application on the device, make sure you click the ‘Start’ button on the HTTP(S) Test Script Recorder in JMeter.
  3. Open the mobile application for which you want to do the load test, and play with the functionality the way you want to record functionality in JMeter.
  4. Since we have set the mobile connection to JMeter’s proxy, thus all the test flows are recorded in JMeter’s test plan.
  5. Once you have recorded all the test flow of your application, stop recording by the ‘Stop’ button on the ‘HTTP(S) Test Script Recorder’ in JMeter and save the test plan.Stop
  6. Now run your test plan by clicking the ‘Play” button displayed in green at the top. This will run the recorded script as per your thread setup.
  7. After playing the test plan you can see the response of each request in the ‘view result tree’ listener.View Tree

Your script is ready to run the load. You can further refine it by adding correlation, parameterization, etc.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Thoughts on “Perform Load Test on Mobile App using Apache JMeter”

  1. I am observing “java.security.cert.CertPathValidatorException: Trust anchor for certification path not found” error whilre recording Android Mobile application in JMeter using proxy. Kindly help

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Pradeep Pandey

Pradeep Pandey is a Technical Consultant at Perficient and is working in the QA department. He has 3+ years of experience in both manual and automation testing. He worked on various domains like E-commerce, Automobiles, ERP, and Point of Sale (PoS) applications. He likes to share his experiences through blogging.

More from this Author

Categories
Follow Us
TwitterLinkedinFacebookYoutubeInstagram