使用Monkey运行脚本测试

YBsisterchang 2014-02-07

一次性输入 example_script.txt 脚步里面的所有内容,命令如下:

              root@lenovo-desktop:~# cat example_script.txt | telnet 127.0.0.1 1080

       这时,你就可以在你执行 # monkey --port 1080 -v –v 命令的窗口看到打印的一系列 Events 消息:

              …

              ……

              :Sending Pointer ACTION_DOWN x=160.0 y=200.0

:Sending Pointer ACTION_UP x=160.0 y=200.0

Sleeping for 1000 milliseconds

:Sending Pointer ACTION_DOWN x=300.0 y=450.0

:Sending Pointer ACTION_UP x=300.0 y=450.0

Sleeping for 1000 milliseconds

:Sending Pointer ACTION_DOWN x=300.0 y=450.0

:Sending Pointer ACTION_UP x=300.0 y=450.0

Sleeping for 1000 milliseconds

:Sending Pointer ACTION_DOWN x=300.0 y=450.0

:Sending Pointer ACTION_UP x=300.0 y=450.0

Sleeping for 1000 milliseconds

:SendKey (ACTION_DOWN): 20    // KEYCODE_DPAD_DOWN

:SendKey (ACTION_UP): 20    // KEYCODE_DPAD_DOWN

:SendKey (ACTION_DOWN): 20    // KEYCODE_DPAD_DOWN

:SendKey (ACTION_UP): 20    // KEYCODE_DPAD_DOWN

:SendKey (ACTION_DOWN): 23    // KEYCODE_DPAD_CENTER

:SendKey (ACTION_UP): 23    // KEYCODE_DPAD_CENTER

:SendKey (ACTION_DOWN): 30    // KEYCODE_B

:SendKey (ACTION_UP): 30    // KEYCODE_B

:SendKey (ACTION_DOWN): 37    // KEYCODE_I

:SendKey (ACTION_UP): 37    // KEYCODE_I

:SendKey (ACTION_DOWN): 40    // KEYCODE_L

:SendKey (ACTION_UP): 40    // KEYCODE_L

:SendKey (ACTION_DOWN): 40    // KEYCODE_L

:SendKey (ACTION_UP): 40    // KEYCODE_L

:SendKey (ACTION_DOWN): 20    // KEYCODE_DPAD_DOWN

:SendKey (ACTION_UP): 20    // KEYCODE_DPAD_DOWN

:SendKey (ACTION_DOWN): 30    // KEYCODE_B

:SendKey (ACTION_UP): 30    // KEYCODE_B

:SendKey (ACTION_DOWN): 37    // KEYCODE_I

:SendKey (ACTION_UP): 37    // KEYCODE_I

:SendKey (ACTION_DOWN): 40    // KEYCODE_L

:SendKey (ACTION_UP): 40    // KEYCODE_L

:SendKey (ACTION_DOWN): 40    // KEYCODE_L

:SendKey (ACTION_UP): 40    // KEYCODE_L

:Sending Pointer ACTION_DOWN x=300.0 y=450.0

:Sending Pointer ACTION_UP x=300.0 y=450.0

Events injected: 34

:Dropped: keys=0 pointers=0 trackballs=0 flips=0

## Network stats: elapsed time=18299ms (18299ms mobile, 0ms wifi, 0ms not connected)

注:你发现没?以上显示的内容呢,正是 examp_script.txt 的内容。

相关推荐