#文件名 Monkeyscript.mks
#功能: Using the Monkey script test app, this case is a test search function (enter keywords and then click the Search button)
#参考: http://blog.csdn.net/superloveboy/article/details/48469393
#http://yiweifen.com/html/news/waiyu/13792.html
#http://androidxref.com/5.1.1_r6/xref/development/cmds/monkey/src/com/android/commands/monkey/monkeysourcescript.java
#android. View.KeyEvent.java
#可以使用 android/sdk/tools/uiautomatorviewer.bat Get coordinate points
#执行方式 copy files to your phone such as/sdcard/00/monkeyscript.mks, run "adb shell monkey-f/sdcard/00/monkeyscript.mks 10" (not including quotes)
#-f is followed by the path to the script file, and the last number indicates the number of times the script was executed
#下面的这4行是固定值, without modification, to indicate the beginning of the script
Type = user
Count = 10
Speed = 1.0
Start Data >>
#启动activity
Launchactivity (com.iotlife.action,com.iotlife.action.activity.searchdetailactivity)
#等待ms时间
Userwait (200)
#DispatchPointer为点击某个坐标点, focus only on the 3,4,5 parameter
#第三个参数为事件类型 (0 is down,1 to up), 4th, 5 parameter is coordinate point x, y
#也可以用 Tap (1000,100) instead
Dispatchpointer (10,10,0,400,100,0,0,0,0,0,0,0);
Dispatchpointer (10,10,1,400,100,0,0,0,0,0,0,0);
Userwait (300)
#输入一个字符串
Dispatchstring (Test)
#输入一个回车键
Dispatchpress (Keycode_enter)
Userwait (300)
#DispatchPointer (10,10,0,1000,100,0,0,0,0,0,0,0);
#DispatchPointer (10,10,1,1000,100,0,0,0,0,0,0,0);
Userwait (300)
The Monkeyscript of Android automated test cases