Android自动化测试Monkey
指定事件之后
# monkey -v -p com.android.camera --throttle 5000 --pct-anyevent 100 500
monkey -v -p com.android.camera --throttle 5000 --pct-anyevent 100 500
:Monkey: seed=0 count=500
:AllowPackage: com.android.camera
:IncludeCategory: http://www.77cn.com.cnUNCHER
:IncludeCategory: android.intent.category.MONKEY
// Event percentages:
// 0: 0.0%
// 1: 0.0%
// 2: 0.0%
// 3: 0.0%
// 4: 0.0%
// 5: 0.0%
// 6: 0.0%
// 7: 0.0%
// 8: 100.0%
最后count就是事件数设定为500
接下来看一个实例
Monkey的用法是$ adb shell monkey -p http://www.77cn.com.cn -v 500 ,首先,我们要找到应用程序在Emulator中所对应的包名,我一开始是一个个目录找得,前7步完成了这项工作,最终发现应用程序包都在data/data下,你可以在shell中cd data/data,然后ls查看当前Emulator中的所有应用程序包。
假如我们想对SDK中的APIDemos做压力测试,
1.在Eclipse中新建工程,将: \android-sdk-windows\samples\android-8\samples\ApiDemos添加到工程中点击运行,此时,他的APK应该加载到了Emulator上
2.在命令行输入adb shell
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库Android自动化测试手段之Monkey(7)在线全文阅读。
相关推荐: