Cross Platform Network Calls Automation Varun Bhal – Lead Software Engineer Adobe Systems, Noida
Abstract As we are moving towards cloud technology, most of the products and web apps involve background network calls in their workflows nowadays Testing these calls give hard time to the tester, esp. the calls which are used to capture analytics, workflows registration, background update checks, etc. because you can’t see their impact on the UI Web proxy tools like Fiddler, Charles, etc. are used to test such calls, but it’s a manual process and not all tools are cross platform Tracing SSL requests (https calls) is again difficult with such tools and mostly supported in browsers only Tshark is a command line utility which can be used to sniff http/https network calls and can be easily hooked with any automation framework
E.g. : Dynamic dialogs, advertisements, notification services, etc. Types on network calls: Impact on UI E.g. : Dynamic dialogs, advertisements, notification services, etc. Easy to test and validate Easy to automate the UI test cases No impact on UI E.g. : Analytics calls, workflow registrations, background update checks, etc. Need to sniff network traffic to validate the calls Manual process Difficult to automate across different platforms Difficult to sniff and decrypt SSL requests How to solve this?
Solution : Use Tshark Command line network sniffing utility Comes bundled with Wireshark – open source network protocol analyzer tool Supports various filters while capturing or reading the packets Supports SSL requests decryption Can be easily hooked with any automation framework
Supported platforms :
Architecture : Web Server Client Tshark 3. Network calls 1. Start sniffing 2. Run test cases 4. Filtered results 4.1 Private key to decrypt https calls Automation Framework 3. Network calls 2. Run test cases Mobile app Private key Only for https calls Hotspot 0. Connected to hotspot Test machine
Various workflows to be covered : Read http requests Read http response Read https requests Read https response Sniffing on mobile platforms
Read http requests: Request : http://frinstall.macromedia.com/pub/flashplayer/update/current/version.xml?usr=admin&pwd=tester Sniff calls : tshark -a duration:30 -w "C:\\capture.pcap” Filter results : tshark -r "C:\\capture.pcap" -Y "http.request.uri contains flashplayer" -T fields -e http.request.full_uri Output : http://frinstall.macromedia.com/pub/flashplayer/update/current/version.xml?usr=admin&pwd=tester
Read http response: Request : http://frinstall.macromedia.com/pub/flashplayer/update/current/version.xml Sniff calls : tshark -a duration:30 -w "C:\\capture.pcap” Filter results : tshark -r "C:\\capture.pcap" -Y "http.content_type contains application" -X lua_script:extract.lua -X lua_script1:xml -T fields -e extractor.value.string > C:\output.txt Output :
Read https requests and responses: Sniff calls : tshark -a duration:30 -w "C:\\capture.pcap” Filter results : tshark -o "ssl.desegment_ssl_records:TRUE" -o "ssl.desegment_ssl_application_data:TRUE" -o "ssl.keys_list:10.5.132.38,443,data,privatewp.key" -r “C:\capture.pcap” -Y "ssl contains frinstall" -T fields -e tcp.stream Output -> 1,2 tshark -o "ssl.desegment_ssl_records:TRUE" -o "ssl.desegment_ssl_application_data:TRUE" -o "ssl.keys_list:10.5.132.38,443,data,privatewp.key" -r “C:\capture.pcap” -qz follow,ssl,ascii,1 > C:\outputs.txt
Read https response (cont): Output :
Sniffing on mobile platforms : Most of the mobile automation frameworks are driven from Desktop Connect DUT to the Desktop via hotspot Start sniffing on Desktop Perform test cases on DUT Filter requests and responses on Desktop using the technique discussed previously
Author Biography Varun is a Lead Software engineer at Adobe with 5.5 years of industry experience in automation and tools development. He is a part of Flash Runtime team at Adobe and have exposure of working in installation, deployment and runtime test automation across different platforms, including Mobile technology. This is where he came across with this practice and got successful in implementing it in automation.
Thank You!!!