In this article we are going to do performance testing on Android mobile device using JMeter. Here are the steps to do this.
Step 1: Ensure that Mobile and Laptop (desktop) should be connected to the same wifi network. Make Developer Options enabled on your Mobile phone and you are able to connect to your laptop using Android Debug Bridge(ADB).
Have a look at this article and follow steps, in-case your mobile is not connected through ADB: https://www.guru99.com/adb-connect.html
Step 2: Goto JMeter on your desktop/ laptop and Add Template - RECORDING, from File option to get a test plan with HTTP(S) Test Script Recorder.
Set Port for Recording, we will configure the same port on our mobile.
Step 3: Click Start for recording, it will generate a certificate "ApacheJMeterTemporaryRootCA.crt" inside "JMeter/bin" folder. Copy the certificate and put it inside any folder of your phone.
Step 4: Install Root CA Certificate on the Mobile device.
Goto Your Wi-Fi -> More -> Install Network Certificates. Choose from the folder your have saved in Step 3.
Step 5: Configure mobile phone, set IP and PORT. Note down the IP of the Laptop/ Desktop system.
Goto Wi-Fi in your phone -> long press on the Wi-Fi you are connected -> Manage Network Settings enter below things.
IP Settings: DHCP
Proxy Hostname: IP Address of your Laptop/ Desktop
Proxy port: the port you have entered on JMeter for recording. See Step 2.
Step 6: Start Recording, actions you do on your mobile device should get recorded in JMeter.
Step 7: Run & Validate the results.
Thanks for reading.