MonkeyTestYesAndroidAutomated TestingMonkey testing is very simple. It simulates users' key input, touch screen input, and gesture input to see how long the device will experience an exception.
When monkeyProgramWhen a simulator or device is running, a random pulse is generated when a user starts a system-level event, such as a click, touch, gesture, or system-level event, therefore, you can use Monkey to perform related operations with random duplicates.Performance Testing.
Command: $ ADBShellMonkey-v-P your. package. Name 500
Example: Monkey-v-P com. Android. Camera -- throttle 5000 -- PCT-anyevent 100 500
-V: displays the default degree.
-P com. Android. Camera is the program specified for the test (this is the content of the camera that begins the test)
-- Throttle 5000 sets the latency
-- PCT-anyevent 100 (set the percentage of started activities to 100%)
500 set the number of events
(For details, refer to the monkey Command help)
Here is an example: Monkey-P com. example. Android. notepad-v 10
The running result is explained as follows:
Proportion of events
// Event percentages:
// 0: 15.0%
// 1: 10.0%
// 2: 15.0%
// 3: 25.0%
// 4: 15.0%
// 5: 2.0%
// 6: 2.0%
// 7: 1.0%
/// 8: 15.0%
JumpCom. example. Android. notepadNoteslistIn this activity
: Switch: # intent; Action = Android. Intent. Action. Main; Category = Android. Intent. Categ
Ory. launcher; launchflags = 0x10000000; Component = com. example. Android. notepad/. Notes
List; End
Allow this intent jump
Allowing start of intent {act = Android. Intent. Action. Main cat = [Android. In
Tent. Category. Launcher] CMP = com. example. Android. notepad/. noteslist} in package
Com. example. Android. notepad
Sending actions:
Sleeping for 0 milliseconds
: SendKey (action_down): 21 // keycode_dpad_left
: SendKey (action_up): 21 // keycode_dpad_left
Sleeping for 0 milliseconds
: Sending pointer action_move x =-4.0 y = 2.0
: Sending pointer action_move x =-5.0 y =-4.0
: Sending pointer action_move x = 0.0 y =-1.0
: Sending pointer action_move x =-3.0 y = 2.0
: Sending pointer action_move x =-4.0 y = 2.0
: Sending pointer action_move x =-2.0 y = 4.0
: Sending pointer action_move x = 4.0 y = 1.0
Events injected: 10
Dropped, key = 0, pointer = 0, trackball = 0, flip = 0
: Dropped: Keys = 0 pointers = 0 trackbils = 0 flips = 0
The Network statistical period is 7249 ms, of which Ms is used inMobile phone0 ms for wireless networks, no connection time is 0 ms
# Network stats: elapsed time = 7249 ms (7249 Ms mobile, 0 Ms WiFi, 0 Ms not connecte
D)
End // monkey finished