`
jiguanghover
  • 浏览: 13473 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

Android自动化测试MonkeyRunner

阅读更多
   这两天正在学习Android的自动化测试工具MonkeyRunner,以下是我的一些学习记录:

1.首先启动emulator,然后把手机设备连接至电脑。
from com.android.monkeyrunner import MonkeyRunner,MonkeyDevice
device=MonkeyRunner.waitForConnection() //连接手机设备
device.installPackage("../XX.apk")//安装apk包到手机设备
device.startActivity
(component="com.example.android.apis/com.example.android.apis.ApiD
emos")//以ApiDemos为例,打开ApiDemos

device.reboot()//手机设备重启
device.touch(300,300,'DOWN_AND_UP')
MonkeyRunner.alert("hello")//在emulator上会弹出消息提示
device.press('KEYCODE_BACK', 'DOWN_AND_UP')
device.type('hello')//向编辑区域输入文本'hello'
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics