android stress test command monkey details

  • 2020-05-27 07:10:27
  • OfStack

1. What is Monkey?
Monkey is a tool that comes with SDK.

2. What is the purpose of the Monkey test?
: this tool is used for stress testing. The developer then combined the monkey printed logs with the system printed logs, resulting in problems in the outcome test.

3. What are the features of the Monkey test?
Monkey test, all events are generated randomly, without anyone's subjectivity.

4. Monkey command details

1). Standard monkey command
[adb shell] monkey [options] < eventcount > , such as:
adb shell monkey-v 500 -- generates 500 random events that affect all activity (not all activity, but activity containing Intent.CATEGORY_LAUNCHER or Intent.CATEGORY_MONKEY) in the system.
This is just a simple example. In practice, there are many options options
2).4 categories -- common options, event options, constraint options, and debugging options
1: common options

--help : print help information 
-v : specify the detail level of the printed information, 1 a  -v increase 1 A level   .   The default level is  0  . 

2: event options

-s : specifies the seed value to generate random events, and the same seed value to generate the same sequence of events. Such as:  -s 200
--throttle : interval time after each event -- reduce the pressure on the system (if not specified, the system will send the sequence of events as soon as possible). Such as: --throttle 100
--pct-touch : specifies the percentage of touch events, such as: --pct-touch 5%  .   Related is the following option : 
--pct-motion <percent>  (sliding event),  --pct-trackball <percent>  (trackball event)   ,  --pct-nav <percent>  (navigation event  up/down/left/right ),  --pct-majornav <percent> ( Primary navigation event  back key  ,  menu key) ,  --pct-syskeys <percent> ( System key event  Home  , Back  , startCall  ,  endCall  ,  volumeControl) ,  --pct-appswitch <percent>  ( activity Switching between),  --pct-anyevent <percent> (any event) 

3: constraint options

-p : specify valid package (if not specified, to all in the system package Effective), 1 a -p  The corresponding 1 An effective package .   Such as: -p com.ckt -p com.ckt.asura ; 
-c : activity Must contain at least 1 A specified category , can be started, otherwise can not start; 

4: debugging options

--dbg-no-events : initializes the startup activity , but there is no incident. 
--hprof : an analysis report is generated immediately before and after the event sequence is sent after the item is specified    -  1 It is generally recommended to specify this item. 
--ignore-crashes : ignoring crashes 
--ignore-timeouts : ignore timeout 
--ignore-security-exceptions : ignore security exceptions 
--kill-process-after-error : kill the process directly after an error occurs 
--monitor-native-crashes : trace local method crashes 
--wait-dbg : does not execute until the debugger is connected monkey The test. 

5. 1 simple monkey command:

adb shell monkey -p -s 500 -v 10000

However, in order to ensure that the number of tests carried out in a complete manner, we generally do not immediately exit the stress test when an error occurs. The monkey test command is as follows

adb shell monkey -p -s 500 --ignore-crashes --ignore-timeouts --monitor-native-crashes -v -v 10000 > E:\monkey_log\java_monkey_log.txt

6. monkey package: com. ckt. android. junit
Seed value for generating time series: 500
Ignoring program crashes, ignoring timeouts, monitoring local program crashes, detail level 2, 10,000 events.

Related articles: