Monkey基本常用命令整理


adb shell monkey   -v 500  >F:/monkeylog2018.txt    -P表示包名   -V表示輸出日志的詳細級別  一個-V表示一級 遞增  >輸出日志的目錄
 
adb shell monkey -p com.htc.Weather –s 10 100       -s 10 前后兩條命令相同,那么其隨機的內容也是相同的,這樣可以在對比測試的時候用到
 
adb shell monkey -p com.huawei.Weather –throttle 3000 100    每次操作都延遲3秒 隨機事件100次 這樣可以給app留有響應時間,連網時間,加載時間
 
--ignore-crashes adb shell monkey -p com.huawei.Weather --ignore-crashes 1000   忽略事件  可以忽略崩潰測試過程中即使程序崩潰,Monkey依然會繼續發送事件直到事件數目達到1000為止
 
--ignore-timeouts     adb shell monkey -p com.huawei.Weather --ignore-timeouts 1000 忽略超時  如果程序發生anr超時錯誤  仍然繼續運行
 
--ignore-security-exceptions   adb shell monkey -p com.huawei.Weather --ignore-security-exceptions 1000       即使應用程序發生許可錯誤,Monkey依然會發送事件,直到事件計數完成
 
--kill-process-after-error   發生錯誤后直接殺掉進程:用於指定當應用程序發生錯誤時,是否停止其運行。如果指定此參數,當應用程序發生錯誤時,應用程序停止運行並保持在當前狀態(注意:應用程序僅是靜止在發生錯誤時的狀態,系統並不會結束該應用程序的進程
 
--monitor-native-crashes adb shell monkey -p com.huawei.Weather --kill-process-after-error  --monitor-native-crashes 1000 跟蹤本地方法崩潰問題:用於指定是否監視並報告應用程序發生崩潰的本地代碼,
 
指定事件百分比:
用於指定每種類別事件的數目百分比(在Monkey事件序列中,該類事件數目占總事件數目的百分比),雖然事件是隨機的,但是你可以指定其中某種動作的比例,根據app的特點而進行設置,某些app滑動多,某些app點擊多,這樣可以更貼近app應用場景的設置隨機事件進行測試
 
--pct-{+事件類別} {+事件類別百分比}:
 
--pct-touch {+百分比}:觸摸事件:adb shell monkey -p com.huawei.Weather --pct-touch 10 1000
 
--pct-motion {+百分比}:動作事件:adb shell monkey -p com.huawei.Weather --pct-motion10 1000
 
--pct-trackball {+百分比}:軌跡事件:adb shell monkey -p com.huawei.Weather --pct-trackball 10 1000
 
--pct-nav {+百分比}:基本導航:adb shell monkey -p com.huawei.Weather --pct-nav 10 1000
 
--pct-majornav {+百分比}:主要導航:adb shell monkey -p com.huawei.Weather --pct-majornav 10 1000
 
--pct-syskeys {+百分比}:系統按鍵:adb shell monkey -p com.huawei.Weather --pct-syskeys 10 1000
 
--pct-appswitch {+百分比}:啟動activity(日志里見過這個switch吧):adb shell monkey -p com.huawei.Weather --pct-appswitch  10 1000
 
--pct-anyevent {+百分比}:其他事件:
 
指定單個類型事件的百分比:
 
adb shell monkey -p com.huawei.Weather --pct -anyevent 20  1000
 
指定多個類型事件的百分比:
 
adb shell monkey -p com.huawei.Weather --pct-anyevent 30  --pct-appswitch 30   1000
 
注意:各事件類型的百分比總數不能超過100%
 
防止monkey點擊狀態欄
adb shell settings put global policy_control immersive.full=*


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM