13Setting Up Android Mobile Devices for Automation Testing

About Setting Up Android Mobile Devices for Keyword Automation Testing

To run keyword automation testing on android mobile devices, the system requirements on Microsoft Windows are:

  • Microsoft® Windows® 10, 8, 7, 10 or Vista (32 or 64-bit)

  • 2 GB of RAM minimum, 4 GB of RAM recommended

  • At least 1 GB of RAM for Android SDK, emulator system images, and caches

  • 1280 x 800 minimum screen resolution

  • Java Development Kit (JDK) 8

  • (Optional) For accelerated emulator: Intel® processor with support for Intel® VT-x, Intel® EM64T (Intel® 64), and Execute Disable (XD) Bit functionality.

The following software is required to run keyword automation testing on a Microsoft Windows platform:

  • Android Software Development Kit. For more information, see Installing Android Software Development Kit on Microsoft Windows 7 Machine

  • Appium. For more information, see Installing Appium on Microsoft Windows.

The following is required to run keyword automation testing on the Mobile Application Framework (MAF):

SiebelMobile.apk

The tasks involved in setting up Android mobile devices for keyword automation testing are:

Installing Android Software Development Kit on Microsoft Windows 7/10 Machine

You can use the Android SDK (Software Development Kit) to create applications using the Android platform. The installer checks your machine to see if required tools like the Java SE Development Kit (JDK) are available and installs it if required. The installer saves the Android SDK Tools in a specified location outside the Android Studio directories.

Before installing the Software Development Kit (SDK) on a Windows 7 /10 machine, Java JDK 8 must be installed as a prerequisite.

To install the Android SDK

  1. Double click installer_r24.3.4-windows.exe to install the SDK.

    Note: Write down the name and location of the SDK saved on your system. You may have to refer to the SDK directory later if using SDK tools from the command line.

    After the installation is complete, the Android SDK Manager starts.

  2. Click Tools and then select Options in the Android SDK Manager.

    The Android SDK Manager – Settings screen appears.

  3. On the Android SDK Manager – Settings screen, enter the HTTP Proxy Server and HTTP Proxy Port details as required to bypass any firewall.

  4. Click Packages and then select the following packages to install in the Android SDK Manager:

    1. Install Android 5.0.1 (API 21)

    2. Install Android 6.0 (API 23)

    3. Install Extras.

  5. Click Install Packages.

To accept the license agreement for each package, double-click on each package name, and then click Install. The loading progress is shown at the bottom of the Android SDK Manager window. Do not exit the Android SDK Manager until loading has finished, otherwise the loading process will be cancelled.

Installing Appium on Microsoft Windows

Before installing Appium on Microsoft Windows, make sure that the .NET Framework 4.5 redistributable libraries are available.

To install Appium on Windows

  1. Download the Appium for Windows zip archive file and extract the files into a folder (for example, Appium) on your C: Drive.

  2. Double click appium-installer.exe.

  3. Install the Appium tool on your C: Drive.

  4. Set ANDROID_HOME as your Android SDK path and add the tools and platform-tools folders to your PATH variable.

Setting the ANDROID HOME Variable

You must set the ANDROID_HOME and the path environment variables after installing the different packages.

To set the ANDROID HOME variable

  1. Open the Environment Variable.

    1. Right-click My Computer, select Properties, and then select Advanced system settings.

    2. Go to the Advanced tab, and click Environment Variables.

    3. Click New under User Variables for <USERNAME>, and on the New User Variable dialog box that appears:

      1. Enter the following Variable name:ANDROID_HOME

      2. Enter the following Variable value: C:\SDK (SDK folder path)

      Note: The SDK folder path might vary depending on the SDK folder location
    4. Click OK to close the New User Variable dialog box.

  2. Click OK to close the Environment Variables window.

Setting the Path Variables

The following procedure shows you how to set the path variables for Android SDK. You must set the path variables to run the scripts on the Android device and emulator.

