How to do mobile performance testing using JMeter?
Introduction
So the purpose of
creating this document is to help people who know Web Testing in JMeter but not able
to do Mobile app testing Using JMeter and Most of
us are unaware that JMeter can also be
used for performance testing of Android and IOS apps.
I will be Keeping
this document Simple and easy and after going through this document you will be
able to Record and Replay Scripts in JMeter.
Prerequisites: JMeter version
4.0, Android phone (KitKat or above) or iPhone (version 10 onwards)
JMeter Configurations
1.
Launch JMeter -> Navigate to File option -> Templates
-> Select Recording -> Click on Create (So now we have added all the necessary
parameters for Recording scripts)
2. 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 set up a 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.
Android proxy configuration:
Ø We must download
JMeter Certificate and save it to our phone. ApacheJMeterTemporaryRootCA.crt
can be downloaded from https://gist.github.com/borisguery/9ef114c53b83e553b635
Ø Then we must
install that certificate to the Android device
Steps to add certificate
to the android device (Step can be different for different android versions)
· Open your phone's
Settings app.
· Tap Security
Advanced. Encryption & credentials.
· Under
"Credential storage," tap Install a certificate. Wi-Fi certificate.
· In the top left,
tap Menu.
· Under "Open
from," tap where you saved the certificate.
· Tap the file. ...
· Enter a name for
the certificate.
· Tap OK.
Ø 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.
Recording Mobile App with JMeter
Ø 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.
Running a Load Test and
monitor the performance
Running the Mobile app test
is similar web application.In JMeter go to thread groups and alter the number
of threads, Ramp up period and Loop count.
Ø Thread means the
number of active users.
Ø Ramp-Up is the
amount of time JMeter must take to send threads for execution.
Ø Loop Count is used
to specify the number of times to execute the Performance Test.
Add Listener
will now add a listener. Let us add View Results Tree Listener
under the Thread Group (User) node. It will ensure that the results of the
Sampler will be available to view in this Listener node element.
To add a listener −
·
Open the context menu
·
Right-click the Thread Group (Users)
·
Choose Add → Listener → View Results Tree option
Comments
Post a Comment