How to Test Native App Performance using Apache JMeter?

In my previous blog, I have elucidated how to test web application’s performance using JMeter. Here, I would like to share how to test mobile app’s performance in JMeter.

JMeter records mobile application requests on HTTP(S) Script Recorder and it has features to prepare and run our mobile application performance test scripts. All we have to do is to configure JMeter and Mobile device. In JMeter, we can test both iOS and Android native applications.

Steps to Configure JMeter:

  1. Go to apache-jmeter-3.1/bin folder and start the jmeter.bat (Batch) file.
  2. Right click on “Test Plan” > Add > Threads User(s) > Thread Group.
  3. Right click on “Thread Group” > Add > Logic Controller > Recording Controller.
  4. Right click on “Thread Group” > Add > Listeners > View Results in Tree.
  5. Add HTTP(s) Script Recorder to Workbench by selecting Workbench > Add > Non-Test Elements > HTTP(s) Script Recorder option.
  6. Add Port value as 8080 and click “START” button in script recorder. The JMeter proxy will be started on localhost.

Next, we need to configure the mobile device as per the following steps.

iOS Device Proxy Configuration:

  1. Go to Settings > Wi-Fi option. (Note: Network should be same for both Mobile and Laptop/Desktop).
  2. Click on the Connected network.
  3. Select “Manual” option from HTTP Proxy.
  4. Set ‘Server value as system IP address and Port value to 8080 as per JMeter setup.
  5. Now start the application on the device and its each request will be recorded in JMeter.

 Android Jmeter

Android Device Proxy Configuration:

#1. Go to Settings > Wi-Fi option.

#2. Press and hold on connected network and Click ‘Modify Network’ option.

#3. This will open advanced settings from where we can modify Proxy.

#4. Change the Proxy to Manual.

Apache JMeter

#5. Set Hostname value as system IP address and Port value to 8080 as per JMeter setup.

Apache JMeter

#6. Click on ‘Save’.

#7. Now start the application on the device and its each request will be recorded in JMeter.

#8. Before running the application, make sure that HTTP(S) script recorder was started in JMeter.

#9. Once the application is started, the actions of the script will be recorded under “Recording Controller.”

#10. Once actions are done in the application, stop the script recording by clicking ‘Stop’ button in HTTP(S) script recorder screen.

#11. Now, expand the “Recording Controller” in JMeter. You can view all the Recorded scripts of whatever actions are done in the applications.

#12. Finally, click the ‘Play’ button. It will run recorded scripts as per your Threads setup.

#13. Click on “View Results in Tree”. Here you will see the result of your script.

 

Solutions for issues while testing the mobile application:

Here are the solutions for the issues that we have noticed while doing the load test in JMeter.

Issue 1

The application wasn’t getting loaded.

Solution

The issue is caused because our system was enabled with the firewall protection in security software. This is restricting network connection when setup with the proxy. We have disabled the firewall protection in antivirus settings.

Issue 2

Internet was not working with Proxy on the mobile device when we configure the mobile device and JMeter.

Solution

The reason might be that the system IP address is not configured with JMeter properties which mean the current IP address is not added to the JMeter properties file. We have added remote host IP address to property file as per the following steps.

  1. Open the browser and type IP address and Port number that is mentioned in JMeter to check whether it was configured. If browser shows Connect, then it is working fine otherwise if it is continuously loading, then it was not configured. Then we have to follow the below steps:
  2. Open apache-jmeter folder from the local drive and go to the bin folder.
  3. Open “jmeter (.properties)” file and find “Remote hosts and RMI configuration” section on this file.
  4. Under this section, add the system IP to remote hosts with comma delimited and save the file.
FacebookTwitterGoogle+Share
About Alagappan Narayanan

Alagappan Narayanan is an Associate software engineer at Vmoksha Technologies. He is passionate about exploring new automation technologies for mobile and web application testing. He loves reading novels, traveling, and trekking. He has done Master's in Computer Application at Bharathidasan University.



2 comments on “How to Test Native App Performance using Apache JMeter?

  1. Ram Lakshmanan

    Until I read this article, I didn’t know that Apache JMeter can be used for native app load testing. Good eye opener.

  2. Sagar Sheth

    Good job buddy!!!

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>