Moneky Test Log 分析

本文解析了Monkey测试工具的日志输出,介绍了如何通过日志理解测试事件的类型与比例分配,展示了Monkey测试的具体运行实例,包括事件注入、允许的Intent跳转、发送的动作等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Moneky Test Log 分析:  
   首先用一个最简单的例子分析:
   monkey --pct-trackball 0 --throttle 100 -v 500
   /*p参数: 表示指定测试的程序
   /*v参数: 表示查看monkey生成的一些详细的随机的事件名*/
   /*数字100: 表示测试事件数为100*/

  
   结果如下:
  
   :Monkey: seed=0 count=100
 
   :AllowPackage: com.example.android.apis
   :IncludeCategory: android.intent.category.LAUNCHER
   :IncludeCategory: android.intent.category.MONKEY
  
   /*各种事件所占的比例及各数字分别表示:*/
   /* Event percentages:*/
   [--pct-touch PERCENT]    0: 15.0%
   [--pct-motion PERCENT]    1: 10.0%
   [--pct-trackball PERCENT]    2: 15.0%
   [--pct-syskeys PERCENT]    3: 25.0%
   [--pct-nav PERCENT]    4: 15.0%
   [--pct-majornav PERCENT]    5: 2.0%
   [--pct-appswitch PERCENT]    6: 2.0%
   [--pct-flip PERCENT]    7: 1.0%
   [--pct-anyevent PERCENT]    8: 15.0%

   :Switch:
  
   /*表示跳转到com.example.android.apis 里面的ApiDemos这一个Activity里。*/
   #Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;component=com.example.android.apis/.ApiDemos;end
  
   /*允许此Intent跳转。*/
   // 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
  
   /*发送的一些动作,如点击按下,点击放开,移动。*/
   :Sending Pointer ACTION_MOVE x=-4.0 y=2.0
   :Sending Pointer ACTION_UP x=0.0 y=0.0
   :Sending Pointer ACTION_DOWN x=207.0 y=282.0
   :Sending Pointer ACTION_UP x=189.0 y=289.0
   :Sending Pointer ACTION_DOWN x=95.0 y=259.0
   :Sending Pointer ACTION_UP x=95.0 y=259.0
   :Sending Pointer ACTION_DOWN x=295.0 y=223.0
   :Sending Pointer ACTION_UP x=290.0 y=213.0
   :Sending Pointer ACTION_MOVE x=-5.0 y=3.0
   :Sending Pointer ACTION_MOVE x=0.0 y=-5.0
  
   /*拒绝此跳转,因为它是跳转到非它自己的包的Activity,本测试中是指写测试它程序所在的包,此跳转是跳出本程序,进入到桌面。*/
   // Rejecting start of Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] cmp=com.android.launcher/.Launcher } in package com.android.launcher
  
   /*继续发送动作。8/
   :Sending Pointer ACTION_DOWN x=74.0 y=201.0
   :Sending Pointer ACTION_UP x=74.0 y=201.0
   :Sending Pointer ACTION_MOVE x=3.0 y=-2.0
   :Sending Pointer ACTION_UP x=0.0 y=0.0
   :Sending Pointer ACTION_MOVE x=-4.0 y=2.0
   Events injected: 100
  
   /*丢弃的,键=0,指针=0,轨迹球=0,翻转=0。*/
   :Dropped: keys=0 pointers=0 trackballs=0 flips=0
  
   /*网络统计经过时间为4202ms,其中4202ms是用于在手机上的,0ms用于无线网络上,没有连接的时间为0ms。*/

DOS窗口中显示的
// CRASH: com.android.speechrecorder (pid 2101) /*显示发生ForceClose_crash的应用程序名。*/
// Short Msg: java.lang.NullPointerException /*下面的我暂时还不知道是什么意思。*/
// Long Msg: java.lang.NullPointerException
// Build Label: generic/sdk/generic/:2.2/FRF91/43546:eng/test-keys
// Build Changelist: 43546
// Build Time: 1277931480000
// java.lang.NullPointerException
// at com.android.speechrecorder.SpeechRecorderActivity$4.run(SpeechRecorderActivity.java:192)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值