Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Jul 10, 2018 08:17

By Guruswamy B M

Network Virtualization in Perfecto

Analysis of Network traffic for specific scenario is very essential to analyse end to end flow. The benefits of Network traffic analysis are:

1. To Identify unintended or unnecessary requests are processed from client side.

2. Analyse API response with respect to status and specific values EX: EventID, SessionToken etc.

3. Amount of time taken to process individual API (Request and Response time) 

In Conventional Desktop or Laptop Traffics are captured and analysed by using browsers Inspect element, Firebug or some third party tools like Fiddler. Same requests will be processed from mobile devices as well. Since, continuous evolution of smartphones, replaces Desktop and Laptop usage in most of applications EX: Flight booking, Banking transactions, Insurance Registration etc. So, it is very essential in tracking and analyzing of network requests from mobile devices as well.

However, since mobile devices are light utilities as compared to regular Desktop or Laptop browsers, there will be no option like inspect element. so, need a way of capturing network requests processed.

Perfecto offers and provides network traffic recorder via 'Network Virtualization' command. There are two commands available "Network Virtualization Start" and "Network Virtualization Stop". Between Network Start and Stop command, all requests from client side will be captured and provided at the end of test execution in perfecto report.

Steps to Record Network Traffic

  1. Raise support ticket to enable MITM proxy in your cloud and follow link Generate and Analyze HAR files to generate HAR file.
  2. Initialise the driver (Appium or RemoteWebDriver)
  3. Initiate "Network Virtualization Start"
  4. Process the scenario EX: Flight Search, Booking, Hotel Search, Insurance Registration etc.
  5. Initiate "Network Virtualization Stop"
  6. Exit the test nd ensure Report is generated in Reporting interface.
  7. Launch the Execution Report.
  8. Download the Network Virtualization Zip file by clicking "Arrow Down" button in the report.
  9. If MITM proxy not enabled, downloaded zip file will not have HAR file and traffics are retrieved from generated Wireshark or PCAPPerf:

Wireshark:

Download Wireshark from http://www.wireshark.com. Open the PCAP file (if you have a .shunra file, set the file extension to .zip and unzip it to find the .PCAP file) with wireshark.

Using PCAPPerf:

Open http://pcapperf.appspot.com, upload the PCAP file and observe the waterfall chart/HAR file.

NOTE: 

  1. If above site unable display waterfall chart, download the "HAR" file and open using "HTTP Archive Viewer" Chrome Plugin. It can be downloaded from Chrome Plugin store.
  2. If requests are "https" secured, then needs to install SSL certificate in devices. Best way to capture traffic via MITM proxy.

NetworkHarFile.zip

Attached project is a Selenium Java based example. It launches "www.cnn.com" and wait for 25 secs, where user will manually play the video and all related requests are captured. At the end, pcap file automatically downloaded via Digital Zoom External API and placed in given location.

How to Use attached project:

 

1. Download the source Zip File

2. Update the Host, Username and Password Field in RemoteWebDriverTest.java

3. Set your "CQL_NAME" and the "PERFECTO_SECURITY_TOKEN" in the ReportiumExportUtils file. Follow this link to generate Security Token. http://developers.perfectomobile.com/display/PD/Security+Token

4. Update Destination folder address in ExportAllDataCodeSample.java (line num 34)

5. Run as Java application and upon launching cnn.com in device, manually click and play any video.

6. Wait for test execution complete.

7. View the results using PCAPPerf or HAR file as explained in above section.

 

Attached sample pcap and converted har file.

632E9899_16_53_47_3185_act.pcap

632E9899_16_53_47_3185_act.pcap


 

Network Requests made while playing any video in cnn.com