To set the path variables for Android SDK

  1. Navigate to and open the SDK folder (for example, C:\SDK).

    The tools and platform-tools folders are located in the SDK folder.

  2. Make a note of the path to both these folders, as follows:

    C:\SDK\tools

    C:\SDK\platform-tools\

  3. Open Environment Variables.

    1. Right-click My Computer, select properties, and then select Advanced system settings.

    2. Go to the Advanced tab, and click Environment Variables.

  4. Under System Variables, select the Path variable, and then click Edit.

  5. On the Edit System Variables dialog box that appears, edit the value for the system variable as required.

    • For example, append the full path to the \tools folder to the end of the line as follows: C:\SDK\tools.

    • For example, append the full path to the \platform-tools folder to the end of the line as follows: C:\SDK\platform-tools.

  6. Click OK to close all dialog boxes.

Verifying Android Installation and Configuration

The following procedure shows you how to verify if the Android is installed and configured correctly.

To verify if the Android is installed and configured correctly

  • At the command prompt, enter the following command and then press return:

    Android

    The SDK manager starts.

Testing Automation on an Android Device

To check the automation testing on a real device, you must connect the device (For example, Samsung Galaxy Tab) to the Windows 7 /10 machine with a USB cable.

Before running automation testing on a real device, make sure that WiFi and VPN connections are up and running.

To run automation testing on a real device

  1. Start your Android device.

  2. Tap Settings, and then General About Device.

  3. Tap the Build number seven times to enable Developer option.

  4. Return to the Settings menu and select Developer option.

  5. Tap the Developer options to turn on USB Debugging from the menu on the next screen.

Automation Testing on an Emulator

An emulator, such as an Android Virtual Device (AVD), is software or hardware that enables a computer system (for example, a Windows operating system) to behave like another computer system (for example, an Android platform). It provides a virtual environment of another system.

To run automation testing on an emulator on Microsoft Windows

  1. Start the AVD Manager as follows:

    1. Navigate to and open the SDK folder. For example: C:\SDK

    2. Double-click AVD Manager.exe to start the AVD Manager.

    The AVD Manager is used to create virtual Android devices.

  2. Using AVD Manager, create an android virtual device (emulator) as follows:

    1. Go to the Device Definitions tab, click Create Device, click the Android Virtual Device, and then click Create.

      The Create new Android Virtual Device window appears

    2. Enter values for the fields shown in the following table.

      Note: The values shown in the following table are example values for creating a virtual device using Galaxy Tab S 10.5. Values typically vary depending on the device you want to emulate. When creating a virtual device, use the following specifications:
      • Screen Size : 10.5 inches

      • Resolution : 2560 x 1600

      Field Description Sample Value

      AVD Name

      Name of the Android virtual device.

      AVD_for_Samsung_GalaxyTab_S

      Device

      Name of the Android device.

      Samsung_Galaxy_Tab_S

      Target

      Name of the target Android device.

      Android 5.0.1 - API [Level2]

      CPU/AB1

      The application binary interface.

      ARM (armeabi-v7a)

    3. Select the device and then click Start.

    4. Click Launch.

      The Emulator Starts.

  3. Update the XML file by setting the following parameters:

    • APPLICATION_TYPE= Mobile_Chrome - Automation on Chrome Browser

    • APPLICATION_TYPE= Mobile_Native Browser - Automation on AVD Native Browser.

      You must start the emulator manually before triggering a run since emulators take more time to start.

    • APPLICATION_TYPE=Mobile_SM_Android - Automation on Siebel MAF Application

    Deploying the Siebelmobile.apk

    The following procedure explains how to deploy the Siebelmobile.apk.

    To deploy the Siebelmobile.apk

    1. From the JDeveloper Menu, select Application, Application Properties, then Android2.

    2. Double click Android2 (MAF for Android) option.

      The MAF for Android Deployment Profile Properties dialog box is displayed. Ensure that the Build Mode is set to Debug and Application Name is SiebelMobile.

    3. Click OK.

    4. Navigate to Application, select Deploy Android2.

      The Deploy Android2 dialog box is displayed.

    5. Select Deploy application to package from the available list of deployment options.

    6. Check the Deploy message displayed in the lower pane of the Deploy Android2 dialog box.

      The message "Deploy the mobile application to an Android deployment package" is displayed in the lower pane.

    7. Click Finish.

      The mobile application is deployed successfully in the Android deployment package.