Jmeter with Mobile

02 / May / 2016 by Parkash Goswami 8 comments

Jmeter is known for Performance and Functional testing tools for Web, but Jmeter can also record scripts for Mobile Applications. You can record and play script from Jmeter and quickly verify Mobile application performance and functional aspects. Jmeter has features to prepare and run our mobile specific performance test scripts. We need to do configuration on Jmeter and mobile devices, Find below mentioned steps to do configuration:

Steps to do JMeter proxy configuration:
1. Open JMeter and right-click the TestPlan>Add >Threads (Users)>Thread Group.

1

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

2

3. Right-click the Threads>Add>Listener>View Results Tree.

3

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

4

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

5

6. On clicking the “START” button you may get some Root CA Certificate message dialogue. Just click the “OK” button to get rid of it.

6

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(WiFi network should be same for both Mobile and Laptop/Desktop).
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.(WiFi network should be same for both Mobile and Laptop/Desktop).
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.

5. But, before running any application, make sure that you click the “Start” button on HTTP(S) Test Script Recorder screen in JMeter.

8

6. You can now start running the application on your mobile device and its requests will be recorded 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.

6

8. Once you start running your application, the steps of the script will be recorded under “Recording Controller”. See the screenshot below:

9

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.

FOUND THIS USEFUL? SHARE IT

comments (8)

  1. Mayank

    Hi,
    First i would like to thank you for your knowledge sharing,
    I followed all the steps mentioned above,after making proxy settings in the device(By adding system IP and Port address) i am unable to access
    the internet connection in device(Android).
    I am not able to open the app since there is no internet connection. But same way I test one another app then it is working to record the script. Please help here…….

    Reply
  2. CircusQA

    Is this for an application that doesn’t need internet connection because the application won’t connect after I used the proxy settings.

    Reply
  3. Girish

    Hi,
    First i would like to thank you for your knowledge sharing,

    I followed all the steps mentioned above,after making proxy settings in the device(By adding system IP and Port address) i am unable to access

    the internet connection in device(Android).

    I am not able to open the app since there is no internet connection.

    I opened the browser in device,it throwed me error like “You are offline,There is something wrong with the proxy server or the address is

    incorrect:ERR_PROXY_CONNECTION_FAILED”.

    Please share your approach to solve this.

    Note:Here my motto is to open the app and record the samples in jmeter.

    Thank You….

    Reply
  4. Prabhjot Bawa

    Hello Prakash
    I have tried all the above steps but I see a certificate error .I have also imported the certificate created in /bin directory to my phone but no luck.

    Any suggestions please

    Regards
    Prabhjot

    Reply
    1. Aditya

      e need appropriate JMeter Certificate and save it to our phone. ApacheJMeterTemporaryRootCA.crt can be downloaded from https://gist.github.com/borisguery/9ef114c53b83e553b635
      Download zip file for the certificate and send the certificate on mail. And install through mail. Once the certificate is installed phone will ask to apply a lock. And a notification appears showing Network may be monitored.
      Now click on Wi-fi Settings -> Long press on the Network you are connected to -> Click on Modify Network -> Advanced Settings -> Change Proxy to Manual -> In Proxy Host name enter the IP of your computer -> Set Proxy to 8080 -> click save
      Now we are set to start recording and running the scripts.
      Go to Jmeter -> HTTP(S) Test Script Recorder click Start (this would start the recording). Remember that the port in JMeter Global Settings and Mobile must be the same.

      Reply
    1. Parkash Goswami

      Thanks Vikas, We can do it for mobile web also, as it will capture all API’s which will be hit during recording script.

      Reply

Leave a comment -