Recording mobile applications traffic is not much different from what we do to record scripts for web applications. All we have to do is put a proper proxy in place for mobile device. Follow the below steps for Android or iOS mobile.
1. Open JMeter and right-click the Test Plan>>Add >>Threads (Users)>>Thread Group.
2. Right-click the Thread group>>Add>>Logic Controller>>Recording Controller.
3. Right-click the Threads>>Add>>Listener>>View Results Tree (to see response data while running the script).
4. Add test script recorder by selecting Add>Non-Test Elements>HTTP(S) Test Script Recorder option.
5. Add '8080' as Port value and click the Start button. This will start the JMeter proxy on localhost.
6. On 'Start' of HTTP(S) Script Recorder you will see a dialogue box of Root CA Certificate just click the 'OK' button to get rid of it.
Android proxy configuration:
- Go to Settings > Wi-Fi option (the shared Wi-Fi network should be same for both Mobile and PC where JMeter is installed).
- Long tap the network which you are connected and click the 'Modify Network' option.
- And 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 PC IP address and 'Proxy port' to 8080 as we have set up in JMeter Proxy server.
- Click 'Save', now you can start running the application on your mobile device and its requests will be recorded in JMeter.
IOS configuration:
- Go to Settings > Wi-Fi option (the 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 from HTTP Proxy section.
- Set the 'Server' as your PC IP address and 'Port' to 8080 as JMeter proxy server.
Recording Mobile App Script:
- Before running any application, make sure that you click the 'Start' button on HTTP(S) Test Script Recorder in JMeter.
- Open the mobile application you want to test and play around with the functionality the way you want it to be recorded in JMeter for load testing.
- As we have set the mobile connection over JMeter's proxy, thus all test flow are recorded to JMeter's Test Plan.
- Once you are done with recording of all test flows of your application, stop the recording by 'Stop' button on '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.
After playing the Test Plan you can view the response of the each request in 'View Result Tree'.
Your script is ready for load testing. You may further refine it by adding correlation, parameterization etc.
You can also load test your mobile applications in FrugalTesting by just signing up to your account and uploading your mobile application script either as jmx script or you can just give the URLs of mobile app and set the load scenario and you are ready to start your load test.