How to Create a PCAP File
Pcap (Packet Capture) files consist of network packet data, created by capturing live network activity through capture tools such as Wireshark. The file, with a .pcap extension, can be used for packet sniffing and analyzing network activity. LoadRunner is capable of parsing .pcap files and converting them into a Vuser script.
This task describes how to create a .pcap capture file of network or application traffic to use in the preparation of a Vuser script. The primary uses for the .pcap file are:
- Web Services scripts. For details, see How to Create a Script by Analyzing Traffic (Web Services).
- Mobile Applications scripts. For details, see How to Create a Script by Analyzing Traffic (Mobile Applications).
- To generate a smaller, more manageable script, try to capture the network traffic only for the time that you perform actions in your application.
- When using external tools, make sure that all packet data is being captured and none of it is being truncated.
- For command line capture utilities, make sure to provide all of the required arguments.
The following sections describe how to create a capture file on several different platforms.
Create a capture file containing a log of all TCP traffic over the network on a Windows platform. Use a downloadable capture tool such as Wireshark. Make sure to save the Wireshark capture file in the tcdump format, as this is the format supported by LoadRunner.
Create a capture file using tPacketCapture on Android devices, or a similar application.
Copy the LinuxRH3 folder from LoadRunner installation disk DVD\Additional Components\mobileRemoteAgent, to the Linux machine.
- Run the following commands in the shell to give the two files executable permissions on Linux.
- chmod +x mongoose
chmod +x cgi-bin/mobileCGI.cgi
Perform a Change directory to the cgi-bin/ folder and run the following commands:
export SCRIPT_FILENAME=<Full path of mobileCGI.cgi>, where <Full path of mobileCGI.cgi> is the path to the mobileCGI.cgi file.
export QUERY_STRING=STARTRECORD=0, where 0 is the 0-based sequence number of the network interface in VuGen's Start Recording dialog box.
./mobileCGI.cgiThis generates a currentPCAP.pcap file which contains all traffic captured over the specified Ethernet interface.
Note: Step c. is primarily for troubleshooting, to make sure that your Linux environment was configured correctly. Once verified, you do not need to run this command again in future runs.
Issue: Your script is missing steps you recorded into a capture file.
You encounter the following warning in the Output Pane> Code generation tab:
Warning: One or more responses are missing or have missing packets. Therefore, a step may appear to be missing in the script. This issue can be caused if the recording was stopped before all the responses were received. If the script is generated from a .pcap file, check if the file has missing packets.
This error may be caused by unnecessary network activity on the recorded machine, which can cause the capturing application to drop packets.
Steps to Resolve: Ensure that the capturing machine has no unnecessary network traffic in the background.
Note: To workaround this issue, for Mobile Applications - HTTP/HTML scripts, you can circumvent this issue using the Recording options. Select Recording Options > HTTP Properties >Advanced >Generate steps with missing responses to generate steps for HTTP requests that are missing server responses.