我可以在真实设备上运行我的UIAutomator测试。以下是我采取的步骤:
<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>
有谁知道如何在模拟器上执行测试? (我正在使用Mac - emulator64-arm)
答案 0 :(得分:2)
您始终可以在Android设备模拟器上运行UIAutomator测试
您需要的只是找出连接到电脑的设备:
<platform-tools/adb devices
List of devices attached
emulator-5555 device
HTCDesireX device
获得模拟器的设备ID后,使用adb -s <emulator_id>
代替adb
,您的新步骤将是:
<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>