Part II (Practice):
Get ready:
Download Android SDK address: https://developer.android.com/index.html
Configure environment variables (for Ubuntu or Mac)
Source/etc/profile
Download Install Python 2.7/3.6
An app stress test practice:
1. Prepare a laptop and an Android phone. Mobile developer options, open USB connection
2. ADB Devices viewing devices
3. Install the test app. ADB install package.apk
4. Send pressure command: adb shell Monkey 1000
5. Get the App package name: adb logcat | grep START or adb logcat | Findstr START
cmp= Com.android.calculator2/. Calculator '/' before part is the package name
6. Specify the package name stress test
adb shell monkey-p com.android.calculator2 1000
Eg: mu class app PackageName = Cn.com.open.mooc
Monkey Parameters:
1. Throttle parameters
adb shell Monkey--throttle < milliseconds >
Specify the time interval between times
2. Seed parameters
Seed value of the instruction random number
ADB shell Monkey-s < seed > <envent-count>
adb shell monkey-p com.android.calculator2-s 100 1000
3. Touch Events
Set the percentage of touch events
adb shell Monkey--pct-touch < percent>
adb shell monkey-p com.android.calculator2-s--pct-touch 50 1000
4. Action Events
Specify percentage of Action events
adb shell Monkey--pct-motion < percent > Percentage of this event plus the percentage of other events equals 100.
EG:ADB Shell Monkey-v-P Com.android.calculator2--pct-touch--pct-motion--pct-appswitch 40 1000
Where Touch event 50%
Motion Event 10%
Appswitch Event 40%
Randomly executed 1000 times.
5. Other events
Trackball event: adb shell Monkey--pct-trackball < percent >
Basic navigation events: adb shell Monkey--pct-nav < percent >
Main navigation events: adb shell monkey--pct-majornav <percent >
System navigation events (home key back dial Key and volume key) adb shell Monkey--pct-syskeys < percent >
Start Activity Event (percentage of events set activity): ADB shell Monkey-pct-appswitch < percent >
Set infrequently used events: adb shell Monkey--pct-anyevent < percent >
6. Crash events
Ignore crashes and exceptions
adb shell Monkey--ignore-crashes < Event-count >
7. Timeout events
Anr
adb shell Monkey--ignore-timeouts < Event-count >
ANR storage path: adb shell--cd/data/anr/--LS--traces.text----Excepton Information analysis log
Android APP Special test--Stress test Chapter (II)