环境:Genymotion模拟器+Custome Phone-6.0.0,API 23

操作步骤如下:

cd data/app
ls //为了获取待测apk的包名

获取结果如下:

一个Monkey测试的小坑-LMLPHP

执行命令,其中包名使用tab按键进行自动补全:

 monkey -p com.fineex.xingdian- -v -v -v 

然后,发现,跑不起来,报错了……

报错信息如下:

:Monkey: seed= count=
:AllowPackage: com.fineex.xingdian-
:IncludeCategory: android.intent.category.LAUNCHER
:IncludeCategory: android.intent.category.MONKEY
// Selecting main activities from category android.intent.category.LAUNCHER
// - NOT USING main activity com.android.contacts.activities.PeopleActivity (from package com.android.contacts)
// - NOT USING main activity com.android.dialer.DialtactsActivity (from package com.android.dialer)
// - NOT USING main activity com.android.settings.Settings (from package com.android.settings)
// - NOT USING main activity com.android.browser.BrowserActivity (from package com.android.browser)
// - NOT USING main activity com.android.calendar.AllInOneActivity (from package com.android.calendar)
// - NOT USING main activity com.android.camera.CameraLauncher (from package com.android.camera2)
// - NOT USING main activity com.android.deskclock.DeskClock (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.gallery3d.app.GalleryActivity (from package com.android.gallery3d)
// - NOT USING main activity com.android.music.MusicBrowserActivity (from package com.android.music)
// - NOT USING main activity com.android.messaging.ui.conversationlist.ConversationListActivity (from package com.android.messaging)
// - NOT USING main activity com.example.android.apis.ApiDemos (from package com.example.android.apis)
// - NOT USING main activity com.android.gesture.builder.GestureBuilderActivity (from package com.android.gesture.builder)
// - NOT USING main activity com.amaze.filemanager.activities.MainActivity (from package com.amaze.filemanager)
// - NOT USING main activity com.android.calculator2.Calculator (from package com.android.calculator2)
// - NOT USING main activity com.android.customlocale2.CustomLocaleActivity (from package com.android.customlocale2)
// - NOT USING main activity com.android.development.Development (from package com.android.development)
// - NOT USING main activity android.app.AliasActivity (from package com.android.development_settings)
// - NOT USING main activity com.android.providers.downloads.ui.DownloadList (from package com.android.providers.downloads.ui)
// - NOT USING main activity com.android.quicksearchbox.SearchActivity (from package com.android.quicksearchbox)
// - NOT USING main activity com.koushikdutta.superuser.MainActivity (from package com.genymotion.superuser)
// - NOT USING main activity com.fineex.xingdian.activity.LoadingActivity (from package com.fineex.xingdian)
// Selecting main activities from category android.intent.category.MONKEY
// - NOT USING main activity com.android.launcher3.Launcher (from package com.android.launcher3)
// - 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)
** No activities found to run, monkey aborted.

大概意思就是说,遍历了目前所有的包,没有找到monkey命令找到的那个……

后来发现印象中以前做monkey测试的时候,ls列出的包都是没有后面那个奇怪的数字的,然后重新输入了命令:

 monkey -p com.fineex.xingdian -v 

大功告成,monkey成功运行了。发个博客记录下这个坑,肺已气炸,我寻思着以前也用的这个做的monkey测试没遇到过这个问题啊……

05-11 13:37