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 generated .pcap file can be used for packet sniffing and analyzing network activity. VuGen can parse .pcap files and convert them to a Vuser script.
The primary uses for the .pcap file are:
- Web Services scripts. For details, see Create a Script by Analyzing Traffic (Web Services).
- Mobile Applications scripts. For details, see How to Create a Vuser Script by Analyzing a Captured Traffic File.
This task describes how to create a .pcap capture file of network or application traffic to use in the preparation of a Vuser script.
Create a capture file
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 tcpdump format, as this is the format supported by VuGen.
Note: For PCAP analysis, VuGen supports Wireshark versions 1.12.10 to 2.0.0 (not including 2.0.0).
Create a capture file using tPacketCapture on Android devices, or a similar application.Back to top
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.
Tips for creating .pcap files
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.
Troubleshooting missing packets
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.
Workaround 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.