14Setting Up Android Mobile Devices for Automation Testing
Setting Up Android Mobile Devices for Automation Testing
This chapter shows you how to set up Android mobile devices for keyword automation testing. It includes the following topics:
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
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.
Click Tools and then select Options in the Android SDK Manager.
The Android SDK Manager – Settings screen appears.
On the Android SDK Manager – Settings screen, enter the HTTP Proxy Server and HTTP Proxy Port details as required to bypass any firewall.
Click Packages and then select the following packages to install in the Android SDK Manager:
Install Android 5.0.1 (API 21)
Install Android 6.0 (API 23)
Install Extras.
Click Install Packages.
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
Download the Appium for Windows zip archive file and extract the files into a folder (for example, Appium) on your C: Drive.
Double click appium-installer.exe.
Install the Appium tool on your C: Drive.
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
Open the Environment Variable.
Right-click My Computer, select Properties, and then select Advanced system settings.
Go to the Advanced tab, and click Environment Variables.
Click New under User Variables for <USERNAME>, and on the New User Variable dialog box that appears:
Enter the following Variable name:ANDROID_HOME
Enter the following Variable value: C:\SDK (SDK folder path)
Note: The SDK folder path might vary depending on the SDK folder locationClick OK to close the New User Variable dialog box.
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
Navigate to and open the SDK folder (for example, C:\SDK).
The tools and platform-tools folders are located in the SDK folder.
Make a note of the path to both these folders, as follows:
C:\SDK\tools
C:\SDK\platform-tools\
Open Environment Variables.
Right-click My Computer, select properties, and then select Advanced system settings.
Go to the Advanced tab, and click Environment Variables.
Under System Variables, select the Path variable, and then click Edit.
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.
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 a 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
Start your Android device.
Tap Settings, and then General About Device.
Tap the Build number seven times to enable Developer option.
Return to the Settings menu and select Developer option.
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
Start the AVD Manager as follows:
Navigate to and open the SDK folder. For example: C:\SDK
Double-click AVD Manager.exe to start the AVD Manager.
The AVD Manager is used to create virtual Android devices.
Using AVD Manager, create an android virtual device (emulator) as follows:
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
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)
Select the device and then click Start.
Click Launch.
The Emulator Starts.
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
From the JDeveloper Menu, select Application, Application Properties, then Android2.
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.
Click OK.
Navigate to Application, select Deploy Android2.
The Deploy Android2 dialog box is displayed.
Select Deploy application to package from the available list of deployment options.
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.Click Finish.
The mobile application is deployed successfully in the Android deployment package.