Don't you know how to conduct stability tests with Monkey? Speed to get technology!

In the field of mobile automation testing, there is such a "Monkey". Once it is executed, it will make the mobile application under test jump around like a monkey. Testers usually use this "Monkey" to test the application. Programs are stress tested to evaluate and check the stability of the program under test.

The startup script of the Monkey command is in the bin directory under the System path of the Android system. Users mainly start Monkey through adb related commands to operate. When the Monkey command is executed, it will combine the matching parameters to generate different pseudo-random event streams, and will also execute the corresponding test event operations on the mobile device. During the stability test of Monkey, if the program under test crashes or has an exception, or ANR occurs, that is, the program does not respond, Monkey will record the relevant information in the corresponding log and judge whether the test process should continue or stop. According to the feedback level specified in the parameter, you can also see the report and event information generated during the execution process in the Monkey operation.

When Monkey conducts a stability test on a mobile app, it will use 11 major events to simulate the user's routine operations, but these events will be full of randomness in the execution process, mainly including gesture events, touch events, screen rotation events, keyboard events, and secondary events. Refers to zoom events, system key events, track events, basic navigation events, main navigation events, start Activity events, and other types of events.

(The picture comes from the Internet, if there is any infringement, please contact to delete it)
Gesture events are relatively common, simulating the user's operations such as pressing, lifting, and moving anywhere on the mobile phone screen. Monkey commands can be combined with --pct-motion parameter to configure the event percentage. A touch event is somewhat similar to a click operation on a mobile phone, simulating the user's operation of pressing and lifting a certain part of the screen. The Monkey command can be combined with the --pct-touch parameter to configure its event percentage. The screen rotation event is also relatively common, which is used to simulate the horizontal screen and vertical screen switching of the user's mobile phone. It is regarded as a hidden event, because there are not many explanations in the official documents. The Monkey command can be combined with the --pct-rotation parameter to configure its event percentage. Keyboard events mainly focus on related operations generated by using the keyboard, such as clicking the input box, keyboard pop-up and retraction, etc.

The Monkey command can be combined with the --pct-flip parameter to configure its event percentage. The two-finger zoom event is the user's zoom-in and zoom-out gesture operation on the mobile phone screen. The Monkey command can be combined with the --pct-pinchzoom parameter to configure its event percentage. The system button event mainly refers to clicking the use button that comes with the system, such as clicking the back button, volume adjustment button, etc. The Monkey command can be combined with the --pct-syskeys parameter to configure its event percentage. It seems that there are almost no track events now. This event is to simulate the operation of the trackball, like a series of curve sliding operations. The Monkey command can be combined with the --pct-trackball parameter to configure its event percentage. Basic navigation events, which are generally used less frequently, simulate the operation of the up, down, left, and right buttons of the input device. These operations are almost absent on mobile phones now. The Monkey command can be combined with the --pct-nav parameter to configure its event percentage. Main navigation events usually generate actions in the UI interface, such as back button, menu button, etc. The Monkey command can be combined with the --pct-majornav parameter to configure its event percentage. Starting an Activity event may not be easy to understand. Simply put, it is equivalent to starting an App activity page on a mobile phone. The Monkey command can be combined with the --pct-appswitch parameter to configure its event percentage. Finally, there are other types of events, except for those mentioned above, such as key presses, buttons on other uncommonly used devices, etc. The Monkey command can be combined with the --pct-anyevent parameter to configure its event percentage, but this event is rarely used now.

If there are friends who are not clear about the related operations of Monkey, you can pay attention to the official account in time, or leave a message to the editor, full of technical dry goods for everyone to learn and understand!

 

Guess you like

Origin blog.csdn.net/GUDUzhongliang/article/details/132023885