How to do mobile performance testing using JMeter?
June 30, 2021
Prerequisites:
JMeter version 3.0, Android phone (versions above Jellybean) or iPhone (version 8.0 onwards)
JMeter Configurations
- Launch JMeter -> Navigate to File option -> Templates -> Select Recording -> Click on Create (So now we have added all the necessary parameters for Recording scripts)
- 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.
Mobile side Configurations
iOS proxy configuration:
- Go to Settings–>Wi-Fi option.
- Click on your connected network.
- Select ‘Manual’ option from the 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.
- 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 the user can see the actions getting recorded on JMeter.
Run Mobile Web Application
By far you must have understood the mobile configuration process. Now, it’s time to open the web application you need to test and utilize it as you typically do.
- Begin the application on mobile and its every request will be recorded in JMeter.
- Before running the application, ensure that HTTP(S) script recorder was launched in JMeter.
- Once the application is ready, you’ll see script actions will be recorded under the section “Recording Controller.”
- When actions are performed in the application, click the ‘Stop’ button in HTTP(S) script recorder display to stop the script recording.
- Presently, extend the “Recording Controller” in JMeter. You can see all the Recorded scripts of whatever activities are completed in the applications.
- Tap the ‘Play’ button. This will run recorded scripts according to your Threads setup.
- Finally, click on the “View Results in Tree”. Here you will view the outcome of your script.
Subsequent to recording actions from the mobile device and ultimate revision of the load script, we will run a load test using BlazeMeter’s abilities. Let’s learn that further.