Skip to main content

How to Test on Local Android Device

Test Evolve integrates with Appium to provide browser and mobile app testing on Android devices.

The device can be an emulator installed as an Android virtual device, or a locally connected real device (cabled or wireless).

Setup

  • Please follow the setup steps for mobile app here

Using an Emulator

  • Use Android studio to create a device
  • Start the device
  • Use ADB to list devices

Using a real device

  • Connect the device (cabled or wireless)
  • Use ADB to list devices

Locating your device id

This should be something like this, if you have followed the installtion rules:

adb devices

Look for a console output like:

List of devices attached
emulator-5554 device

The emulator-5554 value should be entered into the udid key in the mobile-app.yml.

default_config/browser.yml
source: local_device

local_device:
command_timeout: 60

mobile:
device_name: OnePlus 6
browser_name: Browser
platform_name: Android
platform_version: 10
udid: emulator-5554

Execute the browser tests as you normally would and the browser will open on your connected device.

Troubleshooting

Appium was not ready on 'http://127.0.0.1:4723/wd/hub/' after 5 seconds. (TestEvolve::LocalDevice::AppiumConnectTimeoutError)

This means that Test Evolve was unable to start Appium on your local machine.

If Appium is correctly installed on your machine it will respond in terminal to appium -v. Test Evolve outputs a log local_device_log.txt to the results folder, which should give you further information as to why Appium failed to start.

Error: Could not find aapt. Please set the ANDROID_HOME environment variable with the Android SDK root directory path.
aapt is the Android asset packaging tool and is include in the Android SDK.
  • The most common cause of this error is that the environment variable for ANDROID_HOME has not been setup correctly. In a new terminal session run echo $ANDROID_HOME.
    • If this returns the correct path to your Android SDK folder, it is worth restarting the terminal or IDE your are running the tests from to refresh the session to match what you’re seeing in terminal.
    • If this does not return a path, it is likely you need to set the variable in your profile. For example if you are using bash then it needs to be set in the .bash_profile file, if you’re using zsh then it needs to be set in the .zshrc file.
  • It is also important to add android tools, build-tools and platform-tools to your PATH. An example of this in the .bash_profile file would be as follows:
export ANDROID_HOME=/usr/local/opt/android-sdk
PATH=$PATH:$ANDROID_HOME/build-tools
PATH=$PATH:$ANDROID_HOME/platform-tools
PATH=$PATH:$ANDROID_HOME/tools