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.

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.
Configuration:
We know the Wiktionary application communicates with the en.wiktionary.org host.
Therefore the DNS will be configured to provide the IP address of the Loadrunner VuGen machine for the en.wiktionary.org hostname.
Replace the “mararc” configuration file with the following:
(substitute the IP 11.22.33.44 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 = "127.0.0.1,11.22.33.44" timestamp_type = 2 random_seed_file = "secret.txt" verbose_level = 3 csv2 = {} # specifies our custom domain and the zone file csv2["wiktionary.org."] = "db.wiktionary.org"
Create a new file in the MaraDNS directory with the name “db.wiktionary.org”:
en.% 11.22.33.44 # maps en.wiktionary.org 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
Test the name resoultion with forex robot reviews the following command (it should return the IP address of the VuGen host):
askmara Aen.wiktionary.org.

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. www.google.com. (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)

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

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

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.
Summary
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.
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
I downloaded maradns and made the configuration changes,
When I execute run_maradns, I get the below error:
Filename: db.wikitionary.org
Error: Unexpected character
Error is on line 1 in file db.wikitionary.org
context of error: en.% & (closing this file)
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.
cheers
Richard
Thanks for the update!
Hello Richard,
Back again!
In http://wiki.witopia.net/wiki/Google_Android_DNS_Settings
step 7:
“Fill in your local network static IP details
this does not pertain to the WiTopia VPN services and is local to your network only”
Please let me know, how do i get those details.(IP address,Gateway, Netmask)
I entered DNS 1 and DNS 2 as 8.8.8.8 and 8.8.4.4 respectively.
Hi,
8.8.8.8 and 8.8.4.4 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.
cheers
R.
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?
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.
cheers
Richard
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 127.0.0.1
# 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..
thanks
Raj
Hello,
I haven’t encountered this MaraDNS problem.
MaraDNS.org is not saying anything specific about this phenomenon at http://www.maradns.org/tutorial/troubleshoot.html
Try Mara on a different host to see if the problem is reproducable. Alternatively you could try a different DNS implementation (e.g dns service of a Linux host)
cheers
R.
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.
Hope you did not miss the trailing dot.
askmara Aen.wiktionary.org. <======
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-
askmara Aen.wiktionary.org.
the following problem is occuring
#Hard Error: problem getting response from DNS server
please help me …
Thnaks
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 ;(
Hi Richard,
I am getting the following error:
C:maradns-2-0-06-win32>askmara Aen.wiktionary.org.
# Querying the server with the IP 127.0.0.1
# 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.
Dee
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(en.wiktionary.org or http://www.google.com), the webpage not loading.
And the DNS console window shows, I am able to see below log running:
From IP: 192.168.1.104
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 192.168.1.104 Ugsp10-ssl.apple.com
Sabado, 18 de Mayo, a 20:12:12 (UTC) Log: Bad query received
I have turned off my firewall as well.
Please help.
Thanks
Anees
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!
regards
R.