用monkey執行有序腳本

通常大家的印象當中monkey都是隨機測試的工具,實際上藉助於腳本,monkey還可以完成簡單的有序的自動化測試。monkey中有一個參數

 [--setup scriptfile] [-f scriptfile [-f scriptfile] ...]

可以根據下面的格式寫成腳本,在monkey中調用。例如命令行格式爲

adb shell monkey -p MY_PACKAGE --setup scriptfile -f /sdcard/ mon_script1.txt 1

 

count= number of events

speed= in ms

start data >>DispatchPointer(long downTime, long eventTime, int action, float x, float y, float pressure, float size, int metaState, float xPrecision, float yPrecision, int device, int edgeFlags)

DispatchTrackball same as DispatchPointer

DispatchKey(long downTime, long eventTime, int action, int code, int repeat, int metaState, int device, int scancode)

DispatchFlip(boolean keyboardOpen)

DispatchPress(int keyCode)

LaunchActivity(String pkg_name, String cl_name)

UserWait(long sleeptime)

LongPress()

發佈了20 篇原創文章 · 獲贊 29 · 訪問量 21萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章