Monkey operation event classification and introduction

The random event stream performed by Monkey contains 11 major events, namely touch events, gesture events, two-finger zoom events, track events, screen rotation events, basic navigation events, main navigation events, system key events, start Activity events, and keyboards Events, other types of events. Monkey uses these 11 major events to simulate the user's routine operations and conduct stability tests on mobile apps. Let's take a closer look at these 11 major events.

1. Touch event

Touch event refers to the operation of pressing and lifting somewhere on the screen. The event percentage can be configured through the -pct-touch parameter. It can be seen from the external output log of Monkey executing the event. This event consists of a set of Touch (ACTION_DOWN) and Touch (ACTION_UP) events. The actual operation seen on the phone is similar to a click.

2. Gesture event

Gesture event refers to the operation of pressing, moving randomly, and lifting somewhere on the screen, that is, linear sliding operation. The event percentage can be configured through the -pct-motion parameter.
This event is composed of an ACTION_DOWN event, a series of ACTION_MOVE events and an ACTION_UP event. The actual operation seen on the phone is a straight sliding operation without turning.

3. Two-finger zoom event

The two-finger zoom event refers to the operation of pressing at two places on the screen at the same time, moving at the same time, and finally lifting at the same time, that is, the zoom in and zoom out gesture operation on the smart phone. The event percentage can be configured through the -pct-pinchzoom parameter. From the external output log of Monkey executing the event, it can be seen that
the event starts with an ACTION_DOWN event and an ACTION_POINTER_DOWN event, which simulates two fingers tapping at the same time; in the middle is a series of ACTION_MOVE events, that is, two fingers are on the screen at the same time Swipe up in a straight line; the end is composed of an ACTION_POINTER_UP event and an ACTION_UP event, that is, two fingers are released at the same time.

4. Track event

Track events are composed of one or more random movements, sometimes accompanied by clicks. A long time ago, Android phones had trackballs. This event is a simulated trackball operation. There are almost no trackballs in current mobile phones, but the trackball events include curve sliding operations. This parameter can be used if the program under test requires curve sliding. The event percentage can be configured through the -pct-trackball parameter. From the external output log of Monkey executing the event, it can be seen that
the event is composed of a series of Trackball (ACTION_MOVE) events. Observing the operation on the mobile phone is a series of curve sliding operations.

5. Screen rotation event

The screen rotation event is a hidden event, and this event is not recorded in the official Android documentation. It is actually the horizontal screen and vertical screen switching of a simulated Android phone. The event percentage can be configured through the -pct-rotation parameter. From the external output log of Monkey executing the event, you can see: [Code] The event consists of a rotation event, where degree represents the direction of rotation, clockwise rotation, 0 represents the direction of rotation by 90 degrees, and 1 represents the direction of rotation by 180 degrees. Direction, 2 represents the direction of rotation of 270 degrees, and 3 represents the direction of rotation of 360 degrees. During the execution, you can see that the phone screen is constantly switching between horizontal and vertical screens.

6. Basic navigation events

Basic navigation events refer to the operations of clicking the up, down, left, and right buttons of the direction input device. Nowadays, there are few up, down, left, and right buttons on mobile phones, and this kind of event is generally used less. The event percentage can be configured through the -pct-nav parameter. From the external output log of Monkey executing the event, it can be seen that
the event is composed of a Key (ACTION_DOWN) and a Key (ACTION_UP), and the four direction buttons up, down, left, and right are clicked.

7. Main navigation events

The main navigation event refers to the operation of clicking the "main navigation" button. These buttons usually cause actions in the UI interface, such as the middle button of the keyboard, the back button, and the menu button. The event percentage can be configured through the -pct-majornav parameter. From the external output log of Monkey executing the event, you can see: [Code] This event is composed of a Key (ACTION_DOWN) and a Key (ACTION_UP). The keys clicked are the middle key and the menu key.

8. System key events

The system key event refers to the operation of clicking the reserved key of the system, such as clicking the Home key, the return key, and the volume adjustment key. The event percentage can be configured through the -pct-syskeys parameter. From the external output log of Monkey executing the event, you can see: [Code] This event is composed of a Key (ACTION_DOWN) and a Key (ACTION_UP), and the clicks are the several system buttons mentioned above.

9. Start the Activity event

Starting an Activity event refers to the operation of starting an Activity on the phone. In random time intervals, Monkey will execute a startActivity() method as a way to maximize all the activities in the tested package. The event percentage can be configured through the -pct-appswitch parameter. From the external output log of Monkey executing the event, you can see: [Code] The event is composed of a Switch operation. From the mobile phone, the above operation is actually a com.android that opens the com.android.settings application. .settings.Settings Activity interface.

10. Keyboard events

Keyboard events are mainly operations related to the keyboard. For example, click the input box, the keyboard pops up, click outside the input box, and the keyboard retracts. The event percentage can be configured through the -pct-flip parameter. From the external output log of Monkey executing the event, you can see: [Code] As shown in the log, this is mainly the opening and closing operations of the keyboard.

11. Other types of events

Other types of events include all events except the 10 events mentioned above, such as keystrokes, buttons on other infrequently used devices, etc. The event percentage can be configured through the -pct-anyevent parameter. From the external output log of Monkey executing the event, you can see: [Code] The event is composed of a Key (ACTION_DOWN) and a Key (ACTION_UP). The clicked buttons are some other system buttons, such as letter buttons and number buttons. Wait. Because nowadays mobile phones rarely have letter keys or number keys, this event is generally used less.

Guess you like

Origin blog.csdn.net/Krystal_RonghuiLi/article/details/109314577