BreadcrumbHomeResourcesBlog How To Test On Simulators & Emulators With Perfecto May 10, 2021 How to Test on Simulators & Emulators With Perfecto Mobile Application TestingBy Sreevatsa SreerangarajuVirtual devices can help teams shift left and catch bugs earlier, faster, and resolve them more easily during mobile testing. By combining virtual and real devices, organizations benefit from a more robust mobile testing strategy, enabling comprehensive application quality at a much lower cost. In this article, we will show you how to test on Perfecto emulators and simulators using Appium scripts. Perfecto has long supported open-source frameworks like Selenium and Appium. The integration supports 100% Appium code, while also offering multiple benefits to run tests in the same way as your end users. Table of ContentsPerfecto Simulators & Emulators Getting Started With Virtual Devices Executing a Parallel Test on a Virtual Device for a Native Mobile App Bottom Line Table of Contents1 - Perfecto Simulators & Emulators 2 - Getting Started With Virtual Devices 3 - Executing a Parallel Test on a Virtual Device for a Native Mobile App 4 - Bottom Line Back to topPerfecto Simulators & Emulators What do emulators and simulators look like in Perfecto? Below you will find a view of our Samsung Galaxy S9 Emulator and Apple iPhone 12 Pro Max Simulator on the Perfecto UI. These are just two examples of many virtual devices that are available in Perfecto’s device lab. Back to topGetting Started With Virtual Devices To work with virtual devices on Perfecto, you only need to add one capability to the code. (Note: “DeviceName” capability is not available for virtual devices. If your code relies on DeviceName, then you need to refactor your code to add the above capabilities, in order to run the same Appium script on virtual devices.) Setting Base Desired Capabilities for Android (Emulator) For example, see this Base Desired Capabilities for a Samsung S9 virtual device. DesiredCapabilities capabilities = new DesiredCapabilities("", "", Platform.ANY); capabilities.setCapability("platformName", "Android"); capabilities.setCapability("platformVersion", "9"); capabilities.setCapability("manufacturer", "Samsung"); capabilities.setCapability("model", "galaxy s9"); capabilities.setCapability("useVirtualDevice", true); The last line of code says that the device the user needs is a virtual device. Since the platform is an Android, this virtual device will be an emulator. Setting Base Desired Capabilities for iPhone (Simulator) Now, let us look at the Base Desired Capabilities for an Apple iPhone Xs device.DesiredCapabilities capabilities = new DesiredCapabilities("", "", Platform.ANY); capabilities.setCapability("platformName", "iOS"); capabilities.setCapability("platformVersion", "14.2"); capabilities.setCapability("manufacturer", "Apple"); capabilities.setCapability("model", "iPhone Xs"); capabilities.setCapability("useVirtualDevice", true); To automate tests for a web application, we need to add the browserName capability. This would be “Chrome” for emulators and “Safari” for simulators. //For Emulators capabilities.setCapability("browserName","Chrome"); //For Simulators capabilities.setCapability("browserName”, Safari"); Executing a Parallel Test With Virtual Devices for a Web App In the video below, you will see how quickly you can execute a parallel test on Perfecto virtual devices for a web application. To automate tests for a native application, provide the following paths after you set Base Desired Capabilities: Android: .Apk path and AppPackage iOS: .App path and Bundled – iOS Simulators support only .app, unlike .ipa for real devices //For Emulators capabilities.setCapability("app","PUBLIC:ExpenseAppVer1.0.apk"); capabilities.setCapability("appPackage","io.perfecto.expense.tracker"); //For Simulators capabilities.setCapability("app","PUBLIC:Simulators/InvoiceApp.app.zip"); capabilities.setCapability("bundleId","io.perfecto.expense.tracker"); Back to topExecuting a Parallel Test on a Virtual Device for a Native Mobile App See how a test execution happens on Perfecto virtual devices for a native application. Code Sample Back to topBottom Line As you can see, getting set up with virtual devices does not take long. The executions go quickly too! Testing on simulators and emulators is simpler than ever with Perfecto. Pairing these virtual devices with real devices allows organizations to test faster and get the coverage they need. Watch Simulators and Emulators in Action See a demo of virtual devices with Perfecto. Get DemoBack to top
Sreevatsa Sreerangaraju Partners Senior Manager & Continuous Testing Evangelist, Perfecto by Perforce Sree works in Perfecto’s pre-sales and has over 15 years of experience in automation testing out of his total 17 years in the IT Industry. He constantly guides customers towards continuous testing and encourages clients to do more end-user like testing with Perfecto cloud. He ensures clients are getting value by implementing proper CI/CD processes.