monkeyrunner环境配置

1. 下载android sdk

2. 配置环境变量

ANDROID_HOME=${HOME}/Documents/soft/android-sdk-macosx
ANDROID_TOOLS=${ANDROID_HOME}/tools
ANDROID_PLATFORM_TOOLS=${ANDROID_HOME}/platform-tools
export PATH=${PATH}:${ANDROID_HOME}:${ANDROID_TOOLS}:${ANDROID_PLATFORM_TOOLS}

3. 在终端界面输入monkeyrunner,显示版本信息,即配置完成:

xxx:~ Vingo$ monkeyrunner
Jython 2.5.0 (Release_2_5_0:6476, Jun 16 2009, 13:33:26)
[Java HotSpot(TM) 64-Bit Server VM (Apple Inc.)] on java1.6.0_37

4. 通过monkeyrunner test.py,执行自动化脚本

PS:脚本中如果想用中文注释,需要在文件头部加入#coding=utf-8,否则会报错。具体可参考官网说明:http://www.python.org/peps/pep-0263.html