How to configure JMeter and Mobile Device to Record Scripts for Native App in it?
The JMeter caters the need to load test functional behavior and measure performance. JMeter can be used for mobile performance testing along with the desktop web application. It provides features to prepare and run our mobile specific performance test scripts.
In order to configure JMeter and mobile device to record scripts for native app in JMeter for android and iOS platforms, you can refer the steps mentioned below.
It’s just similar to recording scripts for web applications. All we have to do is set correct proxy in place for the mobile device. However, you need to first prepare JMeter to record your scripts.
JMeter proxy configuration
1. Open JMeter and right-click the TestPlan>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.
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.
These were the configurations we need to make in JMeter in order to record the scripts. Now, we need to set up the JMeter proxy in mobile devices so that all mobile requests will be recorded in JMeter. Follow the steps mentioned below to set up proxy in android and iOS platforms.
Android proxy configuration
1. Go to Settings>Wi-Fi option.
2. Long tap the connected network and click the ‘Modify Network’ option.
3. From the opened dialog box, check the ‘Advanced options’ check box.
4. This will open advanced settings from which we can modify proxy manually. For this, set ‘Proxy’ option to ‘Manual’.
5. Now, set ‘Proxy hostname’ as your computer’s IP address and ‘Proxy port’ to 8080 as we have set up in JMeter configuration. Refer the below image to get an idea about this setup.
6. Click ‘Save’ option. You can now start running the application on your mobile device and its requests will be recorded in JMeter.
iOS proxy configuration
1. Go to Settings>Wi-Fi option.
2. Click on the connected network.
3. Select the ‘Manual’ option from HTTP Proxy section.
4. Set the ‘Server’ value as your computer’s IP address and ‘Port’ value to 8080 as JMeter configuration. Refer the image given below to get an idea about this set up.
5. You can now start running the application on your mobile device and its requests will be recorded in JMeter.
6. But, before running any application, make sure that you click the “Start” button on HTTP(S) Test Script Recorder screen in JMeter.
7. On clicking the “START” button you may get some Root CA Certificate message dialogue. Just click the “OK” button to get rid of it.
8. Once you start running your application, the steps of the script will be recorded under “Recording Controller”. See the screenshot below:
9. Once you are done with the recording of all steps of the test case, stop the script by clicking the “Stop “button at “HTTP(S) Test Script Recorder screen in JMeter.
10. Expand ‘Recording Controller’ and see all the recorded steps are displayed.
11. Now click the “Play” button displayed in green.
12. Click the “View Result Tree”.
13. Here you will see the execution result of your script.