Working with emulators
Emulators let you install and replay tests on emulated devices. Mobile Center lets you test your devices using some of the popular emulators.
The supported emulators are Genymotion and Android SDK.
If you are using UFT, 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.
- On the server machine, go to the server/android-sdk-windows folder. If you cannot access the one on the server machine, or if you want to set up the emulator on a Connector machine, see Install SDK tools and emulator images manually.
- Open the SDK Manager.
- If required, enter the proxy settings. If you don't enter these settings, you will not be able to access the various tool packages. To enter these settings, select Tools > Options, and enter the proxy information. Enable the Use download cache and Force options.
- From the SDK Manager, install (at least) the following packages: Android SDK Tools, Android SDK Platform-tools, Android SDK Build-tools, and Android API (API 19 and higher). SDK Platform, Samples for SDK. Click the Install packages button. Make sure to install all API versions for OS version 4.2 and higher.
Open the AVD (Android Virtual Device) Manager. The AVD manager allows you to create a profile of a virtual device that can then be run on the Windows host and connect to the Mobile Center server via a Mobile Center connector.
In the AVD manager, go to the Android Virtual Devices tab. Click Create to generate a profile for the device you want to emulate. Enter the relevant details.
In the CPU/ABI type field, select Intel Atom (x86). In the Emulation Options, select the Use Host GPU check box to enable graphics acceleration. Click OK.
The device should now appear in the list of existing virtual devices.
Select the device and click Start. Once the emulated device starts, it should appear in the Mobile Center console as an available test device. If it does not, stop the device by closing its window. Restart the Mobile Center Connector. After the Connector has started, restart the device emulation.
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 Mobile Center 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 environmental variable, the connector will use the embedded adb tools. Set the Use custom Android SDK tools to <Mobile Center Connector>\connector\android-sdk-windows.
- Start the emulator. Choose the device to emulate.
Select an emulated device within your tool (UFT, Sprinter, or TruClient) in the Device selection area.
Record actions on the app within the emulator.
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 same folder as the android.bat file, located in a subfolder of the connector 's installation, android-sdk-windows.
- Double-click android.bat.
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).
- Expand the Extras node and select Intel x86 Emulator Accelerator (HAXM installer).
- Click Install <x> Packages.
- Continue with opening the AVD to select devices, as described in Setting up the Android SDK Emulator.
The Mobile Center Genymotion cloud integration allows you to access emulated Android devices on the Genymotion cloud.
This integration requires either an Indie or Business Genymotion license. For details, see the Admin page in the Genymotion documentation.
Note: This feature is only available with a Mobile Center Professional, Trial, Enterprise, or Ultimate license. For more details, see Mobile Center editions.
To set up the Genymotion cloud integration:
- Install the Genymotion client on the Mobile Center server or connector machine. 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 site.
Configure the Mobile Center service to run as the same user used in the Genymotion setup. For details, see Run the services as a different user.
Configure Genymotion to use the Mobile Center ADB folder:
- In the Genymotion client settings, click the ADB tab and select Use custom Android SDK tools.
- Click Browse and locate the platform-tools sub folder. For example, in Windows the default folder will be android-sdk-windows/platform-tools.
- Make sure that the dialog box indicates Android SDK tools found successfully.
- Open the Genymotion Integration page in the Admin Settings. Use the default gmtool path or provide a full path to the executable file. Click Verify and Save.
Add the Genymotion emulated device list in one of the following ways:
- Use the Mobile Center admin list API call. For details, see REST API reference for Mobile Center.
- Use the gmtool --cloud admin templates command.
Start the emulated device. Use the Mobile Center REST API or run:
gmtool --cloud admin startdisposable "<template_selected >" "<device_name>
The device will now appear in the Mobile Center lab as an emulated device.
To stop the emulated device, use the Mobile Center REST API or run:
gmtool --cloud admin stopdisposable "<device_name>"
To remove the emulated devices, run:
gmtool --cloud admin stopall Integrations Impact
Caution: The stopall command will stop all GenyCloud devices under the current account, even if those devices were not started by Mobile Center. We recommend not to use this command unless you are certain that all cloud device owners are aware of the deletion.
GenyMotion provides additional ways to manage cloud devices, such as the GenyCloud web app.
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 <MC_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.
- When using the Android SDK emulator, it is recommended to use HAXM instead of the ARM configuration. Make sure the Intel x86 Emulator Accelerator (HAXM installer) is installed in the Android SDK Manager. Then, run the setup located in <android-sdk folder>\Extras\Intel\Hardware_Accelerated_Execution_Manager\intelhaxm-android.exe.
- The Restart button in Mobile Center 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.
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 emulators.
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) 6.5 environments, you cannot work with the remote screen viewer on emulators, since this version of RHEL does not support GPU acceleration. (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.