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.

Open JMeter and right-click the TestPlanAdd Threads (Users)Thread Group.

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

Right-click the Thread groupAddLogic ControllerRecording Controller.

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

Right-click the ThreadsAddListenerView Results Tree.

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

Add test script recorder by selecting AddNon-Test ElementsHTTP(S) Test Script Recorder option.

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

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.

Set the ‘Server’ value as your computer’s IP address and ‘Port’ value to 8080 as JMeter configuration.

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.

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:

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

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.

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.

Expand ‘Recording Controller’ and see all the steps recoded are displayed.

Expand ‘Recording Controller’ and see all the steps recoded are displayed. (2)

11. Now click the “Play” button displayed in green.

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.

Here you will see the execution result of your script.

You might also like: JMeter as Functional test tool

SHARE THIS

Get A Free Quote

24 thoughts on “How to configure JMeter and Mobile Device to Record Scripts for Native App in it?

  1. Thanks for the article. I am connected to Mobile but Jmeter only records the steps which are performed on Chrome not for Native App’s.

    What steps do i need to perform for recording native app ?

  2. Hi, I have followed your above steps configure mobile device to jmeter. But am getting the following error:
    jmeter.protocol.http.proxy.Proxy: [49755] Problem with SSL certificate for ‘api.smoot.apple.com’? Ensure browser is set to accept the JMeter proxy cert: Received fatal alert: unknown_ca
    2016/09/26 12:53:45 WARN – jmeter.protocol.http.proxy.Proxy: [49756] Problem with SSL certificate for ‘configuration.apple.com’? Ensure browser is set to accept the JMeter proxy cert: Received fatal alert: unknown_ca
    2016/09/26 12:53:47 WARN – jmeter.protocol.http.proxy.Proxy: [49757] Problem with SSL certificate for ‘api.smoot.apple.com’? Ensure browser is set to accept the JMeter proxy cert: Received fatal alert: unknown_ca

    Can anyone help on this and steps to add SSl certificate.

  3. Hi I have followed all the steps but when i am checking the server status in browser (http://localhost:8887) following error comes:

    org.apache.http.client.ClientProtocolException: URI does not specify a valid host name: https:////
    at org.apache.http.impl.client.AbstractHttpClient.determineTarget(AbstractHttpClient.java:817)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:805)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:517)
    at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:331)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)
    at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1146)
    at org.apache.jmeter.protocol.http.proxy.Proxy.run(Proxy.java:240)

  4. How can i set the proxy number For Jmeter, Which Number i have to set whether it is Server port Number or Default Port Number as 8080

  5. @fouziyahanif:disqus,
    You can set same Proxy port number 8080 for jMeter on your machine and device.

  6. Hello Everyone,

    We have a webapplication that have two authentications, one is with normal
    username and password, second one is with OTP enter process. For this user
    has to register their mobile phone numbers, so that they can receive OTP
    via database

    1. May i know, how to do jmeter test for this kind of scenarios?
    2. I have no idea, how to automate the OTP enter process via Jmeter
    (because the OTP will be received in database . Does anyone come
    across with same scenario and any idea of how to do it?

  7. When I configure my android device as per the instructions, My phone doesnt seem to be connecting ot internet after that. I have tried with different port too like 9122, 8088, but no go

  8. I am connected to Mobile through Jmeter which are performed on for Native App’s. ,i installed Jmeter root certificate file in Mobile. my Device andDesktop connected in same network .but i’m not able to get response in app.

    • Hi @Kannappan,

      After starting the test recorder please follow these below steps :
      1. Go to mobile screen ( But make sure your mobile proxy is already connected with Jmeter Tool on same port)
      2. Navigate all flows what you want to record on your mobile app.
      3. Check all recorded Value and correlate it .
      4. Execute the recorded scenario .

      Hope this clears your query. Please let me know if you need more information.

  9. When I connected to the jmeter my chrome browser going to offline?
    Here are the steps what i did
    1. Go to Wi-Fi setting option in mobile.

    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. start running the application on your mobile device
    7. Here chrome going to offline when I try to browse my application.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.