Here are some helpful tips when using the monkey test.
Specify one action
Add category to manifest:
<activity android:name="MonkeyActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.MONKEY" /> </intent-filter> </activity>
and use the command as follows:
adb shell monkey -p my.package -c android.intent.category.MONKEY -v 500
Error Notification Prevention
In Android 5.0+, you can use the Screen Pinning feature.
- open this function in "settings"> "security"> "screen binding"
- click the recent / multitasking button next to the home button
- Click the green icon to connect the application you want to test.
then run the monkey test.
stop monkeyTest
Use the following command to stop the monkey test:
adb shell ps | awk '/com\.android\.commands\.monkey/ { system("adb shell kill " $2) }'
Link
source share