Monkey????
???????????? ???????[ 2014/2/17 15:34:53 ] ????????Android ????????? ??????? ???
????Monkey??Android????????????????????????????????????????????????activity???????
???????£?
adb shell monkey --help
** Error: Unknown option: --help
usage: monkey [-p ALLOWED_PACKAGE [-p ALLOWED_PACKAGE] ...]
[-c MAIN_CATEGORY [-c MAIN_CATEGORY] ...]
[--ignore-crashes] [--ignore-timeouts]
[--ignore-security-exceptions]
[--monitor-native-crashes] [--ignore-native-crashes]
[--kill-process-after-error] [--hprof]
[--pct-touch PERCENT] [--pct-motion PERCENT]
[--pct-trackball PERCENT] [--pct-syskeys PERCENT]
[--pct-nav PERCENT] [--pct-majornav PERCENT]
[--pct-appswitch PERCENT] [--pct-flip PERCENT]
[--pct-anyevent PERCENT]
[--pkg-blacklist-file PACKAGE_BLACKLIST_FILE]
[--pkg-whitelist-file PACKAGE_WHITELIST_FILE]
[--wait-dbg] [--dbg-no-events]
[--setup scriptfile] [-f scriptfile [-f scriptfile] ...]
[--port port]
[-s SEED] [-v [-v] ...]
[--throttle MILLISEC] [--randomize-throttle]
[--profile-wait MILLISEC]
[--device-sleep-time MILLISEC]
[--randomize-script]
????monkey????????????????????????script???
?????????з????
adb shell monkey -p package.name -v 30
????: ????????????????????? -v ?????? -v???????????????????
????????????????????????
???????????????????????????????????????
?磺adb shell monkey -p package.name -v 30 > log.txt
??????????
Android ??monkey test ???????? -f scriptfile ????????????? test ??????? monkey ????? MonkeySourceScript.java ?????С???????????????????? 10 ??????:
/**
* monkey event queue. It takes a script to produce events
*
* sample script format:
* type= raw events
* count= 10
* speed= 1.0
* start data >>
* captureDispatchPointer(5109520??5109520??0??230.75429??458.1814??0.20784314??
* 0.06666667??0??0.0??0.0??65539??0)
* captureDispatchKey(5113146??5113146??0??20??0??0??0??0)
* captureDispatchFlip(true)
* ...
*/
monkey????????????£?
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(long downTime?? long eventTime?? int action?? float x?? float y?? float pressure?? float size?? int metaState?? float xPrecision?? float yPrecision?? int device?? int edgeFlags)
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(int keyCode)
????????д???????????? ????? monkey.script ????????????????????push??????????????sdcard??
?磺 adb push lujing/monkey.script /sdcard/
?????н????
adb shell monkey -v -f /sdcard/monkey.script
?? Example??
type= user
count= 49
speed= 1.0
start data >>
LaunchActivity(com.example.android.notepad?? com.example.android.notepad.NotesList)
DispatchPress(KEYCODE_DPAD_DOWN)
LongPress(KEYCODE_DOWN)
DispatchPress(KEYCODE_BACK)
???? type????????????????ж??????κδ????
count????????Ч??????????????????????????е??????????????е?count????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11