Here is a monkey test method: Single Module Monkey test
The following is an example of the monkey Directive:
[Plain]View Plaincopy
- Monkey-s--throttle 450-p com.android.cameraswitch--kill-process-after-error--ignore-timeouts-- IGNORE-SECURITY-EXCEPTIONS-V 10000
This monkey instruction is test: Generates 10,000 pseudo-random operations (including touch, keystrokes, gestures, etc.) in the camera module.
The following is a brief description of the parameters involved:
-S <seed>
The seed value of the pseudo-random number generator. If you run Monkey again with the same seed value, it will generate the same sequence of events.
--throttle <milliseconds>
Inserts a fixed delay between events. This option slows down the execution speed of the Monkey. If this option is not specified, the Monkey will not be delayed and the event will be produced as soon as possible.
- P <allowed-package-name>
If you specify one or several packages with this parameter, monkey will only allow the system to start the activity in those packages. If your application also needs to access activity in other packages (such as choosing to take a contact), those packages need to be specified at the same time. If you do not specify any packages, monkey will allow the system to start the activity in all packages. To specify multiple packages, you need to use multiple-p options, and each-p option can be used for only one package.
--kill-process-after-error
Typically, when Monkey is stopped due to an error, the application that is faulted will continue to be in the running state. When this option is set, the system will be notified of the process of stopping the error. Note that the normal (successful) end, and does not stop the process from starting, the device simply stays in the final state after the end event.
--ignore-timeouts
Typically, monkey stops running when an application has any time-out errors, such as the application not responding dialog box. If this option is set, Monkey will continue to send events to the system until the count is complete.
--ignore-security-exceptions
Typically, when an application has a licensing error (such as starting an activity that requires some permission), Monkey will stop running. If this option is set, Monkey will continue to send events to the system until the count is complete.
- V
Each-V of the command line increases the level of feedback information. Level 0 (default) provides less information than startup prompts, test completion, and end results. Level 1 provides more detailed testing information, such as events sent individually to the ActivITy. Level 2 provides more detailed setup information, such as the Activity that was selected or unchecked in the test.
[Plain]View Plaincopy
- adb shell monkey-s--throttle 800-p net.kindroid.fm--ignore-timeouts--ignore-security-exceptions-v 100000
[Plain]View Plaincopy
- Steps:
- 1. Do not ignore exceptions
- adb shell monkey -p com.thunderst.radio --throttle 500 -s 600 -v -v -v 800000 >c:\long_radio_report.txt
- directive meaning: The application of the test is FM, the delay between events is 500 milliseconds, the seed seeds value is 600, three v indicates the highest level of output monkeylog, that is, the output of the most detailed monkey Log, the number of events tested 800,000 times, Log is stored in the ong_radio_report.txt of the C drive.
- 2, ignoring exception
- adb shell monkey-p com.thunderst.radio--throttle 500-s--ignore-crashes--ignore-timeouts--ignore-security-except Ions--ignore-native-crashes--monitor-native-crashes-v-v-v 800000 >c:\long_radio_report.txt
"Test" Android Monkey