I am able to run my UIAutomator test on a real device. Here are the steps I've taken:
<sdk_dir>/sdk/tools/android create uitest-project -n <test_name> -t 1 -p <workspace_dir>/<test_name>
cd <workspace_dir>/<test_name>
ant build
<platform-tools/adb push
<workspace_dir>/<test_name>/bin/<test_name.jar> /data/local/tmp
<platform-tools/adb shell uiautomator runtest <test_name.jar> -c <package_name.classname>
Does anyone know how to execute the test on an emulator? (I am using Mac - emulator64-arm)
You can always run UIAutomator tests on Android device emulator
All that you need is to find out what devices are connected to your pc:
<platform-tools/adb devices
List of devices attached
emulator-5555 device
HTCDesireX device
once you have the device id of emulator, use adb -s <emulator_id>
instead of adb
, you new steps would be:
<platform-tools/adb -s emulator-5555 push <workspace_dir>/<test_name>/bin/<test_name.jar> /data/local/tmp
<platform-tools/adb -s emulator-5555 shell uiautomator runtest <test_name.jar> -c <package_name.classname>