首页 > 代码库 > Monkey log分析说明
Monkey log分析说明
转自 https://i.cnblogs.com/EditArticles.aspx?opt=1
运行命令:
adb shell monkey -p com.crazyhornets.MyHokageAndroidZSY -v -v -v 20 -- throttle 1000
Log:
:Monkey: seed=0 count=20 //伪随机种子为0,事件总数20
:AllowPackage: com.crazyhornets.MyHokageAndroidZSY //包名
:IncludeCategory: android.intent.category.LAUNCHER //包含的类别
:IncludeCategory: android.intent.category.MONKEY
// Selecting main activities from category android.intent.category.LAUNCHER //选择主activities
// - NOT USING main activity com.miui.barcodescanner.activity.CaptureActivity (from package com.miui.barcodescanner)//这些都不是指定的包的activity
// - NOT USING main activity com.android.browser.BrowserActivity (from package com.android.browser)
// - NOT USING main activity com.android.calculator2.Calculator (from package com.android.calculator2)
// - NOT USING main activity com.android.calendar.AllInOneActivity (from package com.android.calendar)
// - NOT USING main activity com.android.camera.Camera (from package com.android.camera)
// - NOT USING main activity com.android.contacts.activities.PeopleActivity (from package com.android.contacts)
// - NOT USING main activity com.android.contacts.activities.TwelveKeyDialer (from package com.android.contacts)
// - NOT USING main activity com.android.deskclock.DeskClockTabActivity (from package com.android.deskclock)
// - NOT USING main activity com.android.email.activity.Welcome (from package com.android.email)
// - NOT USING main activity com.android.fileexplorer.FileExplorerTabActivity (from package com.android.fileexplorer)
// - NOT USING main activity com.miui.gallery.app.Gallery (from package com.miui.gallery)
// - NOT USING main activity com.android.mms.ui.MmsTabActivity (from package com.android.mms)
// - NOT USING main activity com.android.settings.MiuiSettings (from package com.android.settings)
// - NOT USING main activity com.android.thememanager.ThemeResourceTabActivity (from package com.android.thememanager)
// - NOT USING main activity com.miui.weather2.ActivityWeatherCycle (from package com.miui.weather2)
……//中间的省略,从这也可以看出你手机上都安装了哪些应用
// + Using main activity com.crazyhornets.MyHokage.MyHokageActivity (from package com.crazyhornets.MyHokageAndroidZSY) //这个就是我们指定的包的activity
// Selecting main activities from category android.intent.category.MONKEY
// - NOT USING main activity com.miui.home.launcher.Launcher (from package com.miui.home)
// - NOT USING main activity com.android.settings.Settings$RunningServicesActivity (from package com.android.settings)
// - NOT USING main activity com.android.settings.Settings$StorageUseActivity (from package com.android.settings)
// - NOT USING main activity com.android.settings.applications.ManageApplicationsActivity (from package com.android.settings)
// Seeded: 0 //种子为0
// Event percentages: //事件百分比
// 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跳转
// Allowing start of Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.crazyhornets.MyHokageAndroidZSY/com.cr
azyhornets.MyHokage.MyHokageActivity } in package com.crazyhornets.MyHokageAndroidZSY
//以下就是事件间的延迟和发送的各种事件
Sleeping for 0 milliseconds
:Sending Key (ACTION_DOWN): 22 // KEYCODE_DPAD_RIGHT
:Sending Key (ACTION_UP): 22 // KEYCODE_DPAD_RIGHT
Sleeping for 0 milliseconds
:Sending Key (ACTION_DOWN): 23 // KEYCODE_DPAD_CENTER
:Sending Key (ACTION_UP): 23 // KEYCODE_DPAD_CENTER
Sleeping for 0 milliseconds
:Sending Flip keyboardOpen=false
Sleeping for 0 milliseconds
:Sending Key (ACTION_DOWN): 20 // KEYCODE_DPAD_DOWN
:Sending Key (ACTION_UP): 20 // KEYCODE_DPAD_DOWN
Sleeping for 0 milliseconds
:Sending Touch (ACTION_DOWN): 0:(313.0,419.0)
:Sending Touch (ACTION_UP): 0:(313.19876,419.49512)
Sleeping for 0 milliseconds
:Sending Key (ACTION_DOWN): 82 // KEYCODE_MENU
:Sending Key (ACTION_UP): 82 // KEYCODE_MENU
Sleeping for 0 milliseconds
:Sending Touch (ACTION_DOWN): 0:(427.0,730.0)
:Sending Touch (ACTION_UP): 0:(432.7109,728.9021)
Sleeping for 0 milliseconds
:Sending Trackball (ACTION_MOVE): 0:(-1.0,-1.0)
:Sending Trackball (ACTION_MOVE): 0:(-5.0,0.0)
:Sending Trackball (ACTION_MOVE): 0:(3.0,4.0)
:Sending Trackball (ACTION_MOVE): 0:(0.0,4.0)
:Sending Trackball (ACTION_MOVE): 0:(3.0,-5.0)
:Sending Trackball (ACTION_MOVE): 0:(-2.0,0.0)
Events injected: 20 //注入事件20
:Sending rotation degree=0, persist=false //发送屏幕翻转 度=0,存留=假
:Dropped: keys=0 pointers=0 trackballs=0 flips=0 rotations=0 //丢弃:键=0,指针=0,轨迹球=0,键盘轻弹=0,屏幕翻转=0
## Network stats: elapsed time=265ms (0ms mobile, 265ms wifi, 0ms not connected) //网络状态:占用时间=265ms(手机0ms,wifi265ms,未连接0ms)
// Monkey finished //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; //-----------静音-----------------
Monkey log分析说明