JMeter - How to record Mobile Application traffic?

JMeter - How to record Mobile Application traffic?

2017 / 10 / 9

Load Testing, Performance testing, JMeter

Recording of mobile applications traffic is not much different from what we do to record script for web applications. All we have to do is put 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.

You might also like