JMeter - How to record Mobile Application traffic?

October 9, 2017
3 mins
Share this post

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.

record traffic in jmeter add thread

2. Right-click the Thread group>>Add>>Logic Controller>>Recording Controller.

 record traffic in jmeter Recording Controller

3. Right-click the Threads>>Add>>Listener>>View Results Tree (to see response data while running the script).

record traffic in jmeter view results tree

4. Add test script recorder by selecting Add>Non-Test Elements>HTTP(S) Test Script Recorder option.

record traffic in jmeter test script recorder

5. Add '8080' as Port value and click the Start button. This will start the JMeter proxy on localhost.

record traffic in jmeter Start Jmeter Proxy

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.

record traffic in jmeter root ca certificate

Android proxy configuration:

  1. Go to Settings > Wi-Fi option (the shared Wi-Fi network should be same for both Mobile and PC where JMeter is installed).
  2. Long tap the network which you are connected and click the 'Modify Network' option.
  3. And 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 PC IP address and 'Proxy port' to 8080 as we have set up in JMeter Proxy server.
  6. Click 'Save', now you can start running the application on your mobile device and its requests will be recorded in JMeter.

IOS configuration:

  1. Go to Settings > Wi-Fi option (the shared Wi-Fi network should be same for both Mobile and PC where JMeter is installed).
  2. Click on the connected network.
  3. Select the 'Manual' option from HTTP Proxy section.
  4. Set the 'Server' as your PC IP address and 'Port' to 8080 as JMeter proxy server.

Recording Mobile App Script:

  1. Before running any application, make sure that you click the 'Start' button on HTTP(S) Test Script Recorder in JMeter.
  2. 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.
  3. As we have set the mobile connection over JMeter's proxy, thus all test flow are recorded to JMeter's Test Plan.
  4. 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.
record traffic in jmeter

Now run your Test Plan by clicking the 'Play' button displayed in green.

record traffic in jmeter

After playing the Test Plan you can view the response of the each request in 'View Result Tree'.

record traffic in jmeter

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.

Our blog

Latest blog posts

Discover the latest in software testing: expert analysis, innovative strategies, and industry forecasts
Testing Tools
Software Testing

16 Best Load Testing Tools Reviewed For 2024

Rupesh Garg
Rupesh Garg
October 8, 2024
5 min read
AI and Testing

Enhancing test efficiency using AI for Performance testing

Rupesh Garg
Rupesh Garg
October 7, 2024
5 min read
Automation Testing
Software Testing

The Role of AI in Improving Automation Testing and QA

Rupesh Garg
Rupesh Garg
October 4, 2024
5 min read