Internet usage on mobile devices increases every year. Even though mobile screens became bigger, its size is still significantly smaller than PC monitors. As the result the website won’t appear correctly or the content will be too small. Because of that the websites needs to be adjusted for the current device. For this purpose there is usually created a mobile version of the website. These changes can cause different performance and stability issues. That’s why there is a need for testing on those pages as well.
There is a variety of devices and web browsers. The website to identify from what device/browser the request came from it will check the “User agent” header string which contains this information. In the later part we will show an example of the header.

For the load test we will be using JMeter. You can download the newest release from here: Download JMeter

After opening JMeter to record, first add the template for recording.
This template contains everything that is needed to record the test you want. The Test Script Recorder component will act as a proxy server. Within this component you can start and stop the recording and change the port number.
Instead of recording the test on the browser of the pc where is the JMeter running and changing the header parameters for every step, we will record the test using a mobile device connected to the network using Wi-Fi connection. Both the mobile device and the pc should be on the same network. For recording the proxy settings on the device should be changed. The proxy IP is the IP of the pc where the JMeter is running and the port number is what you gave in the Script Recorder.

To change the proxy settings on android devices do the next steps:

  1. Go to Settings > Wi-Fi
  2. Long tap on the connected network
  3. Modify network config
  4. Check Show advanced options
  5. Set the proxy settings

For iOS users the steps are the next:

  1. Tap Settings > General > Network > Wi-Fi
  2. Tap the settings for the Wi-Fi network
  3. Tap the Manual option in the HTTP Proxy section
  4. Set the proxy settings

For Windows phone users are the next:

  1. Go to settings > Wi-Fi
  2. Tap on the Wi-Fi network you are connected to
  3. Turn on the proxy switch
  4. Set the proxy settings

After everything is set, start the test record. Use the mobile device to browse on the website you want to test. The steps you did on the website should appear in the JMeters Recording Controller. When you are finished, simply click on the Stop button.

Now that your test script is done you can run it on your pc with multiple threads and because of the header it will be detected as the request was sent from a mobile device.
In the above picture you can see the User-Agent header. It contains the device OS type and version, browser and its version and some more information.
Note that if you application uses Https connection, not Http, you might need to copy the certificate that JMeter generated to be able to use the proxy.
At the end when you are done, don’t forget to turn off the proxy on your device.

Posted By Ivan Konjević

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>