I developed the application and used Monkey to test it.
My application has a main screen and a menu item that opens the settings screen. One thing that I realized is that when a monkey opens a preference screen, it usually stays within the preference activity for a very long time. The only time he ever exits is when he restarts all my activity, and as soon as he enters into the activity of preferences, he again stays there, vigorously checking my activity of preferences, without leaving it.
This leads to the fact that my preference activity receives full training from the monkey, but my main activity does not receive much attention from it. I know that the behavior of the monkey is completely random, but it may be that I am doing something wrong with my activity? Repeated testing in the monkey showed that this behavior is consistent.
Below is the code for my preference activity:
public class MyPreferences extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.my_preference);
}
}
And my manifest declaration:
<activity android:name="com.myapp.android.testapp.MyPreferences"
android:label="@string/preference_activity_title"
android:configChanges="orientation|keyboard|keyboardHidden"
android:screenOrientation="portrait"/>
Oh, and I run the monkey with the following code:
adb shell monkey -p com.myapp.android.testapp -v 100000
Coins source
share