BreadcrumbHomeResourcesBlog How To Test Network Virtualization With Perfecto & Appium April 14, 2022 How to Test Network Virtualization With Perfecto & AppiumContinuous TestingMobile Application TestingAll mobile application developers and testers experience the same challenge: ensuring the application will respond gracefully and as expected no matter where their mobile applications are being used and under which conditions. Such conditions include airplane mode, no network connectivity, poor network connection and 2G, 3G or 4G network speeds. If a user is using a banking application and goes into an elevator or a subway, does your application handle that scenario gracefully? By testing real end user conditions, teams can ensure a high-quality mobile application user experience, advanced test automation coverage (and ensuring they will test the application before their users do).With Perfecto and Appium, you can simulate all the network scenarios we have listed above and more. You can use the out-of-the box-network user profiles to simulate cellular network speeds. You also have the flexibility to create your own custom network conditions by manipulating metrics like latency, packet loss and bandwidth in and out. We make it easy to simulate the cellular networks with user profiles, and if you need custom control, you have easy access to that as well. This blog will explore network virtualization testing with the integration of Perfecto and Appium in more detail. Related Resources >> User Simulation Testing for Mobile AppsTable of ContentsNetwork Virtualization Testing with Perfecto and Appium: CapabilitiesNetwork Virtualization, SimplifiedPerfecto User ProfilesNetwork Condition CustomizationTable of Contents1 - Network Virtualization Testing with Perfecto and Appium: Capabilities2 - Network Virtualization, Simplified3 - Perfecto User Profiles4 - Network Condition CustomizationBack to topNetwork Virtualization Testing with Perfecto and Appium: CapabilitiesPerfecto provides advanced network virtualization on top of open source Appium. Network virtualization plus additional Perfecto capabilities enables you to:Disable Wi-Fi or enable airplane modeSimulate network conditions using predefined profiles (2G, 3G, 4G)Simulate network conditions using a custom network profile (e.g., latency (ms), packet loss (%), Bandwidth in and out (kbps))Get the current network settingsUpdate network conditions or reset the device to default network configurationThe Perfecto continuous testing platform allows you to simulate these different network conditions in a manual test or an automated process by using Appium on both iOS and Android. We will dive into this below. For manual testing, you can also use the Perfecto UI and the “Network Virtualization” widget:Back to topNetwork Virtualization, SimplifiedWhen it comes to embedding network virtualization functionality using real mobile devices, Perfecto provides a testing platform with advanced network simulation functionality built on top of open-source Appium. Perfecto provides an easy to call method that can be added to your Appium scripts in about 5 to 10 lines of code, depending on what you are trying to do. Below I call the method in “startNetworkVirtualization” and send the necessary parameters to the method that implements the actual lines of code shown in a later snapshot in this blog.You can reference the documentation for a comprehensive explanation here.Back to topPerfecto User ProfilesPerfecto makes testing network conditions easy by providing you with a number of user profile network conditions already packaged for you and ready to use. These enable easily simulating different cell network speeds from 2G to 4G. Here is a small sample of User Profiles:Network to useLatency (ms)Bandwidth-inBandwidth-out2g_gprs_poor70030/2023g_umts_average140300/5003.5g_hspa_poor190900/2014g_lte_poor1207000/300014g_lte_average10010000/44000Back to topNetwork Condition CustomizationYou can also customize your network conditions. If you want to customize your own network speeds and other variables for advanced user scenarios you have that flexibility. It is as easy as providing the parameter and the value you want the parameter to simulate. Some of the more popular parameters include:packetLoss – Network packet losslatency – Latency applied on packets in the Networkbandwidth.in/bandwidth.out – Limitation of download and upload network bandwidth from the devicedelayJitter – Random latency variationYou can enable parameters when starting or stopping the network simulation that will capture Single User Performance information if you want to understand the HTTP traffic. You can generate HAR (Http Archive files) and PCAP or Packet capture files. Examples of these parameters can also be seen in the code snippet below. You can also capture device vitals using other built in methods provided by the Perfecto Platform. For understanding the load performance time, use UX timers. Look at the following code samples to see examples of using the out-of-the-box user profiles, updating the network settings, disabling the Wi-Fi, turning on airplane mode, and more. Below shows how you can call each command in a method. In the snippet above we show examples of calling one of the methods in Appium and Java.After the test has been executed, you will be able to see each line of code and corresponding action at the test step level within the Perfecto UI. You also have a rich set of artifacts to select from for testing, such as video recordings, Snapshots, Device Vitals, PCAP files, HAR files, Crash logs and other relevant data like page load time duration. Testers can quickly find the root cause of any issues they are investigating with all this data. You can share the data amongst your teammates so they can reproduce any issues quickly.Bottom LinePerfecto is the continuous testing platform that is always on and always ready to run. Perfecto provides the devices, desktop browser combinations and the infrastructure that can scale to support hundreds and thousands of automated tests every day.Perfecto also supports a wide range of advanced automation scenarios for iOS and Android on top of open-source Appium. In addition to network virtualization testing, these include:Biometric authentication – Face and Fingerprint IDVoice assistance testing/Audio injection – Audio to Text and Text to AudioImage Injection (QR code, Barcode, Check Scanning, etc).Optical character recognition (OCR) – Text and Image AnalysisAdvanced Authentication (2FA, OTP, Multidevice Flows)Apple pay and Google PayLocation Injection/GeolocationAnd more.These can be run and used as simply as the examples provided in the blog. If you’d like to have details on these, please reference our online documentation.Watch Network Virtualization Testing in Action See a custom demo of network virtualization testing with Perfecto and Appium. Get My DemoBack to top