Monkey Log分析说明
运行命令:
adbshellmonkey-pcom.crazyhornets.MyHokageAndroidZSY-v-v-v20--throttle1000
Log:
:Monkey:seed=0count=20//伪随机种子为0,事件总数20
:AllowPackage:com.crazyhornets.MyHokageAndroidZSY//包名
:IncludeCategory:android.intent.category.LAUNCHER//包含的类别
:IncludeCategory:android.intent.category.MONKEY
//Selectingmainactivitiesfromcategoryandroid.intent.category.LAUNCHER//选择主activities
//-NOTUSINGmainactivitycom.miui.barcodescanner.activity.CaptureActivity(frompackagecom.miui.barcodescanner)//这些都不是指定的包的activity
//-NOTUSINGmainactivitycom.android.browser.BrowserActivity(frompackagecom.android.browser)
//-NOTUSINGmainactivitycom.android.calculator2.Calculator(frompackagecom.android.calculator2)
//-NOTUSINGmainactivitycom.android.calendar.AllInOneActivity(frompackagecom.android.calendar)
//-NOTUSINGmainactivitycom.android.camera.Camera(frompackagecom.android.camera)
//-NOTUSINGmainactivitycom.android.contacts.activities.PeopleActivity(frompackagecom.android.contacts)
//-NOTUSINGmainactivitycom.android.contacts.activities.TwelveKeyDialer(frompackagecom.android.contacts)
//-NOTUSINGmainactivitycom.android.deskclock.DeskClockTabActivity(frompackagecom.android.deskclock)
//-NOTUSINGmainactivitycom.android.email.activity.Welcome(frompackagecom.android.email)
//-NOTUSINGmainactivitycom.android.fileexplorer.FileExplorerTabActivity(frompackagecom.android.fileexplorer)
//-NOTUSINGmainactivitycom.miui.gallery.app.Gallery(frompackagecom.miui.gallery)
//-NOTUSINGmainactivitycom.android.mms.ui.MmsTabActivity(frompackagecom.android.mms)
//-NOTUSINGmainactivitycom.android.settings.MiuiSettings(frompackagecom.android.settings)
//-NOTUSINGmainactivitycom.android.thememanager.ThemeResourceTabActivity(frompackagecom.android.thememanager)
//-NOTUSINGmainactivitycom.miui.weather2.ActivityWeatherCycle(frompackagecom.miui.weather2)
……//中间的省略,从这也可以看出你手机上都安装了哪些应用
//+Usingmainactivitycom.crazyhornets.MyHokage.MyHokageActivity(frompackagecom.crazyhornets.MyHokageAndroidZSY)//这个就是我们指定的包的activity
//Selectingmainactivitiesfromcategoryandroid.intent.category.MONKEY
//-NOTUSINGmainactivitycom.miui.home.launcher.Launcher(frompackagecom.miui.home)
//-NOTUSINGmainactivitycom.android.settings.Settings$RunningServicesActivity(frompackagecom.android.settings)
//-NOTUSINGmainactivitycom.android.settings.Settings$StorageUseActivity(frompackagecom.android.settings)
//-NOTUSINGmainactivitycom.android.settings.applications.ManageApplicationsActivity(frompackagecom.android.settings)
//Seeded:0//种子为0
//Eventpercentages://事件百分比
//0:15.0%
//1:10.0%
//2:2.0%
//3:15.0%
//4:-0.0%
//5:25.0%
//6:15.0%
//7:2.0%
//8:2.0%
//9:1.0%
//10:13.0%
//表示跳转到com.crazyhornets.MyHokageAndroidZSY包中的com.crazyhornets.MyHokage.MyHokageActivity里
:Switch:#Intent;action=android.intent.action.MAIN;category=android.intent.category.LAUNCHER;launchFlags=0x10200000;component=com.crazyhornets.MyHokag
eAndroidZSY/com.crazyhornets.MyHokage.MyHokageActivity;end
//允许此Intent跳转
//AllowingstartofIntent{act=android.intent.action.MAINcat=[android.intent.category.LAUNCHER]cmp=com.crazyhornets.MyHokageAndroidZSY/com.cr
azyhornets.MyHokage.MyHokageActivity}inpackagecom.crazyhornets.MyHokageAndroidZSY
//以下就是事件间的延迟和发送的各种事件
Sleepingfor0milliseconds
:SendingKey(ACTION_DOWN):22//KEYCODE_DPAD_RIGHT
:SendingKey(ACTION_UP):22//KEYCODE_DPAD_RIGHT
Sleepingfor0milliseconds
:SendingKey(ACTION_DOWN):23//KEYCODE_DPAD_CENTER
:SendingKey(ACTION_UP):23//KEYCODE_DPAD_CENTER
Sleepingfor0milliseconds
:SendingFlipkeyboardOpen=false
Sleepingfor0milliseconds
:SendingKey(ACTION_DOWN):20//KEYCODE_DPAD_DOWN
:SendingKey(ACTION_UP):20//KEYCODE_DPAD_DOWN
Sleepingfor0milliseconds
:SendingTouch(ACTION_DOWN):0:(313.0,419.0)
:SendingTouch(ACTION_UP):0:(313.19876,419.49512)
Sleepingfor0milliseconds
:SendingKey(ACTION_DOWN):82//KEYCODE_MENU
:SendingKey(ACTION_UP):82//KEYCODE_MENU
Sleepingfor0milliseconds
:SendingTouch(ACTION_DOWN):0:(427.0,730.0)
:SendingTouch(ACTION_UP):0:(432.7109,728.9021)
Sleepingfor0milliseconds
:SendingTrackball(ACTION_MOVE):0:(-1.0,-1.0)
:SendingTrackball(ACTION_MOVE):0:(-5.0,0.0)
:SendingTrackball(ACTION_MOVE):0:(3.0,4.0)
:SendingTrackball(ACTION_MOVE):0:(0.0,4.0)
:SendingTrackball(ACTION_MOVE):0:(3.0,-5.0)
:SendingTrackball(ACTION_MOVE):0:(-2.0,0.0)
Eventsinjected:20//注入事件20
:Sendingrotationdegree=0,persist=false//发送屏幕翻转度=0,存留=假
:Dropped:keys=0pointers=0trackballs=0flips=0rotations=0//丢弃:键=0,指针=0,轨迹球=0,键盘轻弹=0,屏幕翻转=0
##Networkstats:elapsedtime=265ms(0msmobile,265mswifi,0msnotconnected)//网络状态:占用时间=265ms(手机0ms,wifi265ms,未连接0ms)
//Monkeyfinished//Monkey测试完成
从例子中可以看出,该程序在这次测试中没有问题,若程序出现问题终端将打印出异常供程序员查找错误。
以下内容为android系统中的keycode值,在以后的调试中会经常需要查询:
KEYCODE_UNKNOWN=0;
KEYCODE_SOFT_LEFT=1;
KEYCODE_SOFT_RIGHT=2;
KEYCODE_HOME=3;
KEYCODE_BACK=4;
KEYCODE_CALL=5;
KEYCODE_ENDCALL=6;
KEYCODE_0=7;
KEYCODE_1=8;
KEYCODE_2=9;
KEYCODE_3=10;
KEYCODE_4=11;
KEYCODE_5=12;
KEYCODE_6=13;
KEYCODE_7=14;
KEYCODE_8=15;
KEYCODE_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;
KEYCODE_VOLUME_UP=24;
KEYCODE_VOLUME_DOWN=25;
KEYCODE_POWER=26;
KEYCODE_CAMERA=27;
KEYCODE_CLEAR=28;//-----------------------------------
KEYCODE_A=29;
KEYCODE_B=30;
KEYCODE_C=31;
KEYCODE_D=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_O=43;
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;//-----------------,------------------
KEYCODE_PERIOD=56;//-----------------.------------------
KEYCODE_ALT_LEFT=57;
KEYCODE_ALT_RIGHT=58;
KEYCODE_SHIFT_LEFT=59;
KEYCODE_SHIFT_RIGHT=60;
KEYCODE_TAB=61;
KEYCODE_SPACE=62;
KEYCODE_SYM=63;
KEYCODE_EXPLORER=64;//-----------------------------------
KEYCODE_ENVELOPE=65;//---------------信封--------------------
KEYCODE_ENTER=66;
KEYCODE_DEL=67;
KEYCODE_GRAVE=68;//---------------坟墓--------------------
KEYCODE_MINUS=69;//---------------负--------------------
KEYCODE_EQUALS=70;//--------------等于(=)---------------------
KEYCODE_LEFT_BRACKET=71;//----------------------------
KEYCODE_RIGHT_BRACKET=72;//----------------------------
KEYCODE_BACKSLASH=73;//-------------反斜线\---------------
KEYCODE_SEMICOLON=74;//--------------;--------------
KEYCODE_APOSTROPHE=75;//---------------’-------------
KEYCODE_SLASH=76;//--------------/?--------------
KEYCODE_AT=77;//------------------@---------------
KEYCODE_NUM=78;
KEYCODE_HEADSETHOOK=79;//----------------------------
KEYCODE_FOCUS=80;//*Camera*focus
KEYCODE_PLUS=81;//------------+----------------
KEYCODE_MENU=82;
KEYCODE_NOTIFICATION=83;//----------------------------
KEYCODE_SEARCH=84;
KEYCODE_MEDIA_PLAY_PAUSE=85;
KEYCODE_MEDIA_STOP=86;
KEYCODE_MEDIA_NEXT=87;
KEYCODE_MEDIA_PREVIOUS=88;
KEYCODE_MEDIA_REWIND=89;//------------倒带----------------
KEYCODE_MEDIA_FAST_FORWARD=90;
KEYCODE_MUTE=91;//-----------静音-----------------