Setting up Android Testing
- Getting Started
Setting up Android Testing
In this section we will learn how to install and configure the necessary resources to start testing Android applications in suittest.
Android Testing can be achieved in 3 ways:
- Remote Mode: Connects to a Remote Farm
- NOTE: both Local Mode and Remote Mode use the same base engine, so scripts should be compatible in each mode
- Local Mode: requires Appium (See Android Installation -> Local Mode)
- Xamarin Mode: uses a different engine and a specific Android Runner (See Android Installation -> Xamarin)
To use a Remote Device
Included Remote Farm support:
- BrowserStack
- SauceLabs
To use a Remote Device:
- Create a device in Test Resources -> Mobile Devices
- Associate Farm accounts in the User Account page
- Device Farm accounts are connect at User level (each TestPath user can have a device farm account)
- To set the Android App as available for Remote Farm, select 'Remote' in the Engine field, this will indicate that the application is intended for Remote Farms
Extra Configurations:
- APK Path: the machine path to the APK to be installed (in case of remote, it can be the File URL that the remote farm provides after uploading the app)
- Device: the device to interact with
- Local and Xamarin: the Device ID (can be seen in running the ADB command: adb devices), this field is optional, if left blank, it will use the available connected device/emulator
- Remote: the Remote device created in Remote Devices page, right clicking the field will display all the Android devices available
- Host: the IP and Host of the Appium Server on Local Engine mode or Xamarin based Runner
- This field is optional, if left blank, it will use the localhost in the machine
- Package: the android app package
- This field is optional
- Start as Webview: Apps may a NATIVE and WEB context, setting this field will "force" the app to launch in WEB mode (if the app supoprts it)
Local Mode
Pre requisites for setting up Local Mode
- JAVA SDK Installed
- ANDROID SDK Installed
- System Environment variable must be set
- JAVA_HOME the value will be: C:\Program Files\Java\JDK VERSION
- ANDROID_HOME the value will be: %ANDROID SDK INSTALL FOLDER%
- PATH two lines must be added: %ANDROID_HOME%\tools and %ANDROID_HOME%\platform-tools
- Node.JS installed
Setting up Appium:
- Run the following NPM Command: npm i --location=global appium
- Install the Appium Driver with the command: appium driver install uiautomator2
- Starting the server (will be required each time you intend to automate a test) by running the command: appium
- in the command line, the available servers should be visible, both the localhost and the public. these can be used in the Host field in Test Resources->Appication->Host
NOTE: for Local and Xamarin Mode, when a real device is used, it must be in developer mode
NOTE: for Local Model, in order to install and configure Appium, Admin Rights might be necessary
Xamarin Mode
Pre requisites for setting up Xamarin Mode
- JAVA SDK Installed
- ANDROID SDK Installed
- System Environment variable must be set
- JAVA_HOME the value will be: C:\Program Files\Java\JDK VERSION
- ANDROID_HOME the value will be: %ANDROID SDK INSTALL FOLDER%
- PATH two lines must be added: %ANDROID_HOME%\tools and %ANDROID_HOME%\platform-tools
Intallation:
Download and Extract the Android zip file from an Android application in suittest Resources
Running in Admininistrator mode may be necessary, to stop requiring Admin user, try the following command:
netsh http add urlacl url=http://+:31994/ user=Everyone listen=yes
(in the argument "user", the value must be in the user's machine language)