• monkey测试结果分析


    Monkey测试结果分析

    一. 初步分析方法:

    Monkey测试出现错误后,一般的差错步骤为以下几步:

    1、 找到是monkey里面的哪个地方出错

    2、 查看Monkey里面出错前的一些事件动作,并手动执行该动作

    3、 若以上步骤还不能找出,可以使用之前执行的monkey命令再执行一遍,注意seed值要一样

    一般的测试结果分析:

    1、 ANR问题:在日志中搜索“ANR” 
    2、 崩溃问题:在日志中搜索“Exception” 
    3、ForceClosed 和程序异常退出问题:在日志中搜索”Fatal”

    二. 详细分析monkey日志:

    将执行Monkey生成的log,从手机中导出并打开查看该log;在log的最开始都会显示Monkey执行的seed值、执行次数和测试的包名。

    首先我们需要查看Monkey测试中是否出现了ANR或者异常,具体方法如上述。

    然后我们要分析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.0

    Sleeping for 500 milliseconds

    :SendKey (ACTION_DOWN): 20 //KEYCODE_DPAD_DOWN

    :SendKey (ACTION_UP): 20 //KEYCODE_DPAD_DOWN

    Sleeping 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 
    Events injected: 6000代表 测试次数6000 
    Network stats:代表当前手机状态,elapsed time=808384ms代表总共执行时间

    如果要生成日志保存的话,也很简单,只需将monkey命令尾部加上你想生成log文件的路径,例如:

    txt文件路径为 d:/xxx.txt

    之前的命令:adb shell monkey -p com.bbk.recorder -v 10000

    之后的命令:adb shell monkey -p com.bbk.recorder -v 10000 >d:xxx.txt

    这样,跑完monkey之后的log日志就会保存在你的txt文件里了!

  • 相关阅读:
    设计模式之代理模式
    angularJS 常用插件指令
    textarea 输入框限制字数
    IE11报错:[vuex] vuex requires a Promise polyfill in this browser的问题解决
    Oauth2.0协议 http://www.php20.com/forum.php?mod=viewthread&tid=28 (出处: 码农之家)
    申请qq第三方登录 http://www.php20.com/forum.php?mod=viewthread&tid=29 (出处: 码农之家)
    yii2邮箱发送
    错误提示:LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt 的解决方法
    Java面试-List中的sort详细解读
    Java服务器-Disruptor使用注意
  • 原文地址:https://www.cnblogs.com/hejing-swust/p/7774206.html
Copyright © 2020-2023  润新知