Recording mobile device traffic for performance testing iPhone, iOS, Android and Windows Mobile applications with HP Loadrunner

Want to write a performance test that will replicate the traffic of an actual hardware device such as an iPad, iPhone or Android device? This article covers a useful technique to capture and replay the network traffic of real mobile devices.

In my previous blog the Android SDK’s emulator has been used to run the mobile client application and Loadrunner Virtual User Generator’s (VuGen) recorder was wiretapping and recording its network packets.
The approach is quick and comfortable, however it may not be viable for other platforms.
For instance, there is no iOS emulator for Windows (and there is no VuGen for MacOS either).

To bridge over the distance between the device and the recorder, the client device’s traffic should be diverted to the Loadrunner VuGen machine for capturing.
To accomplish this, a custom DNS server has to be set up.  This makes the device believe that VuGen is the server it is connected to. Loadrunner VuGen acts as a proxy – so it captured packets between the device and the web-server and generates a performance script from the traffic.

The DNS server is configured to spoof the mobile device and diverts the client to the Loadrunner recorder. VuGen records the traffic and forwards the traffic between the client and the server

Please note, that this is a general solution, and not restricted solely to mobile devices. However for conventional applications it is in most cases easier to reconfigure the application to reach out to a different host, but this is usually not the case for mobile apps.

Connect the device and the HP Loadrunner VuGen host

This can be done practically e.g. using a Wifi router. Link the router to your Loadrunner PC via Ethernet and connect the mobile device to the Wifi.

Get the mobile application ready

The mobile application must be installed onto the device and checked to see if is working as expected (and communicates well with the web service)
In this example I used the Wiktionary example from the previous blog.

Set up the custom (spoofing) DNS server

I’ve chosen to use MaraDNS , an open source DNS implementation, due to its simplicity and multiplatform availability.
Download MaraDNS and unzip it.
For simplicity I placed it on the Loadrunner VuGen machine, but it can be run on any other host if you like.


We know the Wiktionary application communicates with the host.
Therefore the DNS will be configured to provide the IP address of the Loadrunner VuGen machine for the hostname.

Replace the “mararc” configuration file with the following:
(substitute the IP below with the IP address of the appropriate network card of the VuGen machine – use the ipconfig command to find that out)

# defines the ip addresses on which the DNS service will be available
# here is the localhost and the Ethernet card's IP of the Loadrunner:
ipv4_bind_addresses = ","
timestamp_type = 2
random_seed_file = "secret.txt"
verbose_level = 3
csv2 = {}
# specifies our custom domain and the zone file
csv2[""] = ""

Create a new file in the MaraDNS directory with the name “”:

en.% # maps to the Loadrunner host

If the firewall is active on the machine, add an exception for MaraDNS, so that the mobile device could access the DNS port (UDP port 53).

Also ensure, that there is an an exception for port 80 (for Loadrunner VuGen).

Test DNS

Start the DNS server via typing run_maradns

Startup logs of the spoofing DNS server

Test the name resoultion with forex robot reviews the following command (it should return the IP address of the VuGen host):

Testing the settings of the DNS server using askmara for the hostname

Configure the device to use the custom DNS

Point the device to use the DNS sever you have just set up.
Here is how to accomplish this on devices running Android, iOS (iPhone/iPad) and Windows Mobile.

Configure the recording in VuGen

As the Wiktionary test application uses HTTP protocol, a HTTP/Web script should be created. In the Start Recording dialog the recorded application will be Internet Explorer, and the opened URL is something easy to identify and remove later from the script, e.g. (For some reason recording does not work if you specify a program that does not network, like notepad.exe or calc.exe, so the good old Internet Explorer is used to fire up recording)

Start recording Internet Explorer, just to fire up Loadrunner

Before starting the recording, in the Recording Options/Port Mapping add a mapping to forward local port 80 towards First the network capture level is set to “Socket level and WinInet level data”.

Adding Traffic forwarding rule at the Recording Options/Port Mapping dialog in Loadrunner VuGen

Then the traffic forwarding rule is to be created by clicking “New Entry”.

Specify the port forwarding from the local computer (running Loadrunner VuGen) towards the webserver to which the device application is connected to

As it is intended to forward the network traffic arriving to the local 80 port, ensure that you do not have a running webserver on your computer (e.g. make sure to shut down Windows Internet Information Server if it is running). Also check, that your firewall does not block incoming traffic to TCP port 80 (add an exception if necessary)

Start recording network traffic

Start the recording. First, Loadrunner VuGen starts the Internet Explorer and opens the url you specified. This traffic should be ignored and removed from the recorded script.

Check if recording works properly, e.g. by starting a new browser instance on the VuGen machine and opening e.g. http://localhost. The request must be properly forwarded and served as well as recorded by Loadrunner (watch the recording toolbar’s counter rolling)

Finally the execution of the test steps on the device can be started. Ensure that the recording toolbar is indicating captured network traffic. Stop recording auto generate and postprocess the Loadrunner script the usual way.


I hope this DNS spoofing technique makes it easier for some of you to performance-script network traffic of smart devices like iPhone, Android and Windows Mobile with HP Loadrunner 9.5x. This technique can be used if hard device usage can not be avoided.

As you have noticed, far more preparation work is needed in contrast to the hardware emulation solution. If applicable, the usage of emulators and scripting upon interface specification might be preferred.

