Recording application traffic to a capture file is effective when you are unable to record an application using VuGen as is the case with mobile applications. A capture file is a trace file containing a log of all TCP traffic over the network. Using a sniffer application, you obtain a dump of all of the network traffic. The sniffer captures all of the events on the network and saves them to a capture file. To generate a smaller, more manageable script, try to capture the network traffic only for the time that you perform actions in your application.
Depending on your OS and device, you have many options on where and how to record a capture file. The table below lists the some of the locations and their related advantages and disadvantages:
|Capture File Source||
Supported by Mobile Sniffer Agent
|VuGen with configured hot spotA WiFi connection||
|Server||Record real traffic (both WiFi and cellular network traffic)||
You have the flexibility to record traffic with LoadRunner's mobile sniffer agent or record traffic with an external sniffer agent. The following flow chart illustrates the workflow for both methods:
Record Traffic with VuGen's Mobile Sniffer Agent
To record traffic on a remote server you first must manually install the mobile sniffer agent on your server by copying the relevant folder from <LR installation directory>\mobileRemoteAgent\ to a location of your choice on your server. The following table lists the supported operating systems and their corresponding file directories:
Once you have copied the folder, you initiate the process by typing a command line argument. For example, if you are recording in a Windows environment the command line string may look something like this:
mongoose-2.11.exe -e errorLog.txt -r "C:\Program Files\HP\LoadRunner\mobileRemoteAgent\win32" -C ".cgi" -p 80
Common command arguments and their descriptions:
Identify the remote sniffer agent extensions. Always "cgi".
Identify the port and optionally the ip address that you want the mobile sniffer agent to listen on.
Location of the mobile sniffer agent. Path must be absolute or the process will fail.
Restricts access to the mobile sniffer agent to a specific client identified by the client's IP.
|-e||Name of the error log.|
Note: Do not use –g option. (“digest user/password” ) There is a defect with this option.
Once a sniffer agent is installed, you manually start the agent and continue the Record and Analyze method from the Recording Wizard.
For details, see Recording Wizard
CGI Configuration File Options
The CGI configuration file is located in <LR installation directory>\mobileRemoteAgent\<win32/Mac/LinuxRH3>/cgi-bin/mobileCGI.conf
You can configure the following options:
The timeout session check stops when the process is sleeping due to traffic inactivity; the timeout session resumes as soon as the adapter is recording events.
Default = 102400
Maximum file size check stops when the process is sleeping due to traffic inactivity; the timeout session resumes as soon as the adapter is recording events.
Since traffic is first written to a buffer file and flashed to the hard drive, the maximum size may be exceeded.
Default = 0
Example of CGI configuration file
In order to record using a local host, you must first configure your machine as a hotspot. There are two ways to accomplish this, either by ad hoc or SoftAp.
Information about ad hoc and SoftAP is available from many publicly available web sites.
- Not all the devices support adhoc. For example, some versions of Andoid do not support it.
- Since our agent is using libpcap ( the same package used by Wireshark) not all network configurations will be supported by the mobile sniffer agent.
- In order for a hotspot to work, you first need to configure your firewall to support it.
- The hotspot may be implemented with NAT thus the address of the mobile will be identical to the hotspot machine.
Once hotspot as been configured on your local host, you continue to Record and Analyze method using the Recording Wizard.
For additional information about creating capture files, see How to Create a PCAP File.