Emulators let you install and replay tests on emulated devices. Digital Lab lets you test your devices using some of the popular emulators.
The supported emulators are Genymotion and Android SDK.
If you are using UFT One, you can also record and run Web tests using the Chrome emulator. For details, see Define settings for testing Web applications using the Chrome emulator.
This section describes how to set up AVD (Android Virtual Device) emulators on a Windows server or connector machine.
To create and launch an AVD emulator:
- Make sure your machine meets the requirements for Android Studio. For details, see the Android Developers documentation.
- Download Android Studio from the Android Studio download page.
- Run the setup, and include the Android Virtual Device (AVD) component. This component enables you to create a profile of a virtual device that can then be run on the Windows host and connected to the Digital Lab server via a device connector.
- From the Tools menu, select AVD Manager to open the AVD Manager.
In the AVD manager, create a virtual device or choose a predefined device. For details, see create and manage virtual devices in the Android Developer documentation.
To run an emulator that uses an AVD, double-click it or click Launch.
- The device appears in the lab as disconnected.
- The Digital Lab Agent is loaded automatically on the device. In the Digital Lab Agent, switch on the Service if needed.
- In the Digital Lab Device Lab, click refresh. The virtual device should appear in the mobile lab as an available test device. If it does not, stop the device by closing its window. Restart the connector. After the connector has started, restart the device emulation. Make sure that the filter is not hiding emulated devices.
The support for an emulator on Linux is via the command line.
- Download the Android SDK Manager for Linux from the Android Studio site. Scroll down to the Command line tools only section, and download the command lines tool package for Linux.
- Extract the contents of the zip file.
- Under the tcmdline-tools/bin folder, locate the sdkmanager tool.
sdkmanager --update [options]to update all installed packages. We also recommend to run
sdkmanager --"platform-tools" "platforms;android-28"to install the latest platform tools, including adb. For details, see command line documentation in the Android developers documentation.
Under the cmdline-tools/bin folder, locate the avdmanager tool. The AVD manager enables you to create a profile of a virtual device that can then be run on the Linux host and be accessed via the device connector. Run the line command to create a new profile for the device you want to emulate, for example,
avdmanager create avd -n test -k "system-images;android-25;google_apis;x86". For details, see the command line documentation in the Android Developers documentation.
The device should now appear in the list of existing virtual devices. For details, see Manage devices.
Create a test with an emulator
To prepare a test through an emulator:
- Install your emulator. Prepare your environment as described by your emulator's documentation.
When using Genymotion, configure the adb using the same settings as you used when installing the connector. In Genymotion, select Settings > ADB tab > Use custom Android SDK tools.
- If you have an ANDROID_HOME environment variable, use the same adb path as you used when setting up the connector for Use custom Android SDK tools in Genymotion.
- If you do not have an ANDROID_HOME environment variable, the connector uses the embedded adb tools. Set the Use custom Android SDK tools to <Digital Lab Connector>\connector\android-sdk-windows.
- Start the emulator. Choose the device to emulate.
Select an emulated device within your testing tool
(UFT One, Sprinter, or TruClient)in the Device selection area.
Perform actions on the app on the emulated device.
The default installation of the connector does not include the SDK emulator tools. If you would like to install the emulator on your Connector machine, perform the following steps:
- Download the Android SDK Tools package from the Android SDK website. We recommend SDK version 25.2.2.
- Extract the contents of the zip file to a folder named tools. Copy the newly created tools folder to the android-sdk-windows/ android-sdk-linux subfolder of the connector's installation folder.
- Open the tools folder and double-click the Linux shell command.
If you are accessing the SDK manager through a proxy server, enter the proxy information:
- Select Tools > Options to open the Settings dialog box.
- Enter the HTTP Proxy Server and Proxy Port values.
- Click Close.
In the Android SDK Manager window, choose the emulator images to install under the Tools node. Note that each Android version has its own image.
Tip: Use Intel x86 base images for better performance on machines that support Intel HAXM (Hardware Accelerated Execution Manager).
- In the SDK Manager Appearance & Behavior > System Settings > Android SDK > SDK Updates Sites tab, select Intel HAXM and click apply.
- Click OK to install the selected packages.
- Continue with opening the AVD to select devices, as described in Setting up an Android Emulator - Windows.
When you integrate with on-premises Genymotion emulator, Digital Lab shows the devices in the lab. This topic is relevant only for UFT Digital Lab.
The following are the prerequisites for integration with Genymotion Desktop emulated devices:
- A valid Genymotion desktop license
- A Genymotion desktop installation on a Windows machine with Digital Lab server
- An environment that supports the Genymotion gmsaas tool.
To set up the Genymotion desktop integration:
- Make sure you have installed the Genymotion client on the Digital Lab server. Only a Genymotion Windows client is supported. Sign in with your Genymotion credentials and register your license. For details, see the Help menu on the Genymotion website.
Configure Genymotion to use the Digital Lab ADB folder:
- In the Genymotion client settings, click the ADB tab and select Use custom Android SDK tools.
- Click Browse and locate the android-sdk-windows folder. The default folder is C:\Program Files\UFT Digital Lab Server\server\android-sdk-windows.
- Make sure that the dialog box indicates Android SDK tools found successfully.
- In Genymotion Desktop, start one or more virtual devices.
- Open the Device Lab tab to view the Genymotion virtual devices. (This may take several minutes.) For details, see Connect a Genymotion Cloud emulator.
With the Digital Lab Genymotion Cloud integration, you can access emulated Android devices on the Genymotion Cloud. This topic is relevant only for UFT Digital Lab and UFT Digital Lab Managed SaaS.
When you integrate with Genymotion Cloud, Digital Lab shows two virtual emulator devices, representing two common Genymotion templates.
Note that this integration is currently supported only with a Windows connector. You can use the connector embedded in the Digital Lab server, or a standalone connector.
Tip: You can add other Genymotion templates using the REST API.
The following are the prerequisites for integration with Genymotion Cloud emulated devices:
- A Genymotion Cloud trial or paid license
- Make sure that there is no gmadbtunneld running on the connector through which Digital Lab communicates with Genymotion Cloud.
Note: This integration is only available with a Digital Lab Professional, Trial, Enterprise, or Ultimate license. For more details, see Digital Lab licenses.
To set up the Genymotion cloud integration:
Open the Genymotion Integration page in the Administration settings.
- Provide the Genymotion Cloud username and password.
- Select the connector through which Digital Lab communicates with Genymotion Cloud, and provide proxy details if required.
Provide the Genymotion gmsaas install path on the connector or accept the default:
- Windows when using the connector on the server machine: <Digital Lab installation>\server\gmHome\gmsaas, by default C:\Program Files\UFT Digital Lab Server\server\gmHome\gmsaas.
- Windows when using a standalone connector (not on the server machine): <Digital Lab installation>\connector\gmHome\gmsaas, by default C:\Program Files\UFT Digital Lab Connector\connector\gmHome\gmsaas.
- Click Verify and Save. If you disable the integration or change the account settings, the virtual devices associated with the previous account are no longer available.
Open the Device Lab tab to view the Genymotion virtual devices. For details, see Connect a Genymotion Cloud emulator. To remove the emulated devices, disable the integration in the Administration settings.
Slow network issues
If you are having difficulties connecting to the devices due to network issues, you can increase the timeout value.
- Open the connector.properties file in the <Digital Lab_Installation_folder>\< server|connector>\conf folder.
- Search for common.config.appInstallTimeoutSecond. If it is missing, add it.
- Increase its value. The default is 60 seconds.
- The Restart button in Digital Lab is disabled for Android SDK emulator devices.
Certain apps cannot be installed on the SDK emulator with an ARM configuration. As a workaround:
In most instances, it is recommended to work with Android SDK with HAXM.
In the following instances use the ARM configuration:
For recording, close the remote device window and record on the device.
For replay, record on Genymotion or Android SDK x86 with HAXM, and replay in silent mode in UFT One.
Start the emulator in headless mode.
Reduce the resolution of the device.
Emulator support is provided for Android 4.1 and higher, and an API level of 19 or higher. For more information, see Device emulator issues.
The following guidelines apply:
- When using an emulator for devices with Android 6.0 and higher, SMS and Call simulations are not supported.
- In RHEL (Red Hat Enterprise Linux) environments earlier than RHEL 7, you cannot work with the remote screen viewer on emulators, because GPU acceleration is not supported (GPU acceleration is available on Windows machines, or Linux machines with RHEL 7 and higher.)
- Emulation is not supported for apps that have full control of the adb, such as Wandoujia.