




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、关于使用monkey运行脚本测试first, run monkey on a virtual machinetwo ways to run emulators on pc (linux)you can run the emulator through eclipse, in a slightly different way.the 1 can be done by the command line: root llin-desktop:# emulator 一 avd android2 2enter the adb shell pattern, as follows:root rusdeskt
2、op:# adb shell#run the monkey tool to open the special port# monkey 一 port 1080 一 vv“monkeyseed = 0 count = 1000:includecategory:android.int category.launcher:includecategory:android.int. category.monkeynote: after you execute the mon key comma nd, you can use netsta t to see if the port is open, an
3、d the red section below is wherewe want to focus.# netstatproto recv - q send -q local address foreign address statetcp 0 0 127. 0. 0. 1:5037 0. 0. 0.0: * listentcp 0 0 0. 0. 0.0:5555 0. 0. 0.0: * listentcp 0, 0127. 0. 0. 1:1080 0.0. 0.0: * listentcp 0, 10. 0.2. 15:5555, :43064 establishedud
4、p 0. 0. 0. 0. 0. 0:55433 0. 0. 0. 0: *udp0. 00. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.#open the forward port on the pc sideroot l-edesktop: # adb forward tcp: 1080 tcp: 1080note: after the adb forward,
5、you can also use the netstat command to see if the port is enabled, and the command is as follows:root lenovo - desktop: #root l-edesktop: # adb forward tcp: 1080 tcp: 1080root netstat - an | grep 1080tcp 0, 0127. 0. 0. 1:1080 0.0. 0.0: * listenroot lenovo - desktop: #use the telnet tool to connect
6、to androidroot rendesktop: # telnet 1080trying 127. 0. 0. 1.connected to 127. 0. 0. 1.the escape character is,八'the above tip, without an exception exit, indicates that the connection is successful, and then you can use the contents of the steps of example_script txt to enter the key v
7、alues.root rendesktop: # telnet 1080trying 127. 0. 0. 1.connected to 127. 0. 0. 1.the escape character is, j 'key down 3okthe key up 3oknote: the key down 3, key up 3, is the key user input, ok is the return value, if you see the words ok return values, shows the keys to effective valu
8、e of hair, otherwise, as invalid values.at this stage, you would have thought that, if must a a didn,t enter a key word, what about the meaning of what else test automation, it is better to one by one to press, in fact is an all commands can be piped to monkey.enter all of the contents of exa.mple_s
9、cript txt in a one-time step, and the command is as follows:root rus-desktop: # cat example_script txt | telnet127. 0. 0. 1 1080at this point, you can see the printed series of events messages in the window of the # monkey, port 1080-v-v commandso, there* s a pointer action down x 二 160.0, y = 200.
10、0so, there,s a pointer acti0n_up x 二 160.0, y 二 200. 0sleeping for 1000 millisecondsthe pointer is acti0n_d0wn x 二 300. 0, y 二 450.0:the sending pointer acti0n_up x 二 300.0, y 二 450. 0sleeping for 1000 millisecondsthe pointer is acti0n_d0wn x 二 300.0, y 二 450.0:the sending pointer acti0n_up x 二 300.
11、0, y 二 450. 0sleeping for 1000 millisecondsthe pointer is acti0n_d0wn x 二 300.0, y 二 450.0:the sending pointer acti0n_up x 二 300.0, y 二 450. 0sleeping for 1000 milliseconds:sendkey (acti0n_d0wn) : 20 / / keycode_dpad_down:sendkey (acti0n_up) : 20 / / keycode_dpad_down :sendkey (acti0n_d0wn) : 20 / /
12、 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 / / keyco
13、de 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
14、_b:sendkey (action_down) : 37 / / keycode_i:sendkey (action_up) : 37 / / keycode_i :sendkey (action_down) : 40/ keycode_l:sendkey (acti0n_up) : 40/ keyc0de_l:sendkey (acti0n_d0wn)40/ keyc0de_l:sendkey(acti0n_up) : 40/ keyc0de_lthe pointer is acti0n_d0wn x 二 300.0, y 二 450.0:the sending pointer acti0
15、n_up x 二 300.0, y 二 450. 0events injected: 342: keys 二 0, trackballs 二 0# # network stats: elapsed time 二 18299ms (18299ms mobile, 0mswifi, 0ms not connected)note: did you find out? what is shown above is the content ofexamp_script txtrun the monkey test tool on pc (windows)note: this example_script
16、 txt is also fully available on thewindows machine, running methods and steps completely,the system commands are almost the same.two, run monkey on the real deviceconnecting deviceuse usb cables or other methods such as serial port connected devices and pcs to enable communication between them, and
17、verify that the method reference commands netstathow to testthe remaining test method is based on the above virtual machine methodthird, summaryexample_script txt example is very simple, but to really put it to automated tests, you also need to spend a lot of energy, one of the events, not pan is th
18、e example of a few simple events, but also can realize many functions, the usage of specific events refer to source code monkey.the road is still longsmall instances (example_script txt)# touch the androidtouch up 160, 200sleep1000# hitnexttouchdown 300, 450touchup 300, 450sleep1000# hitnexttouchdow
19、n 300, 450touchup 300, 450sleep1000# hitnexttouchdown 300, 450touchup 300, 450sleep1000go down and select the account usernamethe key up dpad_downkey down dpad_downthe key up dpad_downkey down dpad_centerthe key up dpad_center# the account name: billkey down bthe key up bkey down the ithe key up the
20、 ikey down the 1the key up 1key down the 1the key up 1key down dpad_downthe key up dpaddown# password: billkey down bthe key up bkey down the ithe key up the ikey down the 1the key up 1key down the 1the key up 1# the select nexttouch down 300, 450touch up 300, 450# the quitthe quitfive, the appendix
21、:the following is the keycode value in the android system: keycode_unknown 二 0;keycode soft left 二 1;keycode_soft_right 二 2;keycode_home 二 3;keycode_back 二 4;keycode_call 二 5;keycode_endcall 二 6;keyc0de_0 = 7.keycode_1 = 8;keyc0de_2 二 9;keyc0de_3 = 10;keyc0de_4 二 11;keyc0de_6 = 13;keyc0de_7 二 14;key
22、c0de_8 二 15;keyc0de_9 二 16;keycode_star 二 17;keycode_pound =18;keycode_dpad_up 二 19;keycode_dpad_down 二 20.keycode_dpad_left 二 21;keycode_dpad_right 二 22;keycode_dpad_center 二 23;keyc0de_v0lume_up 二 24;keyc0de_v0lume_d0wn 二 25;keyc0de_p0wer 二 26;keycode_a 二 29;keycode_b 二keycode_c 二30;31;keycode_d 二
23、32;keycode_e 二33;keycode_f 二34;keycode_g 二35;keycode_h 二36;keycode_i 二37;keycode_j 二38;keycode_k 二39;keycode_l 二40;keycode_m 二41;keycode_n 二42;keycode_p = 44;keycode_q 二 45;keycode_r 二 46;keycode_s 二 47;keycode_t 二 48;keycode_u 二 49;keycode_v 二 50;keycode_w 二 51;keycode_x 二 52 个;keycode_y 二 53 个;keycode_z 二 54;keycode_comma 二 55;key
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025-2030牙刷行业竞争格局分析及投资前景与战略规划研究报告
- 2025-2030年中国风冷式冷冻机行业市场现状供需分析及投资评估规划分析研究报告
- 2025-2030年中国邻氰基苯甲醛行业市场深度分析及发展趋势与投资研究报告
- 2025-2030年中国药用甘油行业市场现状供需分析及投资评估规划分析研究报告
- 2025-2030年中国纺织用染料行业市场现状供需分析及投资评估规划分析研究报告
- 2025-2030年中国碳预浸料行业市场现状供需分析及投资评估规划分析研究报告
- 2025-2030年中国深层净化洁面乳行业发展分析及投资价值评估研究报告
- 西北工业大学《控制工程基础》2023-2024学年第二学期期末试卷
- 沈阳航空职业技术学院《制造工程与技术C》2023-2024学年第二学期期末试卷
- 茂名职业技术学院《建筑工程材料》2023-2024学年第二学期期末试卷
- 海门村干部考试试题及答案
- (二模)2025年5月济南市高三高考针对性训练生物试卷(含答案)
- 2024年云南省会泽县事业单位公开招聘医疗卫生岗笔试题带答案
- 全球及中国双特异性抗体治疗行业市场发展分析及前景趋势与投资发展研究报告2025-2028版
- 2025年电工操作资格证考试复习考试题库(共583题)(含答案)
- 沟通的艺术智慧树知到期末考试答案章节答案2024年湖南师范大学
- 计算机组装与维护立体化教程ppt课件(完整版)
- 痛风性关节炎 课件
- 项目部管理人员名单
- 《新编英语语法教程》主要章节语法术语
- 电脑企业之 组装作业指导书(DK607 Nupro760)
评论
0/150
提交评论