`
bingtears
  • 浏览: 187579 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论

[zz]android performance testing related

 
阅读更多
001 一、为什么要用Monkey 测试?
002
003 简单在说就是象猴子一样乱点,为了测试软件的稳定性,健壮性。号称最快速有效的方法。有时候运行相同系列的测试,即使是复杂的测试,但是以相同的顺序和路径,即使一遍又一遍地运行也很少机会能发现内存和资源使用的bug。而此时猴子就比人更有效了。
004
005 简介
006
007 Monkey是一个命令行工具 ,可以运行在模拟器里或实际设备中。它向系统发送伪随机的用户事件流,实现对正在开发的应用程序进行压力测试。Monkey包括许多选项,它们大致分为四大类:
008
009 · 基本配置 选项,如设置尝试的事件数量。
010
011 · 运行约束选项,如设置只对单独的一个包进行测试。
012
013 · 事件类型和频率。
014
015 · 调试选项。
016
017 在Monkey运行的时候,它生成事件,并把它们发给系统。同时,Monkey还对测试中的系统进行监测,对下列三种情况进行特殊处理:
018
019 · 如果限定了Monkey运行在一个或几个特定的包上,那么它会监测试图转到其它包的操作,并对其进行阻止。
020
021 · 如果应用程序崩溃或接收到任何失控异常 ,Monkey将停止并报错。
022
023 · 如果应用程序产生了应用程序不响应(application not responding)的错误,Monkey将会停止并报错。
024
025 按照选定的不同级别的反馈信息,在Monkey中还可以看到其执行过程报告和生成的事件。
026
027 二、怎么用的?
028
029 首先用一个最简单的例子分析:
030 //p参数: 表示指定测试的程序
031 //v参数: 表示查看monkey生成的一些详细的随机的事件名
032 //数字100: 表示测试事件数为100
033 monkey -p com.example.android.apis  -v -v -v 100
034
035
036 结果如下:
037
038 :Monkey: seed=0 count=100
039
040
041 :AllowPackage: com.example.android.apis
042 :IncludeCategory: android.intent.category.LAUNCHER
043 :IncludeCategory: android.intent.category.MONKEY
044
045 //各种事件所占的比例。
046 //各数字分别表示:
047 [--pct-touch PERCENT]
048 [--pct-motion PERCENT]
049 [--pct-trackball PERCENT]
050 [--pct-syskeys PERCENT]
051 [--pct-nav PERCENT]
052 [--pct-majornav PERCENT]
053 [--pct-appswitch PERCENT]
054 [--pct-flip PERCENT]
055 [--pct-anyevent PERCENT]
056 // Event percentages:
057 //   0: 15.0%
058 //   1: 10.0%
059 //   2: 15.0%
060 //   3: 25.0%
061 //   4: 15.0%
062 //   5: 2.0%
063 //   6: 2.0%
064 //   7: 1.0%
065 //   8: 15.0%
066 :Switch:
067
068 //表示跳转到com.example.android.apis 里面的ApiDemos这一个Activity里。
069 #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;component=com.example.android.apis/.ApiDemos;end
070
071 //允许此Intent跳转,
072     // Allowing start of Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.example.android.apis/.ApiDemos } in package com.example.android.apis
073
074 //发送的一些动作,如点击按下,点击放开,移动。
075 :Sending Pointer ACTION_MOVE x=-4.0 y=2.0
076 :Sending Pointer ACTION_UP x=0.0 y=0.0
077 :Sending Pointer ACTION_DOWN x=207.0 y=282.0
078 :Sending Pointer ACTION_UP x=189.0 y=289.0
079 :Sending Pointer ACTION_DOWN x=95.0 y=259.0
080 :Sending Pointer ACTION_UP x=95.0 y=259.0
081 :Sending Pointer ACTION_DOWN x=295.0 y=223.0
082 :Sending Pointer ACTION_UP x=290.0 y=213.0
083 :Sending Pointer ACTION_MOVE x=-5.0 y=3.0
084 :Sending Pointer ACTION_MOVE x=0.0 y=-5.0
085
086 //拒绝此跳转,因为它是跳转到非它自己的包的Activity,本测试中是指写测试它程序所在的包,此跳转是跳出本程序,进入到桌面。
087     // Rejecting start of Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] cmp=com.android.launcher/.Launcher } in package com.android.launcher
088
089 //继续发送动作。
090 :Sending Pointer ACTION_DOWN x=74.0 y=201.0
091 :Sending Pointer ACTION_UP x=74.0 y=201.0
092 :Sending Pointer ACTION_MOVE x=3.0 y=-2.0
093 :Sending Pointer ACTION_UP x=0.0 y=0.0
094 :Sending Pointer ACTION_MOVE x=-4.0 y=2.0
095 Events injected: 100
096
097 //丢弃的,键=0,指针=0,轨迹球=0,翻转=0。
098 :Dropped: keys=0 pointers=0 trackballs=0 flips=0
099
100 //网络统计经过时间为4202ms,其中4202ms是用于在手机上的,0ms用于无线网络上,没有连接的时间为0ms。
101 ## Network stats: elapsed time=4202ms (4202ms mobile, 0ms wifi, 0ms not connected)
102
103 //monkey测试完成。
104 // Monkey finished
105
106 从例子中可以看出,该程序在这次测试中没有问题,若程序出现问题终端将打印出异常供程序员查找错误。
107
108
109
110 以下是monkey命令行的一些参数:
111 -p:所在测试的包,可以是一个也可以是多个 如 monkey -p com.androd.sms -p com.androd.explorer
112 -c:如果用此参数指定了一个或几个类别,Monkey将只允许系统启动被这些类别中的某个类别列出的Activity。如果不指定任何类别,Monkey将选择下列类别中列出的Activity: Intent.CATEGORY_LAUNCHER或Intent.CATEGORY_MONKEY。要指定多个类别,需要使用多个-c选项,每个-c选项只能用于一个类别。
113 -ignore-crash:当应用程序崩溃或发生任何失控异常时,Monkey将停止运行。如果设置此选项,Monkey将继续向系统发送事件,直到计数完成。
114 -ignore-timeouts:通常,当应用程序发生任何超时错误(如“Application Not Responding”对话框)时,Monkey将停止运行。如果设置此选项,Monkey将继续向系统发送事件,直到计数完成。
115 -ignore-security-exceptions:通常,当应用程序发生许可错误(如启动一个需要某些许可的Activity)时,Monkey将停止运行。如果设置了此选项,Monkey将继续向系统发送事件,直到计数完成。
116 -monitor-native-crashes:监视并报告Android系统中本地代码的崩溃事件。如果设置了–kill-process-after-error,系统将停止运行。
117 -kill-process-after-error:如果程序出现错误,monkey将结束此程序进程。
118 -hprof:设置此项,将在monkey事件序列之前和之后立即生成profilling报告。这将会在data/misc中生成大文件(约5mb)所以要小心使用它。
119 -pct-touch:调整触摸事件的百分比(触摸事件是一个down-up事件,它发生在屏幕的某单一位置)。
120 -pct-motion:动作事件的百分比(动作事件由屏幕上某处的一个down事件、一系列的随机事件和一个up事件组成)。
121 -pct-trackball:调整轨迹事件的百分比(轨迹事件由一个或几个随机移动组成,有时还伴随着点击)。
122 -pct-syskeys:调整系统按键事件的百分比(这些按键通常被保留,由系统使用,如home,back,start call,end call及音量控制)。
123 -pct-nav 调整基本导航事件的百分比(导航事件来自方向输入设备的up/down/left/right组成)。
124 -pct-majornav:调整“主要”导航事件的百分比(这些导航事件通常引发图形界面中的动作,如:5-way键盘的中间按键、回退按键、菜单按键)
125 -pct-appswitch:调整启动Activity的百分比。在随机间隔里,Monkey将执行一个startActivity()调用,作为最大程度覆盖包中全部Activity的一种方法。
126 -pct-anyevent:调整启动Activity的百分比。它包罗了所有其它的事件类型,如:按键,其它不常用的设备按钮。
127 -pct-flip:
128 –wait-dbg:停止执行中的Monkey,直到有调试器和它相连接。
129 –dbg-no-events:设置此选项,Monkey将执行初始启动,进入到一个测试Activity,然后不会再进一步生成事件。为了得到最佳结果,把它与-v、一个或几个包约束、以及一个保持Monkey运行30秒或更长时间的非零值联合起来,从而提供一个环境,可以监视应用程序所调用的包之间的转换。
130 -setup:
131 -f:
132 -port: 为monkey开启专用端口。此时只monkey不会帮你乱点击,而此时你自己就是一只monkey了,在你乱点的时候,monkey会输出你点击后回馈的信息。如果你打完命令之后模拟器上没有启动你所要启动的包,你需要自己启动,但是你只能启动你-p中指定的那几个包。ctrl+c中断。
133 --throttle :当事件起效时等待的毫秒数。
134 -s:随机数生成器的seed值。如果用相同的seed值再次运行monkey,它将生成相同的事件序列。
135 COUNT:要发送的事件数。
136 usage: monkey [-p ALLOWED_PACKAGE [-p ALLOWED_PACKAGE] ...]
137               [-c MAIN_CATEGORY [-c MAIN_CATEGORY] ...]
138               [--ignore-crashes] [--ignore-timeouts]
139               [--ignore-security-exceptions] [--monitor-native-crashes]
140               [--kill-process-after-error] [--hprof]
141               [--pct-touch PERCENT] [--pct-motion PERCENT]
142               [--pct-trackball PERCENT] [--pct-syskeys PERCENT]
143               [--pct-nav PERCENT] [--pct-majornav PERCENT]
144               [--pct-appswitch PERCENT] [--pct-flip PERCENT]
145               [--pct-anyevent PERCENT]
146               [--wait-dbg] [--dbg-no-events]
147               [--setup scriptfile] [-f scriptfile [-f scriptfile] ...]
148               [--port port]
149               [-s SEED] [-v [-v] ...] [--throttle MILLISEC]
150               COUNT
151
152
153
154
155 Monkey测试结果 :
156 # monkey -p wfh.LessonTable -v -v -v 200
157 :Monkey: seed=0 count=200
158 :AllowPackage: wfh.LessonTable
159 :IncludeCategory: android.intent.category.LAUNCHER
160 :IncludeCategory: android.intent.category.MONKEY
161 // Selecting main activities from category android.intent.category.LAUNCHER
162 //   - NOT USING main activity com.android.browser.BrowserActivity (from package com.android.browser)
163 //   - NOT USING main activity com.android.music.MusicBrowserActivity (from package com.android.music)
164 //   - NOT USING main activity com.android.contacts.DialtactsActivity (from package com.android.contacts)
165 //   - NOT USING main activity com.android.contacts.DialtactsContactsEntryActivity (from package com.android.contacts)
166 //   - NOT USING main activity com.android.mms.ui.ConversationList (from package com.android.mms)
167 //   - NOT USING main activity com.android.spare_parts.SpareParts (from package com.android.spare_parts)
168 //   - NOT USING main activity com.android.camera.Camera (from package com.android.camera)
169 //   - NOT USING main activity com.android.alarmclock.AlarmClock (from package com.android.alarmclock)
170 //   - NOT USING main activity com.android.settings.Settings (from package com.android.settings)
171 //   - NOT USING main activity com.android.camera.GalleryPicker (from package com.android.gallery)
172 //   - NOT USING main activity com.android.email.activity.Welcome (from package com.android.email)
173 //   - NOT USING main activity com.example.android.apis.ApiDemos (from package com.example.android.apis)
174 //   - NOT USING main activity com.android.calculator2.Calculator (from package com.android.calculator2)
175 //   - NOT USING main activity com.android.customlocale.CustomLocaleActivity (from package com.android.customlocale)
176 //   - NOT USING main activity com.android.development.Development (from package com.android.development)
177 //   - NOT USING main activity com.myactivity.MyActivity (from package com.myactivity)
178 //   + Using main activity wfh.LessonTable.MainTable (from package wfh.LessonTable)
179 //   - NOT USING main activity wfh.rss.MainRSS (from package wfh.rss)
180 // Selecting main activities from category android.intent.category.MONKEY
181 //   - NOT USING main activity com.android.launcher.Launcher (from package com.android.launcher)
182 //   - NOT USING main activity com.android.settings.ManageApplications (from package com.android.settings)
183 //   - NOT USING main activity com.android.settings.RunningServices (from package com.android.settings)
184 // Seeded: 0
185 // Event percentages:
186 //   0: 15.0%
187 //   1: 10.0%
188 //   2: 15.0%
189 //   3: 25.0%
190 //   4: 15.0%
191 //   5: 2.0%
192 //   6: 2.0%
193 //   7: 1.0%
194 //   8: 15.0%
195 :Switch: #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;component=wfh.LessonTable/.MainTable;end
196     // Allowing start of Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=wfh.LessonTable/.MainTable } in package wfh.LessonTable
197 Sleeping for 0 milliseconds
198 :SendKey (ACTION_DOWN): 21    // KEYCODE_DPAD_LEFT
199 :SendKey (ACTION_UP): 21    // KEYCODE_DPAD_LEFT
200 Sleeping for 0 milliseconds  //------------------------------------用--throttle来设置一个起效的事件发生后时延时。
201 :Sending Pointer ACTION_MOVE x=-4.0 y=2.0
202 :Sending Pointer ACTION_MOVE x=-5.0 y=-4.0
203 :Sending Pointer ACTION_MOVE x=0.0 y=-1.0
204 :Sending Pointer ACTION_MOVE x=-3.0 y=2.0
205 :Sending Pointer ACTION_MOVE x=-4.0 y=2.0 //-------------移动事件!!!
206 :Sending Pointer ACTION_MOVE x=-2.0 y=4.0
207 :Sending Pointer ACTION_MOVE x=4.0 y=1.0
208 :Sending Pointer ACTION_MOVE x=-5.0 y=4.0
209 :Sending Pointer ACTION_MOVE x=-5.0 y=1.0
210 :Sending Pointer ACTION_MOVE x=0.0 y=-2.0
211 :Sending Pointer ACTION_DOWN x=0.0 y=0.0
212 :Sending Pointer ACTION_UP x=0.0 y=0.0
213 Sleeping for 0 milliseconds
214 :SendKey (ACTION_DOWN): 82    // KEYCODE_MENU
215 :SendKey (ACTION_UP): 82    // KEYCODE_MENU
216 Sleeping for 0 milliseconds
217 :SendKey (ACTION_DOWN): 64    // KEYCODE_EXPLORER
218 :SendKey (ACTION_UP): 64    // KEYCODE_EXPLORER
219 Sleeping for 0 milliseconds
220 :SendKey (ACTION_DOWN): 23    // KEYCODE_DPAD_CENTER
221 :SendKey (ACTION_UP): 23    // KEYCODE_DPAD_CENTER
222 Sleeping for 0 milliseconds
223 :SendKey (ACTION_DOWN): 91    // KEYCODE_MUTE
224     // Allowing start of Intent { cmp=wfh.LessonTable/.EditLesson } in package wfh.LessonTable
225 :SendKey (ACTION_UP): 91    // KEYCODE_MUTE
226 Sleeping for 0 milliseconds
227 :Sending Pointer ACTION_DOWN x=207.0 y=282.0
228 :Sending Pointer ACTION_MOVE x=210.0 y=277.0
229 :Sending Pointer ACTION_MOVE x=204.0 y=283.0
230 :Sending Pointer ACTION_MOVE x=205.0 y=278.0
231 :Sending Pointer ACTION_MOVE x=199.0 y=278.0
232 :Sending Pointer ACTION_MOVE x=199.0 y=287.0
233 :Sending Pointer ACTION_MOVE x=194.0 y=295.0
234 :Sending Pointer ACTION_MOVE x=198.0 y=290.0
235 :Sending Pointer ACTION_MOVE x=197.0 y=286.0
236 :Sending Pointer ACTION_MOVE x=189.0 y=289.0
237 :Sending Pointer ACTION_UP x=189.0 y=289.0
238 Sleeping for 0 milliseconds
239 :SendKey (ACTION_DOWN): 56    // KEYCODE_PERIOD
240 :SendKey (ACTION_UP): 56    // KEYCODE_PERIOD
241 Sleeping for 0 milliseconds
242 :Sending Pointer ACTION_DOWN x=95.0 y=259.0
243 :Sending Pointer ACTION_UP x=95.0 y=259.0
244 Sleeping for 0 milliseconds
245 :Sending Pointer ACTION_DOWN x=295.0 y=223.0
246 :Sending Pointer ACTION_MOVE x=291.0 y=223.0
247 :Sending Pointer ACTION_MOVE x=291.0 y=218.0
248 :Sending Pointer ACTION_MOVE x=284.0 y=215.0
249 :Sending Pointer ACTION_MOVE x=284.0 y=206.0
250 :Sending Pointer ACTION_MOVE x=285.0 y=205.0
251 :Sending Pointer ACTION_MOVE x=290.0 y=213.0
252 :Sending Pointer ACTION_UP x=290.0 y=213.0
253 Sleeping for 0 milliseconds
254 :SendKey (ACTION_DOWN): 82    // KEYCODE_MENU
255 :SendKey (ACTION_UP): 82    // KEYCODE_MENU
256 Sleeping for 0 milliseconds
257 :Sending Pointer ACTION_MOVE x=-5.0 y=3.0
258 :Sending Pointer ACTION_MOVE x=3.0 y=2.0
259 :Sending Pointer ACTION_MOVE x=-1.0 y=2.0
260 :Sending Pointer ACTION_MOVE x=-4.0 y=4.0
261 :Sending Pointer ACTION_MOVE x=-4.0 y=0.0
262 :Sending Pointer ACTION_MOVE x=-2.0 y=2.0
263 :Sending Pointer ACTION_MOVE x=3.0 y=2.0
264 :Sending Pointer ACTION_MOVE x=-2.0 y=-5.0
265 :Sending Pointer ACTION_MOVE x=1.0 y=4.0
266 :Sending Pointer ACTION_MOVE x=-4.0 y=-5.0
267 :SendKey (ACTION_DOWN): 21    // KEYCODE_DPAD_LEFT
268 :SendKey (ACTION_UP): 21    // KEYCODE_DPAD_LEFT
269 Sleeping for 0 milliseconds
270 :Sending Pointer ACTION_MOVE x=0.0 y=-5.0
271 :Sending Pointer ACTION_MOVE x=3.0 y=-5.0
272 :Sending Pointer ACTION_MOVE x=4.0 y=0.0
273 :Sending Pointer ACTION_MOVE x=-4.0 y=3.0
274 :Sending Pointer ACTION_MOVE x=4.0 y=1.0
275 :Sending Pointer ACTION_MOVE x=-4.0 y=3.0
276 :Sending Pointer ACTION_MOVE x=-1.0 y=-4.0
277 :Sending Pointer ACTION_MOVE x=-2.0 y=-2.0
278 :Sending Pointer ACTION_MOVE x=-4.0 y=-3.0
279 :Sending Pointer ACTION_MOVE x=-5.0 y=-1.0
280 :SendKey (ACTION_DOWN): 3    // KEYCODE_HOME
281 :SendKey (ACTION_UP): 3    // KEYCODE_HOME
282     // Rejecting start of Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] cmp=com.android.launcher/.Launcher } in package com.android.launcher
283 Sleeping for 0 milliseconds
284 :Sending Pointer ACTION_DOWN x=74.0 y=201.0
285 :Sending Pointer ACTION_UP x=74.0 y=201.0
286 Sleeping for 0 milliseconds
287 :SendKey (ACTION_DOWN): 23    // KEYCODE_DPAD_CENTER
288 :SendKey (ACTION_UP): 23    // KEYCODE_DPAD_CENTER
289 Sleeping for 0 milliseconds
290 :Sending Pointer ACTION_MOVE x=3.0 y=-2.0
291 :Sending Pointer ACTION_MOVE x=-2.0 y=-1.0
292 :Sending Pointer ACTION_MOVE x=-5.0 y=4.0
293 :Sending Pointer ACTION_MOVE x=-2.0 y=0.0
294 :Sending Pointer ACTION_MOVE x=3.0 y=2.0
295 :Sending Pointer ACTION_MOVE x=0.0 y=0.0
296 :Sending Pointer ACTION_MOVE x=4.0 y=3.0
297 :Sending Pointer ACTION_MOVE x=-3.0 y=-1.0
298 :Sending Pointer ACTION_MOVE x=-4.0 y=1.0
299 :Sending Pointer ACTION_MOVE x=-5.0 y=1.0
300 :Sending Pointer ACTION_DOWN x=0.0 y=0.0
301 :Sending Pointer ACTION_UP x=0.0 y=0.0
302 Sleeping for 0 milliseconds
303 :SendKey (ACTION_DOWN): 21    // KEYCODE_DPAD_LEFT
304 :SendKey (ACTION_UP): 21    // KEYCODE_DPAD_LEFT
305     // activityResuming(wfh.LessonTable)
306 Sleeping for 0 milliseconds
307 :SendKey (ACTION_DOWN): 82    // KEYCODE_MENU
308 :SendKey (ACTION_UP): 82    // KEYCODE_MENU
309 Sleeping for 0 milliseconds
310 :SendKey (ACTION_DOWN): 20    // KEYCODE_DPAD_DOWN
311 :SendKey (ACTION_UP): 20    // KEYCODE_DPAD_DOWN
312 Sleeping for 0 milliseconds
313 :SendKey (ACTION_DOWN): 20    // KEYCODE_DPAD_DOWN
314 :SendKey (ACTION_UP): 20    // KEYCODE_DPAD_DOWN
315 Sleeping for 0 milliseconds
316 :SendKey (ACTION_DOWN): 21    // KEYCODE_DPAD_LEFT
317 :SendKey (ACTION_UP): 21    // KEYCODE_DPAD_LEFT
318 Sleeping for 0 milliseconds ??????
319 :Sending Pointer ACTION_MOVE x=-4.0 y=2.0
320 :Sending Pointer ACTION_MOVE x=4.0 y=0.0
321     // Sending event #100
322 :Sending Pointer ACTION_MOVE x=3.0 y=0.0
323 :Sending Pointer ACTION_MOVE x=3.0 y=1.0
324 :Sending Pointer ACTION_MOVE x=3.0 y=-5.0
325 :Sending Pointer ACTION_MOVE x=-4.0 y=3.0
326 :Sending Pointer ACTION_MOVE x=1.0 y=-2.0
327 :Sending Pointer ACTION_MOVE x=0.0 y=2.0
328 :Sending Pointer ACTION_MOVE x=-2.0 y=1.0
329 :Sending Pointer ACTION_MOVE x=2.0 y=-1.0
330 :Sending Pointer ACTION_MOVE x=4.0 y=2.0
331 :Sending Pointer ACTION_MOVE x=-1.0 y=2.0
332 :Sending Pointer ACTION_MOVE x=3.0 y=-3.0
333 :Sending Pointer ACTION_MOVE x=4.0 y=0.0
334 :Sending Pointer ACTION_MOVE x=0.0 y=-1.0
335 :Sending Pointer ACTION_MOVE x=4.0 y=-1.0
336 :Sending Pointer ACTION_MOVE x=-4.0 y=4.0
337 :Sending Pointer ACTION_MOVE x=4.0 y=4.0
338 :Sending Pointer ACTION_MOVE x=-4.0 y=2.0
339 :Sending Pointer ACTION_MOVE x=2.0 y=-2.0
340 :SendKey (ACTION_DOWN): 22    // KEYCODE_DPAD_RIGHT
341 :SendKey (ACTION_UP): 22    // KEYCODE_DPAD_RIGHT
342 Sleeping for 0 milliseconds
343 :SendKey (ACTION_DOWN): 53    // KEYCODE_Y
344 :SendKey (ACTION_UP): 53    // KEYCODE_Y
345 Sleeping for 0 milliseconds
346 :SendKey (ACTION_DOWN): 24    // KEYCODE_VOLUME_UP
347 :SendKey (ACTION_UP): 24    // KEYCODE_VOLUME_UP
348 Sleeping for 0 milliseconds
349 :SendKey (ACTION_DOWN): 82    // KEYCODE_MENU
350 :SendKey (ACTION_UP): 82    // KEYCODE_MENU
351 Sleeping for 0 milliseconds
352 :Sending Pointer ACTION_DOWN x=149.0 y=150.0
353 :Sending Pointer ACTION_MOVE x=149.0 y=151.0
354 :Sending Pointer ACTION_MOVE x=152.0 y=158.0
355 :Sending Pointer ACTION_MOVE x=148.0 y=162.0
356 :Sending Pointer ACTION_MOVE x=148.0 y=156.0
357 :Sending Pointer ACTION_MOVE x=152.0 y=149.0
358 :Sending Pointer ACTION_MOVE x=155.0 y=146.0
359 :Sending Pointer ACTION_MOVE x=150.0 y=138.0
360 :Sending Pointer ACTION_MOVE x=155.0 y=142.0
361 :Sending Pointer ACTION_MOVE x=162.0 y=150.0
362 :Sending Pointer ACTION_UP x=162.0 y=150.0
363 Sleeping for 0 milliseconds
364 :SendKey (ACTION_DOWN): 82    // KEYCODE_MENU
365 :SendKey (ACTION_UP): 82    // KEYCODE_MENU
366     // Allowing start of Intent { cmp=wfh.LessonTable/.AWeekLesson } in package wfh.LessonTable
367 Sleeping for 0 milliseconds
368 :Sending Pointer ACTION_MOVE x=0.0 y=-1.0
369 :Sending Pointer ACTION_MOVE x=-2.0 y=0.0
370 :Sending Pointer ACTION_MOVE x=2.0 y=2.0
371 :Sending Pointer ACTION_MOVE x=-5.0 y=-1.0
372 :Sending Pointer ACTION_MOVE x=-1.0 y=0.0
373 :Sending Pointer ACTION_MOVE x=-4.0 y=4.0
374 :Sending Pointer ACTION_MOVE x=4.0 y=4.0
375 :Sending Pointer ACTION_MOVE x=3.0 y=-2.0
376 :Sending Pointer ACTION_MOVE x=2.0 y=2.0
377 :Sending Pointer ACTION_MOVE x=-1.0 y=-1.0
378 :SendKey (ACTION_DOWN): 19    // KEYCODE_DPAD_UP
379 :SendKey (ACTION_UP): 19    // KEYCODE_DPAD_UP
380 Sleeping for 0 milliseconds
381 :Sending Pointer ACTION_DOWN x=134.0 y=239.0
382 :Sending Pointer ACTION_UP x=134.0 y=239.0
383 Sleeping for 0 milliseconds
384 :SendKey (ACTION_DOWN): 4    // KEYCODE_BACK
385 :SendKey (ACTION_UP): 4    // KEYCODE_BACK
386 Sleeping for 0 milliseconds
387 :SendKey (ACTION_DOWN): 23    // KEYCODE_DPAD_CENTER
388     // activityResuming(wfh.LessonTable)
389 :SendKey (ACTION_UP): 23    // KEYCODE_DPAD_CENTER
390 Sleeping for 0 milliseconds
391 :SendKey (ACTION_DOWN): 22    // KEYCODE_DPAD_RIGHT
392 :SendKey (ACTION_UP): 22    // KEYCODE_DPAD_RIGHT
393 Sleeping for 0 milliseconds
394 :SendKey (ACTION_DOWN): 19    // KEYCODE_DPAD_UP
395 :SendKey (ACTION_UP): 19    // KEYCODE_DPAD_UP
396 Sleeping for 0 milliseconds
397 :SendKey (ACTION_DOWN): 21    // KEYCODE_DPAD_LEFT
398 :SendKey (ACTION_UP): 21    // KEYCODE_DPAD_LEFT
399 Sleeping for 0 milliseconds
400 :SendKey (ACTION_DOWN): 19    // KEYCODE_DPAD_UP
401 :SendKey (ACTION_UP): 19    // KEYCODE_DPAD_UP
402 Sleeping for 0 milliseconds
403 :SendKey (ACTION_DOWN): 23    // KEYCODE_DPAD_CENTER
404 :SendKey (ACTION_UP): 23    // KEYCODE_DPAD_CENTER
405 Sleeping for 0 milliseconds
406 :Sending Pointer ACTION_DOWN x=118.0 y=37.0
407 :Sending Pointer ACTION_MOVE x=119.0 y=33.0
408 :Sending Pointer ACTION_UP x=119.0 y=33.0
409 Sleeping for 0 milliseconds
410 :Sending Pointer ACTION_DOWN x=297.0 y=358.0
411 :Sending Pointer ACTION_MOVE x=289.0 y=363.0
412 :Sending Pointer ACTION_MOVE x=284.0 y=369.0
413 :Sending Pointer ACTION_UP x=284.0 y=369.0
414 Sleeping for 0 milliseconds
415 :Sending Pointer ACTION_DOWN x=258.0 y=403.0
416 :Sending Pointer ACTION_MOVE x=249.0 y=398.0
417 :Sending Pointer ACTION_MOVE x=258.0 y=393.0
418 :Sending Pointer ACTION_MOVE x=258.0 y=402.0
419 :Sending Pointer ACTION_MOVE x=263.0 y=395.0
420 :Sending Pointer ACTION_MOVE x=266.0 y=399.0
421 :Sending Pointer ACTION_MOVE x=273.0 y=403.0
422 :Sending Pointer ACTION_UP x=273.0 y=403.0
423 Sleeping for 0 milliseconds
424 :Sending Pointer ACTION_MOVE x=-5.0 y=-5.0
425 :Sending Pointer ACTION_MOVE x=1.0 y=-2.0
426 :Sending Pointer ACTION_MOVE x=1.0 y=-4.0
427 :Sending Pointer ACTION_MOVE x=-2.0 y=2.0
428 :Sending Pointer ACTION_MOVE x=3.0 y=-3.0
429 :Sending Pointer ACTION_MOVE x=2.0 y=-4.0
430 :Sending Pointer ACTION_MOVE x=-5.0 y=2.0
431 :Sending Pointer ACTION_MOVE x=0.0 y=0.0
432
433 当测试到ACTION_MOVE x=0.0 y=0.0这个动作时,发生了FC(Force Close)错误,以下为输出错误信息。同时在LogCat里面也有错误输出,而且LogCat里面的错误信息更为详细,在实际的测试中应该结合两者输出的信息进行调试程序。
434
435 // CRASH: wfh.LessonTable (pid 1973)
436 // Short Msg: java.lang.NullPointerException
437 // Long Msg: java.lang.NullPointerException
438 // Build Label: android:generic/sdk/generic/:2.1-update1/ECLAIR/35983:eng/test-keys
439 // Build Changelist: 35983
440 // Build Time: 1273161972
441 // ID:
442 // Tag: AndroidRuntime
443 // java.lang.NullPointerException:
444 //   at android.widget.TabHost.dispatchKeyEvent(TabHost.java:279)
445 //   at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:748)
446 //   at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:748)
447 //   at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:748)
448 //   at android.widget.TabHost.dispatchKeyEvent(TabHost.java:275)
449 //   at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:748)
450 //   at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:748)
451 //   at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:748)
452 //   at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1655)
453 //   at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1102)
454 //   at android.app.Activity.dispatchKeyEvent(Activity.java:2038)
455 //   at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1631)
456 //   at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2368)
457 //   at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2338)
458 //   at android.view.ViewRoot.handleMessage(ViewRoot.java:1641)
459 //   at android.os.Handler.dispatchMessage(Handler.java:99)
460 //   at android.os.Looper.loop(Looper.java:123)
461 //   at android.app.ActivityThread.main(ActivityThread.java:4363)
462 //   at java.lang.reflect.Method.invokeNative(Method.java:-2)
463 //   at java.lang.reflect.Method.invoke(Method.java:521)
464 //   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
465 //   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
466 //   at dalvik.system.NativeStart.main(NativeStart.java:-2)
467
468 ** Monkey aborted due to error.
469 Events injected: 190
470 :Dropped: keys=0 pointers=11 trackballs=0 flips=0
471 ## Network stats: elapsed time=27954ms (27954ms mobile, 0ms wifi, 0ms not connected)
472 ** System appears to have crashed at event 190 of 200 using seed 0
473 #
474
475
476 开始monkey测试时android的LogCat输出的信息:
477
478 11-01 08:52:53.712: DEBUG/AndroidRuntime(2077): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
479 11-01 08:52:53.742: DEBUG/AndroidRuntime(2077): CheckJNI is ON
480 11-01 08:52:54.453: DEBUG/AndroidRuntime(2077): --- registering native functions ---
481 11-01 08:52:55.542: DEBUG/ddm-heap(2077): Got feature list request
482 11-01 08:52:59.533: INFO/ActivityManager(53): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=wfh.LessonTable/.MainTable }
483 11-01 08:53:00.842: INFO/ActivityManager(53): Displayed activity wfh.LessonTable/.MainTable: 1266 ms (total 1266 ms)
484 11-01 08:53:03.123: DEBUG/dalvikvm(1973): GC freed 7524 objects / 507616 bytes in 246ms
485 11-01 08:53:03.173: INFO/dalvikvm(1973): Uncaught exception thrown by finalizer (will be discarded):
486 11-01 08:53:03.213: INFO/dalvikvm(1973): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43c585c0 on MO that has not been deactivated or closed
487 11-01 08:53:03.213: INFO/dalvikvm(1973):     at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
488 11-01 08:53:03.213: INFO/dalvikvm(1973):     at dalvik.system.NativeStart.run(Native Method)
489 11-01 08:53:03.233: INFO/dalvikvm(1973): Uncaught exception thrown by finalizer (will be discarded):
490 11-01 08:53:03.252: INFO/dalvikvm(1973): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43c57f98 on MO that has not been deactivated or closed
491 11-01 08:53:03.252: INFO/dalvikvm(1973):     at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
492 11-01 08:53:03.252: INFO/dalvikvm(1973):     at dalvik.system.NativeStart.run(Native Method)
493 11-01 08:53:03.263: INFO/dalvikvm(1973): Uncaught exception thrown by finalizer (will be discarded):
494 11-01 08:53:03.293: INFO/dalvikvm(1973): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43c57970 on MO that has not been deactivated or closed
495 11-01 08:53:03.293: INFO/dalvikvm(1973):     at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
496 11-01 08:53:03.303: INFO/dalvikvm(1973):     at dalvik.system.NativeStart.run(Native Method)
497 11-01 08:53:03.323: INFO/dalvikvm(1973): Uncaught exception thrown by finalizer (will be discarded):
498 11-01 08:53:03.323: INFO/dalvikvm(1973): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43c57330 on MO that has not been deactivated or closed
499 11-01 08:53:03.333: INFO/dalvikvm(1973):     at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
500 11-01 08:53:03.353: INFO/dalvikvm(1973):     at dalvik.system.NativeStart.run(Native Method)
501 11-01 08:53:03.363: INFO/dalvikvm(1973): Uncaught exception thrown by finalizer (will be discarded):
502 11-01 08:53:03.403: INFO/dalvikvm(1973): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43c45330 on MO that has not been deactivated or closed
503 11-01 08:53:03.403: INFO/dalvikvm(1973):     at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
504 11-01 08:53:03.403: INFO/dalvikvm(1973):     at dalvik.system.NativeStart.run(Native Method)
505 11-01 08:53:03.423: INFO/dalvikvm(1973): Uncaught exception thrown by finalizer (will be discarded):
506 11-01 08:53:03.433: INFO/dalvikvm(1973): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43c44d08 on MO that has not been deactivated or closed
507 11-01 08:53:03.443: INFO/dalvikvm(1973):     at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
508 11-01 08:53:03.443: INFO/dalvikvm(1973):     at dalvik.system.NativeStart.run(Native Method)
509 11-01 08:53:03.453: INFO/dalvikvm(1973): Uncaught exception thrown by finalizer (will be discarded):
510 11-01 08:53:03.483: INFO/dalvikvm(1973): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43c446c8 on MO that has not been deactivated or closed
511 11-01 08:53:03.483: INFO/dalvikvm(1973):     at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
512 11-01 08:53:03.503: INFO/dalvikvm(1973):     at dalvik.system.NativeStart.run(Native Method)
513 11-01 08:53:03.523: INFO/dalvikvm(1973): Uncaught exception thrown by finalizer (will be discarded):
514 11-01 08:53:03.563: INFO/dalvikvm(1973): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43c26288 on MO that has not been deactivated or closed
515 11-01 08:53:03.572: INFO/dalvikvm(1973):     at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
516 11-01 08:53:03.572: INFO/dalvikvm(1973):     at dalvik.system.NativeStart.run(Native Method)
517 11-01 08:53:03.622: INFO/dalvikvm(1973): Uncaught exception thrown by finalizer (will be discarded):
518 11-01 08:53:03.642: INFO/dalvikvm(1973): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43c25cb0 on MO that has not been deactivated or closed
519 11-01 08:53:03.642: INFO/dalvikvm(1973):     at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
520 11-01 08:53:03.662: INFO/dalvikvm(1973):     at dalvik.system.NativeStart.run(Native Method)
521 11-01 08:53:03.662: INFO/dalvikvm(1973): Uncaught exception thrown by finalizer (will be discarded):
522 11-01 08:53:03.722: INFO/dalvikvm(1973): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43c256d8 on MO that has not been deactivated or closed
523 11-01 08:53:03.722: INFO/dalvikvm(1973):     at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
524 11-01 08:53:03.722: INFO/dalvikvm(1973):     at dalvik.system.NativeStart.run(Native Method)
525 11-01 08:53:03.732: INFO/dalvikvm(1973): Uncaught exception thrown by finalizer (will be discarded):
526 11-01 08:53:03.752: INFO/dalvikvm(1973): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43c250e8 on MO that has not been deactivated or closed
527 11-01 08:53:03.752: INFO/dalvikvm(1973):     at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
528 11-01 08:53:03.762: INFO/dalvikvm(1973):     at dalvik.system.NativeStart.run(Native Method)
529 11-01 08:53:03.902: INFO/dalvikvm(1973): Uncaught exception thrown by finalizer (will be discarded):
530 11-01 08:53:03.902: INFO/dalvikvm(1973): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.SQLiteCursor@43c1e780 on MO that has not been deactivated or closed
531 11-01 08:53:03.902: INFO/dalvikvm(1973):     at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596)
532 11-01 08:53:03.912: INFO/dalvikvm(1973):     at dalvik.system.NativeStart.run(Native Method)
533 11-01 08:53:04.247: WARN/KeyCharacterMap(1973): No keyboard for id 0
534 11-01 08:53:04.252: WARN/KeyCharacterMap(1973): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
535 11-01 08:53:04.762: INFO/ActivityManager(53): Starting activity: Intent { cmp=wfh.LessonTable/.EditLesson }
536 11-01 08:53:05.233: WARN/WindowManager(53): No window to dispatch pointer action 0
537 11-01 08:53:05.533: WARN/WindowManager(53): No window to dispatch pointer action 1
538 11-01 08:53:06.782: INFO/ActivityManager(53): Displayed activity wfh.LessonTable/.EditLesson: 1637 ms (total 1637 ms)
539 11-01 08:53:09.623: WARN/ActivityManager(53): Launch timeout has expired, giving up wake lock!
540 11-01 08:53:09.682: WARN/ActivityManager(53): Activity idle timeout for HistoryRecord{43d3ab48 wfh.LessonTable/.MainTable}
541 11-01 08:53:12.662: INFO/ActivityManager(53): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.android.launcher/.Launcher }
542 11-01 08:53:15.433: INFO/NotificationService(53): enqueueToast pkg=wfh.LessonTable callback=android.app.ITransientNotification$Stub$Proxy@43d5b308 duration=1
543 11-01 08:53:15.513: INFO/System.out(1973): UpdateRecord
544 11-01 08:53:19.353: INFO/NotificationService(53): enqueueToast pkg=android callback=android.widget.Toast$TN@43ced790 duration=0
545 11-01 08:53:19.752: WARN/InputManagerService(53): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43d2bab0
546 11-01 08:53:20.752: INFO/ActivityManager(53): Starting activity: Intent { cmp=wfh.LessonTable/.AWeekLesson (has extras) }
547 11-01 08:53:21.852: INFO/ActivityManager(53): Displayed activity wfh.LessonTable/.AWeekLesson: 1028 ms (total 1028 ms)
548 11-01 08:53:27.093: DEBUG/AndroidRuntime(1973): Shutting down VM
549 11-01 08:53:27.113: WARN/dalvikvm(1973): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
550
551
552
553 以下为LogCat输出的错误信息,在以下的信息中首先从自己的包中找错误,如果没有自己的包的话就再找发生错误的包的第一个发生了异常。由错误提示可以看出很大的可能是因为TabHost引发的异常。经过查看代码发现是由于TabHost的编写不规范,TabHost与其中一个view放在了一起,在 monkey测试做滚球上下滚动时当滚到TabHost时就发生了异常了。所以把TabHost与Activity分开写就不会出现些问题了。
554
555
556
557 11-01 08:53:27.113: ERROR/AndroidRuntime(1973): Uncaught handler: thread main exiting due to uncaught exception
558 11-01 08:53:27.133: ERROR/AndroidRuntime(1973): java.lang.NullPointerException
559 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at android.widget.TabHost.dispatchKeyEvent(TabHost.java:279)
560 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:748)
561 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:748)
562 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:748)
563 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at android.widget.TabHost.dispatchKeyEvent(TabHost.java:275)
564 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:748)
565 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:748)
566 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:748)
567 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1655)
568 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1102)
569 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at android.app.Activity.dispatchKeyEvent(Activity.java:2038)
570 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1631)
571 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at android.view.ViewRoot.deliverKeyEventToViewHierarchy(ViewRoot.java:2368)
572 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at android.view.ViewRoot.handleFinishedEvent(ViewRoot.java:2338)
573 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1641)
574 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at android.os.Handler.dispatchMessage(Handler.java:99)
575 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at android.os.Looper.loop(Looper.java:123)
576 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at android.app.ActivityThread.main(ActivityThread.java:4363)
577 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at java.lang.reflect.Method.invokeNative(Native Method)
578 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at java.lang.reflect.Method.invoke(Method.java:521)
579 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
580 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
581 11-01 08:53:27.133: ERROR/AndroidRuntime(1973):     at dalvik.system.NativeStart.main(Native Method)
582 11-01 08:53:27.163: INFO/Process(53): Sending signal. PID: 1973 SIG: 3
583 11-01 08:53:27.173: INFO/dalvikvm(1973): threadid=7: reacting to signal 3
584 11-01 08:53:27.173: ERROR/dalvikvm(1973): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
585 11-01 08:53:27.622: INFO/AndroidRuntime(2077): AndroidRuntime onExit calling exit(190)
586 11-01 08:53:33.702: WARN/ActivityManager(53): Launch timeout has expired, giving up wake lock!
587 11-01 08:53:33.733: WARN/ActivityManager(53): Activity idle timeout for HistoryRecord{43d3ab48 wfh.LessonTable/.MainTable}
588 11-01 08:53:41.173: DEBUG/dalvikvm(1334): GC freed 62 objects / 3120 bytes in 2419ms
589 11-01 08:53:43.742: WARN/ActivityManager(53): Activity destroy timeout for HistoryRecord{43dc5028 wfh.LessonTable/.AWeekLesson}
590
591 四、总结:
592 在monkey测试中常用的命令组合有:
593 1、monkey -p com.yourpackage -v 500//简单的输出测试的信息。
594 2、monkey -p com.yourpackage -v -v -v 500 //以深度为三级输出测试信息。
595 3、monkey -p com.yourpackage --port 端口号 -v//为测试分配一个专用的端口号,不过这个命令只能输出跳转的信息及有错误时输出信息。
596 4、monkey -p com.yourpackage -s 数字 -v 500//为随机数的事件序列定一个值,若出现问题下次可以重复同样的系列进行排错。
597 5、monkey -p com.yourpackage -v --throttle 3000 500//为每一次执行一次有效的事件后休眠3000毫秒。
598
599 五、附录:
600 以下内容为android系统中的keycode值,在以后的调试中会经常需要查询:
601 KEYCODE_UNKNOWN=0;
602 KEYCODE_SOFT_LEFT=1;
603 KEYCODE_SOFT_RIGHT=2;
604 KEYCODE_HOME=3;
605 KEYCODE_BACK=4;
606 KEYCODE_CALL=5;
607 KEYCODE_ENDCALL=6;
608 KEYCODE_0=7;
609 KEYCODE_1=8;
610 KEYCODE_2=9;
611 KEYCODE_3=10;
612 KEYCODE_4=11;
613 KEYCODE_5=12;
614 KEYCODE_6=13;
615 KEYCODE_7=14;
616 KEYCODE_8=15;
617 KEYCODE_9=16;
618 KEYCODE_STAR=17;      //-----------------------------------
619 KEYCODE_POUND=18;
620 KEYCODE_DPAD_UP=19;
621 KEYCODE_DPAD_DOWN=20;
622 KEYCODE_DPAD_LEFT=21;
623 KEYCODE_DPAD_RIGHT=22;
624 KEYCODE_DPAD_CENTER=23;
625 KEYCODE_VOLUME_UP=24;
626 KEYCODE_VOLUME_DOWN=25;
627 KEYCODE_POWER=26;
628 KEYCODE_CAMERA=27;
629 KEYCODE_CLEAR=28;    //-----------------------------------
630 KEYCODE_A=29;
631 KEYCODE_B=30;
632 KEYCODE_C=31;
633 KEYCODE_D=32;
634 KEYCODE_E=33;
635 KEYCODE_F=34;
636 KEYCODE_G=35;
637 KEYCODE_H=36;
638 KEYCODE_I=37;
639 KEYCODE_J=38;
640 KEYCODE_K=39;
641 KEYCODE_L=40;
642 KEYCODE_M=41;
643 KEYCODE_N=42;
644 KEYCODE_O=43;
645 KEYCODE_P=44;
646 KEYCODE_Q=45;
647 KEYCODE_R=46;
648 KEYCODE_S=47;
649 KEYCODE_T=48;
650 KEYCODE_U=49;
651 KEYCODE_V=50;
652 KEYCODE_W=51;
653 KEYCODE_X=52;
654 KEYCODE_Y=53;
655 KEYCODE_Z=54;
656 KEYCODE_COMMA=55;    //-----------------,------------------
657 KEYCODE_PERIOD=56;    //-----------------.------------------
658 KEYCODE_ALT_LEFT=57;
659 KEYCODE_ALT_RIGHT=58;
660 KEYCODE_SHIFT_LEFT=59;
661 KEYCODE_SHIFT_RIGHT=60;
662 KEYCODE_TAB=61;
663 KEYCODE_SPACE=62;
664 KEYCODE_SYM=63;
665 KEYCODE_EXPLORER=64; //-----------------------------------
666 KEYCODE_ENVELOPE=65;  //---------------信封--------------------
667 KEYCODE_ENTER=66;   
668 KEYCODE_DEL=67;
669 KEYCODE_GRAVE=68;  //---------------坟墓--------------------
670 KEYCODE_MINUS=69;  //---------------负--------------------
671 KEYCODE_EQUALS=70;  //--------------等于(=)---------------------
672 KEYCODE_LEFT_BRACKET=71;  //----------------------------
673 KEYCODE_RIGHT_BRACKET=72;  //----------------------------
674 KEYCODE_BACKSLASH=73;  //-------------反斜线\---------------
675 KEYCODE_SEMICOLON=74;  //--------------;--------------
676 KEYCODE_APOSTROPHE=75; //---------------’-------------
677 KEYCODE_SLASH=76;         //--------------/?--------------
678 KEYCODE_AT=77;           //------------------@---------------
679 KEYCODE_NUM=78;
680 KEYCODE_HEADSETHOOK=79;  //----------------------------
681 KEYCODE_FOCUS=80;//*Camera*focus
682 KEYCODE_PLUS=81;   //------------+----------------
683 KEYCODE_MENU=82;
684 KEYCODE_NOTIFICATION=83;   //----------------------------
685 KEYCODE_SEARCH=84;
686 KEYCODE_MEDIA_PLAY_PAUSE=85;
687 KEYCODE_MEDIA_STOP=86;
688 KEYCODE_MEDIA_NEXT=87;
689 KEYCODE_MEDIA_PREVIOUS=88;
690 KEYCODE_MEDIA_REWIND=89;  //------------倒带----------------
691 KEYCODE_MEDIA_FAST_FORWARD=90;
692 KEYCODE_MUTE=91;  //-----------静音-----------------
分享到:
评论

相关推荐

    base zz zz zz zz

    base zz zz zz zz zz base zz zz zz zz zz base zz zz zz zz zz base zz zz zz zz zz

    android应用源码zz-doctor中医大夫助理信息系统.rar

    【标题】"android应用源码zz-doctor中医大夫助理信息系统.rar"揭示了这是一份针对Android平台开发的应用程序源代码,专门设计用于辅助中医大夫进行日常工作。这个系统可能集成了病症诊断、处方建议、病例记录等多种...

    Android应用源码之zz-doctor中医大夫助理信息系统

    《Android应用源码解析:zz-doctor中医大夫助理信息系统》 在移动开发领域,Android操作系统以其开源、灵活的特性,成为开发者们的重要选择。本文将深入探讨一款名为"zz-doctor"的中医大夫助理信息系统的Android...

    Android应用源码之zz-doctor中医大夫助理信息系统(简化版).zip

    《Android应用源码解析:zz-doctor中医大夫助理信息系统(简化版)》 在移动互联网时代,Android作为全球最大的智能手机操作系统,为开发者提供了丰富的平台来创建各种应用。本篇文章将深入探讨一个基于Android的源码...

    android应用源码zz-doctor中医大夫助理信息系统.zip源码资源下载

    《Android应用源码zz-doctor中医大夫助理信息系统详解》 在移动互联网时代,医疗信息化已经成为一个重要的发展方向。本文将深入探讨“android应用源码zz-doctor中医大夫助理信息系统”的核心功能、架构设计以及关键...

    android应用源码zz-doctor中医大夫助理信息系统.zip

    《Android应用源码zz-doctor中医大夫助理信息系统详解》 在移动开发领域,尤其是针对安卓(Android)平台的开发,源码分析是提升技术能力、理解应用架构和学习新技能的重要途径。本篇将深入探讨“android应用源码zz...

    android应用源码zz-doctor中医大夫助理信息系统-IT计算机-毕业设计.zip

    《Android应用源码zz-doctor中医大夫助理信息系统》是一款针对中医大夫日常工作设计的移动应用程序,旨在提高医生的工作效率,提供便捷的病人管理、诊断辅助以及医疗知识查询等功能。这款应用适用于IT计算机专业的...

    Android应用源码之zz-doctor中医大夫助理信息系统.zip

    《Android应用源码解析:zz-doctor中医大夫助理信息系统》 在移动医疗领域,Android平台的应用程序发挥着至关重要的作用,它们为医生和患者提供了便捷的交流与诊疗工具。本篇我们将深入探讨“zz-doctor中医大夫助理...

    Android应用源码10套安卓源码合集.zip

    Android应用源码10套安卓源码合集: android应用源码DroidBrowser浏览器.rar ...android应用源码zz-doctor中医大夫助理信息系统.rar Android应用源码之极致拟物化空气质量检测仪.rar android应用源码今日星座运势.rar

    android应用源码zz-doctor中医大夫助理信息系统源码.zip

    《Android应用源码zz-doctor中医大夫助理信息系统详解》 在深入探讨Android应用源码zz-doctor中医大夫助理信息系统之前,我们先理解一下这个项目的背景和目标。此项目旨在为中医大夫提供一个辅助信息系统,通过...

    安卓Android源码——zz-doctor中医大夫助理信息系统.zip

    "安卓Android源码——zz-doctor中医大夫助理信息系统.zip" 这个标题揭示了我们正在处理一个与安卓(Android)操作系统相关的项目,具体是一个名为"zz-doctor中医大夫助理信息系统"的应用程序的源代码。这个应用可能...

    中医大夫助理信息系统 zz-doctor

    中医大夫助理信息系统“zz-doctor”是一款基于Android平台的应用程序,旨在为中医医生提供智能化、便捷化的诊疗辅助工具。通过深入剖析这款应用的源码,我们可以了解到Android开发的多个关键知识点,以及中医信息化...

    Android应用源码安卓源码(172个合集).zip

    Android应用源码安卓源码(172个合集),可以做为你的学习参考。 365MobileSecretary v1.0.6(365手机助手AIDL) 888个经典 Logo.rar AdXmpp(Openfire+asmack+spark) .zip AidlDemo(简单aidl的...zz-doctor中医大夫助

    安卓Android源码——zz-doctor中医大夫助理信息系统(简化版).zip

    【标题】"安卓Android源码——zz-doctor中医大夫助理信息系统(简化版).zip" 提供的是一个基于Android平台的医疗应用源代码,主要针对中医大夫的助手系统。这个简化版可能包含了一些基本功能,旨在帮助中医大夫进行...

Global site tag (gtag.js) - Google Analytics