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.
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.
- Launch your JMeter.
- Right-click the Test Plan >> Add >> Threads (Users) >> Add Thread Group.
- Right click the Thread group >> Add >> Logic Controller >> Add Recording Controller.
- Right-click the Threads>>Add>>Listener>>View Results Tree(To view the outcome of your script).
- Add > Non-Test Elements > Add HTTP’s test script recorder.
- Go to HTTP(s) Test Script Recorder and set port to 8888 (or any available port).
- Click on the Start button displayed on HTTP(S) Script Recorder
- Dialog box gets opened to allow Root CA Certificate and just click the “OK” button.
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:
- 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).
- Long tap on your current network connection and click the ‘Modify Network’ option.
- Check the checkbox for ‘Advanced Options’
- This will open the advanced settings from which we can modify the proxy manually. For this set the ‘Proxy’ option to ‘Manual’.
- Now, set ‘Proxy Hostname’ as your PC IP address and ‘Proxy Port’ to 8888 as we have set up in the JMeter proxy server.
- 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:
- 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).
- Click on the connected network.
- Select the ‘Manual’ option as HTTP Proxy.
- Set the ‘Server’ as your PC IP address and ‘Port’ to 8888 (or any available port) as the JMeter proxy server.
- 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.
- Launch the application on mobile and every request will be recorded in JMeter.
- Before running any application on the device, make sure you click the ‘Start’ button on the HTTP(S) Test Script Recorder in JMeter.
- 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.
- Since we have set the mobile connection to JMeter’s proxy, thus all the test flows are recorded in JMeter’s test plan.
- 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.
- 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.
- After playing the test plan you can see the response of each request in the ‘view result tree’ listener.
Your script is ready to run the load. You can further refine it by adding correlation, parameterization, etc.
Choosing a Global Software Development Partner to Accelerate Your Digital Strategy
To be successful and outpace the competition, you need a software development partner that excels in exactly the type of digital projects you are now faced with accelerating, and in the most cost effective and optimized way possible.