Mobile Performance testing for Native and Web App

Mobile Performance Testing with JMeter

Being a versatile tool, JMeter can be used for mobile performance testing as well. It provides handy features to prepare and run our mobile specific performance test scripts. Jmeter can help to do performance test for both Android and iOS mobile apps.

Prerequisites:

  • Computer and mobile device should be connected the same network.
  • Apache JMeter & Java JDK has to be downloaded and be installed on your computer.
  • Apache JMeter temporary Root CA must be installed. If it is not installed, HTTPS recording cannot be work.
Recording JMeter Scripts:

Below is the process to record a performance test script in JMeter for Android and iOS platforms.

JMeter proxy configuration

1> Open JMeter and right-click the TestPlan>Add >Threads (Users)>Thread Group.

Performance Testing 0

2> Right-click the Thread group>Add>Logic Controller>Recording Controller.

PT1

3> Right-click the Threads>Add>Listener>View Results Tree.

Performance Testing 2

4> Add test script recorder by selecting TestPlan >Non-Test Elements>HTTP(S) Test Script Recorder option. For Jmeter version greater than 4 user can add Test Script Recorder option by right clicking on TestPlan, Below version of Jemter user can add HTTP(S) Test Script Recorder option by right clicking on WorkBench.

Performance Testing 3

5> Configure the port number to 8080 as below

Performance Testing 4

These were the configurations we need to make in JMeter in order to record the scripts. Now, we need to set up the JMeter proxy in mobile devices so that all mobile requests will be recorded in JMeter. Follow the steps mentioned below to set up proxy in android and iOS platforms.

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.

Performance Testing 5

Mobile side configuration:
Installation of Apache JMeter temporary Root CA:

Where is Apache JMeter Temporary Root CA Located?

ApacheJMeterTemporaryRootCA is located in the Jmeter\bin folder. Certificates have limited lifetime, around 7 days only, if it is expired you will need to reinstall it. If you cannot find this file, When you start JMeter’s HTTP(S) Test Script Recorder, JMeter will generate “ApacheJMeterTemporaryRootCA.crt” automatically.

How to install JMeter Temporary Root CA file?

  • On your computer, rename the file with the .cer file extension, and send the file as an email attachment to an account that you can access from your Android device.
  • Check your email on the Android device.
  • Open the email and tap the attachments button.
  • Then tap the save button. This should save the certificate file to your Android device’s “Download” folder.
  • Next locate and tap the “Settings” icon. This may be located in the “Apps” menu or on one of the device’s home screens.
  • Tap the “More” button.
  • Beneath the “Permissions” header tap the “Security” button.
  • In the “Security” menu select the “Install from device storage” from beneath the “Credential storage” header.
  • Performance Testing 6

  • You will now be asked to “Name the certificate”, leave the certificate name as it is and tap “OK”.
  • Performance Testing 7

  • In some versions of Android, your device will ask if you want to use the certificate for “VPN and apps” or “WiFi”.
  • In the “Credential use:” options, you should select “VPN and apps”.
  • The phone will revert to the security menu and will inform you via a small pop up that the certificate is installed.
  • Performance Testing 8

  • You can check the Certificate is installed by tapping the “Trusted credentials” button.
iOS proxy configuration

  • Go to Settings>Wi-Fi option.
  • Click on the connected network.
  • Select the ‘Manual’ option from HTTP Proxy section.
  • Set the ‘Server’ value as your computer’s IP address and ‘Port’ value to 8080 as JMeter configuration. Refer the image given below to get an idea about this set up.
  • Performance Testing 9

Android proxy configuration

  • Go to Settings>Wi-Fi option.
  • Long tap the connected network and click the ‘Modify Network’ option.
  • From the opened dialog box, check the ‘Advanced options’ check box.
  • This will open advanced settings from which we can modify proxy manually. For this, set ‘Proxy’ option to ‘Manual’.
  • Now, set ‘Proxy hostname’ as your computer’s IP address and ‘Proxy port’ to 8080 as we have set up in JMeter configuration. Refer the below image to get an idea about this setup.
  • Click ‘Save’ option. You can now start running the application on your mobile device and its requests will be recorded in JMeter.
  • Performance Testing 10

6> You can now start running the application on your mobile device and its requests will be recorded in JMeter.

7> But, before running any application, make sure that you click the “Start” button on HTTP(S) Test Script Recorder screen in JMeter.

8> On clicking the “START” button you may get some Root CA Certificate message dialogue. Just click the “OK” button to get rid of it.

Performance Testing 11

9> Once you start running your application, the steps of the script will be recorded under “Recording Controller”.

10> Once you are done with the recording of all steps of the test case, stop the script by clicking the “Stop “button at “HTTP(S) Test Script Recorder screen in JMeter.

Performance Testing 12

11> Expand ‘Recording Controller’ and see all the recorded steps are displayed. See the screenshot below:

Performance Testing 13

12> Now click the “Play” button displayed in green.

13> Click on Veiw Result Tree.

14> Here you will see the execution result of your script.

Performance Testing 14

Conclusion

With a decade long experience in Mobile app testing services and quality assurance, we here at OdiTek Solutions have developed a unique business-driven test management and test execution approach that ensure that your mobile app delivers high quality user experience and at the same time have a lowest possible time-to-market. We use Apache JMeter not only for web testing but also a number of other test functions. We use Apache JMeter 2.7 to test performances of both static and dynamic resources like files, servlets and others. Our developers and testing engineers also use them to simulate heavy load on networks, servers or the object and test the strength; they also analyze and test the performance in different load conditions and types.

To know more about OdiTek’s Mobile App Testing with Jmeter, please drop an e-mail at – info@oditeksolutions.com

Share on FacebookTweet about this on TwitterShare on LinkedInShare on Google+

Leave a Reply

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

× How can I help you?