Flowchart: How It WorksPop-up this diagram to its own window
HP LoadRunner for Mobile demo by Yair
(from product Help folder).
Click play button to start, double-click on screen for full screen, or download wmv file. |
There are several types of mobile apps and ways to create VuGen scripts for each:
Mobile App Type | VuGen Recording Protocol |
---|---|
Pure Web Apps make no reference to hardware components on a mobile device. They run on (client-side) internet browsers which users invoke, then specify a URL on web server hosts. | Mobile TruClient VuGen protocol records user actions on internet browsers Mozilla Firefox or IE9, not webkit-based Google Chrome or Apple Safari browsers. |
Native Apps written in the programming language native to the device
and installed on the device from Apple's store or Android Market,
then visible as an icon among other apps on the device.
Hybrid apps are installed like native apps (to make it visible in app markets and as an icon on the device) not just to to display web sites in a thin wrapper around an internet browser window. Hybrid apps may invoke native hardware capabilities such as GPS, voice or video recording, barcode scanning, etc. SPA (Single Page Applications) apps make use of HTML5 storage capabilities to provide off-line functionality that reduce constant network chatter by referencing resources in its installer or rare downloads. |
Since VuGen is only interested in the load imposed by requests from an app
(and not goes on the screen), VuGen only emulates a mobile device's communication with web servers.
VuGen can invoke an Emulator to generate a script based on the Emulator's communication with the server. This is done with VuGen protocol Mobile App (HTTP/HTML) and Recording type "Record emulator". Since there is no emulator on Windows for Apple iPhone and iPad devices, requests from iOS devices to web servers are captured into a PCAP file using a network sniffer utility such as WireShark, WinPcap, or ltcpdump. PCAP files are imported within Mobile App (HTTP/HTML) scripts' option to Recording Wizard > Analyze Traffic . |
WARNING: A Physical Device (such as an iPhone or Android) connected via USB to the client VuGen machine is not supported as of this writing.
VuGen 11 Patch 3+ and up enables recognition of default web browsers on these mobile devices:
Safarai browser on:
WARNING: Each browser has its own limitations on how well it renders HTML5 and CSS3 (or at all).
HP's Functional Testing product, which includes QTP plus a product for testing web services, can be used to create scripts via add-ins that recognize and control mobile devices.
Since QTP controls the UI of the device (above the level where encryption occurs), QTP can be used even if LoadRUnner cannot figure out the proprietary MDM encryption mechanism between mobile devices and web servers.
Continuing on with a description of the flowchart
There are several ways to capture communications between a device and web server:
Here are the steps as seen on the video (from 7:55):
TruClient scripts are hidden behind its own visual interface.
Unlike other recording protocols (such as "Web(HTTP/HTML)") which do not automatically maintain state (unless correlations are manually coded in), TruClient scripts maintain a separate DOM4 (Document Object Model) for each vuser, so activities such as OAuth signing is performed automatically, without messy scripting.
CAUTION: This requires much more memory on load generators than other protocols for the same number of Vusers.
WARNING:
The internet browser that come with version 11 is IE 7 and Mozilla Firefox 3.6.3.
IE9 and Mozilla Firefox 9 are needed to support
HTML5 and CSS3
So web apps that depend on HTML5-capable Webkit internet browsers,
such as Sencha Touch and its
KitchenSink demo app
need to be recorded using the
Mobile App (HTTP/HTML) VuGen recording protocol
described next.
WARNING: Some websites have been coded to "degrade gracefully".
WARNING: Java options defined for other applications installed on the same Windows instance may interfere with the emulator's use of Java.
TIP: If you're switching among applications on Windows, consider creating command files to confidently change Java environment variable settings for each of them.
WARNING: Emulators may work within a VM in NAT mode, but not within HP's CAP (cloud) sessions.
As the video says (at 4:03), Apple iPhone and iPad (iOS) devices currently have no emulator running under MS-Windows OS.
WARNING: Emulators are defined for specific versions of devices. So some emulators may be for obsolete devices.
cd \ cd C:\temp\Android-Emulator "Run_Emulator(without Boot Animation).exe"
Quotes are needed because of spaces in the program name above.
TIP: To avoid this, replace spaces with underlines in the program name.
A Run Command window should pop-up to display Java options:
BlackBerry Playbook tablets require that .APK files be re-packaged into .BAR files. This can be done by an Eclipse plug-in, on a website, or using a command-line tool. This is necessary to add in code that recognize user gestures on the touchscreen instead of hardware keys on other Android tablets:
Requests from business BlackBerry devices travel through the internet and pass the company firewall into a BlackBerry Enterprise Server running front-end MDS (Mobile Data System) Services which manage traffic to/from corporate web app servers. So MDS must be setup when running the emulator.
One time only, install the BlackBerry device emulator:
Here are the steps:
TODO: Use a proxy server you setup.
This message can be safely ignored: "emulator: warning: opening audio input failed"
On first time use, enable within the emulated device HTTP traffic in and out of the emulator:
WARNING: Devices emulated in software can operate quite slowly.
Remember the port number (such as 5556) displayed on the window's upper right corner.
To determine what to specify, Run command fledge.exe /? for SCREEN: help GUI.
TIP: Because some emulators do not handle DNS lookups based on host names, browse to a website by its IP (such as the HP.com landing page at 15.216.110.22).
Within the simulated device, invoke a mobile app (icon) that generates network traffic (not the Calculator app).
Business process steps shown in the video (at 2:40) for
APP:
HP ePrint Android app
BTW, the iOS app is
here.
This has been removed from Android Market.
Regardless of emulator device, specify these Recording Wizard settings:
TOOL: SoftAP (Software-enabled Access Point) which this Wikipedia article calls tethering.
TOOL: connectify.me changes a Win7 machine to a WIFI router.
TOOL: Virtual Router Project on CodePlex is a free, open source Wireless Hosted Network implementation written in C#.
TOOL: SeventhGate for Windows 7 and Server 2008R2 is a lightweight open-source alternative to VirtualRouter.
Windows 7 or Windows 2008 R2 machines have
Wireless Hosted Network (Virtual Wifi) technology.
Windows Vista has
ad hoc network Wifi Hot Spot.
This requires Administrator permissions on your Windows client machine.
Proceed to Capturing Requests to a PCAP File
TOOL:
tcpdump is the Unix alternative to WinPcap.
Since Android has tcpdump by default,
run from the device's Linux OS command line, which requires the device to be
rooted.
adb -e shell tcpdump -s 0 -w /sdcard/capture.pcap host 10.0.2.2
"-s 0" specifies capture of packets without truncating their data.
adb pull /sdcard/capture.pcap
Proceed to Generate VuGen Script From a PCAP File
In order to record ALL traffic (both Wi-Fi and cellular network traffic), install software on the remote web server so that requests from devices are captured before being passed to the real web server.
CAUTION: In enterprise IT shops, the following is done by trusted system administrators with administrative permissions.
Instructions for a Windows server are below.
Instructions for a Linux server are here
cd \ cd C:\RemoteSniffer mongoose-2.11.exe -e errorLog.txt -r "C:\RemoteSniffer" -C ".cgi" -p 1080
-C ".cgi" specifies that the server invokes cgi files such as MobileCGI.cgi in the "cgi-bin" folder (based on the mobileCGI.conf file controlling it).
-p 1080 specifies the listening port. Change this to the actual one..
A full list of parameters is at http://code.google.com/p/mongoose/w/list
For example, if you want to use the web server that comes with LoadRunner:
Windows Start > All Programs > HP LoadRunner > Samples > Web > HP Web Tours APplications
opens a browser session to:
http://127.0.0.1:1080/WebTours/
go to this from a tethered phone.
This stops recording and the OS prompts for a location to save the resulting PCAP file.
Proceed to Generate VuGen Script From a PCAP File
folder LinuxRH3
CGI files are unreadable using text editors because it was compressed into a format that cannot be read by people.
CGI files are written in the Perl or C programming language.
TIP: The complexity of WireShark makes it necessary to spend a few bucks for some instruction in addition to visiting the Q&A forum and Wiki.
Sample files in the Supplements section of the Wiresharkbook website.
Laura Chapell is the queen geek user on WireShark.
Certification exams
are part of the ecosystem around
Wireshark.
Most tutorials are focused on security rather than performance:
YOUTUBE:
Introduction to Wireshark install of v0.99.8.
Analyzing Wireshark Logs 1,
2,
3 by Aniket Amdekar (aniket_zpm@yahoo.com).
DOWNLOAD: wireshark-win64-1.6.8.exe from https://www.wireshark.org/download/win64/all-versions
This site provides samples for readers of Jeff Heaton's book HTTP Programming Recipes for C# and Java.
YOUTUBE: Intro to Connectify by Alex
Alternately, use this Unix command:
tcpdump -r file.pcapng -w file.pcap
WireShark is designed to show everything that goes across the wire. HTTP sent from a browser is sent as application layer through by lower level TCP packets within Ethernet.
Wireshark’s filtering tutorial
Winpcap’s Filtering expression syntax, such as http.host matches "[.](cn|ru)$" for TLD from China or Russia.
If you created a Pcap file using WireShark, proceed to
Importing a PCAP File to Generate VuGen Script
But before you do, you may want to reduce large PCap files.
Batch processing large files after opening a command line console to type in and execute:
tshark on Windows machines, regular express parameters need to be within double sets of quotes such as this:
> tshark -r monsterfile.pcap -R "http.host matches ""(?!)[.](ru|cn)$""" -w dns.pcap (where -R is the filter).
WARNING: WinPcap needs to be started before lrtcpdump.
TIP: Use file suffix of ".cap".
Since no interface is specified, the response should be something like this:
Select Interface to Capture: 1)\Device\NPF_{E8BBCA8F-12FF-418E-BE04-5AD12F57F2F4} - Sun 2)\Device\NPF_{C53B077C-6E71-479F-B4F9-A9C49D3A6A9C} - Intel(R) 82577LM Gigabit Network Connection 3)\Device\NPF_{B58E33D8-EC9B-4286-88F4-88780F54567D} - Microsoft 4)\Device\NPF_{970C1394-D6FD-4160-9747-1F55E46C3A72} - VMware Virtual Ethernet Adapter 5)\Device\NPF_{079165EE-198E-4A19-8A56-5CE06045BB43} - VMware Virtual Ethernet Adapter Enter Your Choice:
For example, type 2 for the number associated with the Emulator or Network Connection. Leave the window running with the resulting message:
Capturing ...(press enter to stop)
NOTE: The PCAP file generated is not human-readable.
Proceed to Generate VuGen Script From a PCAP File
WARNING: No file is generated if the IP address specified here does not match what is in the file.
If you've forgotten what the IP addresses are, use a PCAP file reader utility to view the file.
Upload your PCAP file on-line to:
TOOL:
PCAP Web Performance Analyzer
A major source of load (and thus performance issues with mobile apps) may need to be emulated by a loop coded within VuGen scripts (run by perhaps a separate scenario group) to perform periodic polling of the server to see if there are more recent updates. Each older internet web browser must regularly do this perhaps every few seconds.
HTML5 web apps and Adobe Flash apps enable Push Notifications so clients (devices) can quietly wait for updates from servers.
Network Monitoring enables separation of time spent by the carrier network rather.
Differences in timing among different devices can also be captured by HP's BSM software.
Why doesn't mobile-boilerplate/wiki/Mobile-Performance-Tools mention LoadRunner?
TOOL:
jdrop.org stores large amounts of performance data (in JSON format) sent from mobile devices
to enable analysis of HTTP waterfall charts, HTTP headers, document source, etc. remotely on a larger desktop screen.
TOOL:
Network Miner reads from the wire or imports from .pcap files.