2011-10-29 20 views
10

¿Cómo se usa la opción de categorías de la herramienta monkey?Android: Uso de categorías en Monkey

La parte pertinente de mi archivo de manifiesto es así:

<application android:icon="@drawable/icon" android:label="@string/app_name" android:name="MyApp" android:debuggable="true" android:allowBackup="false" android:testOnly="false"> 
     <activity android:name="MyLauncherActivity" android:label="@string/app_name" android:screenOrientation="portrait"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
     <activity android:name="MyMainActivity" android:label="@string/app_name" android:screenOrientation="portrait"> 
      <intent-filter> 
       <action android:name="none" /> 
       <category android:name="android.intent.category.MONKEY" /> 
      </intent-filter> 
     </activity> 

que ejecutar la aplicación en mi teléfono para asegurarse de que está funcionando entonces entro en esto en la línea de comandos:

adb shell monkey -p my.full.package.path -vvv 3 

Funciona bien.

Pero esto no funciona:

adb shell monkey -p my.full.package.path -c intent.CATEGORY_LAUNCHER -vvv 3 

y se obtiene el siguiente resultado:

:Monkey: seed=0 count=3 

:AllowPackage: myapp.full.package.path 

:IncludeCategory: intent.CATEGORY_LAUNCHER 

// Warning: no activities found for category intent.CATEGORY_LAUNCHER 

** No activities found to run, monkey aborted. 

Y tratar algunas variantes también no funcionaba:

:Monkey: seed=0 count=3 

:AllowPackage: my.full.package.path 

:IncludeCategory: CATEGORY_MONKEY 

:IncludeCategory: intent.CATEGORY_MONKEY 

:IncludeCategory: android.intent.MONKEY 

:IncludeCategory: android.intent.category.MONKEY 

:IncludeCategory: MONKEY 

// Warning: no activities found for category CATEGORY_MONKEY 

// Warning: no activities found for category intent.CATEGORY_MONKEY 

// Warning: no activities found for category android.intent.MONKEY 

// Warning: no activities found for category MONKEY 

** No activities found to run, monkey aborted. 

Cómo hacer Especifico las categorías

Respuesta

8

Estás muy cerca. Esto funcionó para mí:

adb shell monkey -p com.JamesBecwar.test -c android.intent.category.LAUNCHER -vvv 3 

Creo que el problema es que se necesita para incluir el lanzador también, porque si no lo hace el mono no se puede iniciar el programa. No te preocupes, puedes poner más de un -c param. Por ejemplo, puede hacer:

adb shell monkey -p com.JamesBecwar.test -c android.intent.category.LAUNCHER -c android.intent.category.MONKEY -vvv 3 

y debería funcionar.