1,adb install xx.apk:把指定的安裝包apk文件安裝到測試設(shè)備中
2,adb shell monkey :給指定的設(shè)備發(fā)送壓力測試,number是要測試的次數(shù)举娩。執(zhí)行這個(gè)命令的效果就相當(dāng)于有個(gè)手指在你的手機(jī)上亂點(diǎn)。我嘗試了10000次,結(jié)果費(fèi)了好一會兒功夫才把手機(jī)恢復(fù)到我想到的效果。
3,adb shell monkey -p pkgname :同上面效果一樣,只是對指定包名(pkgname)apk進(jìn)行測試。
4,Monkey高級參數(shù)的應(yīng)用
4.1.throttle參數(shù):指定事件之間的間隔時(shí)間
adb shell monkey -throttle :milliseconds是時(shí)間值 ,單位毫秒
4.2.seed參數(shù):偽隨機(jī)數(shù)生成器的seed 值汉额。
adb shell monkey -s :如果用相同的 seed 值再次運(yùn)行 Monkey ,它將生成相同的事件序列榨汤。
4.3.touch:設(shè)置觸摸事件
adb shell monkey -pct-touch :指定touch事件的百分比percent
4.4.motion:設(shè)置動(dòng)作事件
adb shell monkey -pct-motion :指定motion事件的百分比percent
4.5.trackball:設(shè)置軌跡球事件
adb shell monkey -pct-trackball :指定軌跡球事件百分比percent
4.6.nav:導(dǎo)航事件設(shè)置
adb shell monkey -pct-nav :指定基本導(dǎo)航事件百分比percent
4.7.majornav:設(shè)置主要導(dǎo)航事件
adb shell monkey -pct-majornav :設(shè)定主要導(dǎo)航事件百分比percent蠕搜,兼容中間鍵,返回鍵收壕,菜單按鍵
4.8.syskeys:設(shè)置事件
adb shell monkey -pct-syskeys :設(shè)定系統(tǒng)事件百分比percent妓灌,比如HOME,BACK,撥號及音量調(diào)節(jié)等事件。
4.9.appswitch:啟動(dòng)Activity事件
adb shell monkey -pct-appswitch :設(shè)定啟動(dòng)activity的事件百分比percent
4.10.anyevent:不常用事件設(shè)置
adb shell monkey -pct-anyevent :設(shè)定不常用事件地百分比
4.11.crashes :程序崩潰事件設(shè)置
adb shell monkey -ignore-crashes :忽略崩潰和異常事件
4.12.timeouts:超時(shí)事件設(shè)置
adb shell monkey -ignore-timeouts :忽略超時(shí)事件
monkey -s 35 -v 1000