一、初步分析方法:
Monkey测试出现错误后,一般的差错步骤为以下几步:
1、找到是monkey里面的哪个地方出错
2、查看Monkey里面出错前的一些事件动作,并手动执行该动作
3、若以上步骤还不能找出,可以使用之前执行的monkey命令再执行一遍,注意seed值要一样
一般的测试结果分析:
1、ANR问题:在日志中搜索“ANR”
2、崩溃问题:在日志中搜索“Exception”
二、详细分析monkey日志:
首先我们需要查看Monkey测试中是否出现了ANR或者异常,具体方法如上述。将执行Monkey生成的log,从手机中导出并打开查看该log;在log的最开始都会显示Monkey执行的seed值、执行次数和测试的包名。具体方法如上述。
然后我们要分析log中的具体信息,方法如下:查看log中第一个Switch,主要是查看Monkey执行的是那一个Activity,譬如下面的log中,执行的是com.tencent.smtt.SplashActivity,在下一个swtich之间的,如果出现了崩溃或其他异常,可以在该Activity中查找问题的所在。
:Switch:#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10000000;component=com.tencent.smtt/.SplashActivity;end // Allowing start of Intent {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER]cmp=com.tencent.smtt/.SplashActivity } in package com.tencent.smtt
在下面的log中,Sending Pointer ACTION_DOWN和Sending Pointer ACTION_UP代表当前执行了一个单击的操作;
Sleeping for 500 milliseconds这句log是执行Monkey测试时,throttle设定的间隔时间,每出现一次,就代表一个事件。
SendKey(ACTION_DOWN) //KEYCODE_DPAD_DOWN 代表当前执行了一个点击下导航键的操作;
Sending Pointer ACTION_MOVE 代表当前执行了一个滑动界面的操作。
:Sending Pointer ACTION_DOWN x=47.0 y=438.0
:Sending Pointer ACTION_UP x=47.0 y=438.0Sleeping for 500 milliseconds
:SendKey (ACTION_DOWN): 20 //KEYCODE_DPAD_DOWN
:SendKey (ACTION_UP): 20 //KEYCODE_DPAD_DOWNSleeping for 500 milliseconds
:Sending Pointer ACTION_MOVE x=-2.0 y=3.0
:Sending Pointer ACTION_MOVE x=4.0 y=-3.0
:Sending Pointer ACTION_MOVE x=-5.0 y=-3.0
:Sending Pointer ACTION_MOVE x=3.0 y=4.0
:Sending Pointer ACTION_MOVE x=-4.0 y=1.0
:Sending Pointer ACTION_MOVE x=-1.0 y=-1.0
:Sending Pointer ACTION_MOVE x=-2.0 y=-4.0
如果Monkey测试顺利执行完成,在log的最后,会打印出当前执行事件的次数和所花费的时间;// Monkey finished代表执行完成。Monkey执行中断,在log的最后也能查看到当前已执行的次数。
Monkey执行完成的log具体如下:
Events injected: 6000
:Dropped: keys=0 pointers=9 trackballs=0 flips=0## Network stats: elapsed time=808384ms (0ms mobile, 808384ms wifi, 0msnot connected)
// Monkey finished
Monkey之<Monkey简介>:https://www.songqinnet.com/article/959
Monkey之<Monkey命令详解>:https://www.songqinnet.com/article/961
Monkey之<Monkey日志分析>:https://www.songqinnet.com/article/963
文章来源: 松勤网
袁隆平作文素材积累:https://www.nanss.com/xuexi/3401.html
小故事大道理:https://www.nanss.com/yuedu/2894.html
自我介绍简短有趣:https://www.nanss.com/xuexi/2701.html
手足情深唯美短句:https://www.nanss.com/xuexi/4206.html
适合发朋友圈的父爱句子:https://www.nanss.com/yulu/4490.html
初二日记:https://www.nanss.com/xuexi/4136.html
坚持不懈的名言:https://www.nanss.com/xuexi/4491.html
初中随笔300字:https://www.nanss.com/xuexi/4670.html
冷死了幽默句子:https://www.nanss.com/wenan/4096.html
英语脏话:https://www.nanss.com/shenghuo/4583.html
党课心得体会:https://www.nanss.com/shenghuo/2840.html
听着很高级的昵称:https://www.nanss.com/mingcheng/3931.html
三年级盐水浮鸡蛋作文:https://www.nanss.com/xuexi/3711.html
中秋节的由来和传说故事:https://www.nanss.com/shenghuo/4727.html
火星文个性签名:https://www.nanss.com/wenan/3965.html
40岁稳重大气的网名:https://www.nanss.com/mingcheng/3523.html
游什么作文400字四年级:https://www.nanss.com/xuexi/3098.html
自信作文:https://www.nanss.com/xuexi/3295.html
女儿生日文案高级:https://www.nanss.com/wenan/2522.html
稀少好听的单字id:https://www.nanss.com/mingcheng/4965.html
同学聚会经典句子:https://www.nanss.com/yulu/3948.html
新学期计划300字:https://www.nanss.com/xuexi/4844.html
师德修养:https://www.nanss.com/gongzuo/4541.html
80后经典语录:https://www.nanss.com/yulu/3957.html
值周总结:https://www.nanss.com/gongzuo/3340.html
后勤管理工作总结:https://www.nanss.com/gongzuo/2580.html
梦想作文:https://www.nanss.com/xuexi/2882.html
商铺租赁合同:https://www.nanss.com/shenghuo/3088.html
期待落空的情景写一段话:https://www.nanss.com/xuexi/4033.html
让媳妇感动到哭的留言:https://www.nanss.com/yulu/3544.html