The nice thing about this technique is that no special software is needed…the next thing I’m going to look at is HP Loadrunner 11 Mobile Testing capabilities … unfortunately there’s no online documentation available to see what are the features of that solution  … So I’ll have to discover it myself : – )

Note: Did you find this useful? If you have any useful tips/techniques then please get in touch and share!  Full credit will be given.

17 thoughts on “Recording mobile device traffic for performance testing iPhone, iOS, Android and Windows Mobile applications with HP Loadrunner

  1. Richard,

    In LR11 (there’s a bit of documentation that’s available form the vugen help menu) you can record an emulator, use LR as a proxy, or import TCPdump files into the Mobile Protocol

    the simplest solution for us was to import a TCP dump file, as our app is encrypted

    we swapped the encryption key on the firewall for a dummy one we could export, recorded the tcp conversation, and then swapped the key back

    exported the tcp file and imported it into LR with the dummy key

    (as our dummy key was passwordless and LR didn’t like it too much, I added a password to the key file using openssl on my macbook)

    I’m not sure which licence bundle Mobile comes in, I suspect RIA, but as all the calls are web_submit_request with json bodies, in our case, I can convert the script to regular web easily with copy and paste… but I will lose the ability to emulate the phone network bandwidth

  2. I downloaded maradns and made the configuration changes,
    When I execute run_maradns, I get the below error:

    Error: Unexpected character
    Error is on line 1 in file
    context of error: en.% & (closing this file)

    1. Hi,

      thanks for the feedback.
      This is typo in the article. WordPress keeps on inserting nonbreaking spaces (ampersand nbsp) into the code section…
      This is corrected now above.


    1. Hi, and on the referenced page are Google’s public DNS servers.
      What you should set is the IP address of the host where your MaraDNS runs.


  3. Hi,
    I have a question on the first step – “Connect the device and the HP Loadrunner VuGen host”. Let us say I am trying this at my home. I have a broadband connection & wi-fi router that comes with it. I connect my desktop with vugen & iphone to the WI-FI (wireless connection) . If I use CUSTOM DNS on my desktop and set the iphone to use my desktop as a DNS server, will it work. Will the traffic generated by my iPhone app will flow like “iphone > DNS server (desktop) > Wi-fi router > internet?

    1. Hello Selva,

      yes, this will work with your home wifi setup.
      The network traffic will look like this: iPhone >> MaraDNS (resolve IP address from hostname), iPhone >> Loadrunner VuGen >> Internet.


  4. Hi Richard,

    First of all, it is a great article about load testing mobile apps. I installed maradns in my Windows XP laptop but unable to make it successfully work. i tried to run the maradns running in my localhost, but get the below error.

    # Querying the server with the IP
    # Hard Error: Timeout

    I tried multiple options including running it as localhost without connecting to internet but still get the same error. There is no windows firewall enabled in my Windows XP. Not sure what else to try to validate if any port is disabled. I could see that maradns is listening in port 53.

    Any help is appreciated..


      1. Hi Richard,
        how can i add an exception for maraDNS so that the mobile device could access the DNS port (UDP port 53).

        Any help is appreciated.

  5. when i m executing that-
    Start the DNS server via typing run_maradns

    command prompt is closed automatically .
    and when i m running that command-
    the following problem is occuring
    #Hard Error: problem getting response from DNS server
    please help me …

    1. Hi Yogita,

      You need to run the mkSecretTxt.exe file first so that it creates a secret.txt file in the Maradns directory.

      Thereafter you can click on the Maradan.exe file in the same directory. It should solve the problem of the window closing.

      But thereafter in the next step, I also ran into the error mentioned by Raj ;(

  6. Hi Richard,

    I am getting the following error:

    # Querying the server with the IP
    # Hard Error: Problem getting response from DNS server

    I was just following the steps that you have given above.

    Any suggestions what I might be doing wrong?

    Thanks for your help.

  7. Hi Richard,

    I have made set up as per your post and have DNS ip address(MaraDNS host IP) in my iphone 4 wifi setting.
    After which when I browse thro internet( or, the webpage not loading.
    And the DNS console window shows, I am able to see below log running:

    From IP:
    Sabado, 18 de Mayo, a 20:12:12 (UTC) Log: I’m sorry Dave (recurse attempt)
    Sabado, 18 de Mayo, a 20:12:12 (UTC) Log: Message received,processing
    Sabado, 18 de Mayo, a 20:12:12 (UTC) Query from
    Sabado, 18 de Mayo, a 20:12:12 (UTC) Log: Bad query received

    I have turned off my firewall as well.

    Please help.


    1. Hello Anees,

      Here are my suggestions:

      – Check if your configuration contains the desired entries (wiktionary, google, etc.).
      – Make sure, that these hostnames are resolved by MaraDNS properly – use the askmara command (see the example in the article). Note, that DNS servers are very picky on the syntax, every bit counts!

      Also note, that you won’t be able to access the tested website, till you have not set up the port mapping in HP Loadrunner.
      – If you need to access any other hosts during your test (but you do not intend to record with Loadrunner) – add those hostnames with the original IP into your MaraDNS configuration, so that your device could resolve and access them properly.

      I hope this helps!

Leave a Reply

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