monkey之monkeyServer

 

基本命令:

adb shell monkey --port 1080 &

adb forward tcp:1080 tcp:1080

telnet 127.0.0.1 1080

启动android端的monkey server,然后将端口转发到pc端,就可以在pc端

通过telnet连接monkey server

 

monkeyServerRun.vbs(测试脚本)

set sh=WScript.CreateObject("WScript.Shell")

WScript.Sleep 1000

sh.SendKeys "open 127.0.0.1 1080 {ENTER}"

WScript.Sleep 1000

sh.SendKeys "press KEYCODE_3 {ENTER}"

WScript.Sleep 1000

sh.SendKeys "press KEYCODE_7 {ENTER}"

WScript.Sleep 1000

sh.SendKeys "press KEYCODE_NUMPAD_ADD {ENTER}"

WScript.Sleep 1000

sh.SendKeys "press KEYCODE_2 {ENTER}"

WScript.Sleep 1000

sh.SendKeys "press KEYCODE_1 {ENTER}"

WScript.Sleep 1000

sh.SendKeys "press KEYCODE_NUMPAD_EQUALS {ENTER}"

WScript.Sleep 1000

sh.SendKeys "done {ENTER}"

WScript.Sleep 1000

使用monkey服务端测试应用时时,需事先连上手机端,打开应用

monkeySever.bat(批处理脚本)

adb forward tcp:1080 tcp:1080

adb shell am start -n com.android.calculator2/com.android.calculator2.Calculator

start telnet.exe

cscript //nologo .\monkeyServerRun.vbs

posted @ 2018-01-26 11:47  Claire_xu  阅读(426)  评论(0编辑  收藏  举报