Tahseen Adit
Tahseen Adit

Reputation: 184

How to test Android app in JMeter?

I have come to know that Configuring android device to use JMeter's Proxy, it is possible to record mobile application network activity via JMeter HTTP(S) Test Script Recorder.

I have an android app and a Web Admin Panel. The app has a sync button. When I press the button, the app syncs with the web admin panel. Now, I want to test the sync process in JMeter. I want to test that after pressing the button, the request to sync is sent appropriately to the server and the server responses correctly. Is it possible to test this in JMeter? If yes, then how to do it?

Upvotes: 3

Views: 12878

Answers (3)

surya
surya

Reputation: 21

JMeter records mobile application requests on HTTP(S) Script Recorder and it has features to prepare and run our mobile application performance test scripts. All we have to do is to configure JMeter and Mobile device. In JMeter, we can test both iOS and Android native applications.

Steps to Configure JMeter:

  1. Go to apache-jmeter-3.1/bin folder and start the jmeter.bat (Batch) file.
  2. Right click on “Test Plan” > Add > Threads User(s) > Thread Group.
  3. Right click on “Thread Group” > Add > Logic Controller > Recording Controller.
  4. Right click on “Thread Group” > Add > Listeners > View Results in Tree.
  5. Add HTTP(s) Script Recorder to Workbench by selecting Workbench > Add > Non-Test Elements > HTTP(s) Script Recorder option.
  6. Add Port value as 8080 and click “START” button in script recorder. The JMeter proxy will be started on localhost.

For more details you can see our Android Jmeter blog

Upvotes: 0

Dmitri T
Dmitri T

Reputation: 168147

You can record mobile application traffic with JMeter by following next steps:

  1. In JMeter:

    • Set up JMeter proxy server. The fastest and the easiest way is to use JMeter Template feature. From JMeter main menu choose:

      File -> Templates -> Recording -> Create
      
    • Expand "Workbench"

    • Click "HTTP(S) Test Script Recorder"
    • Click "Start"
  2. Locate ApacheJMeterTemporaryRootCA.crt file in JMeter's "bin" folder

  3. Transfer it to mobile device somehow (i.e. send by email) and install it
  4. Disable cellular data on the mobile device and enable Wi-Fi
  5. Configure mobile device to use machine running JMeter as a proxy (port number will be 8888)

References:

N.B. On some Android operating system versions you won't be able to configure SSL proxy using external application like ProxyDroid

Upvotes: 4

Green eye samurai
Green eye samurai

Reputation: 57

Yes, this is possible. As you mentioned you need to add test script recorder, then you should take port number from it (8080 by default). Also you can select you thread group inside target controller for more convenient using. Then you need to configure proxy on your android device.

  1. Settings.
  2. Wifi
  3. Long tap on wifi network that you are connected
  4. Modify network.
  5. Advanced option
  6. Proxy > Manual
  7. Than input your host and port (from JMeter script recorder). And Save

Press start button inside test script recorder and JMeter will listen to your device. NOTE! Device will have network connection only when Script recorder is started. So if you need to check single request, I recommend you to reach to this step without proxy, then configure it, start script recorder and record only this needed step. After you done with recording, press Stop button. Do not forget to turn off your proxy on device.

Upvotes: 1

Related Questions