Test method, test unit and recording unit

By setting up a test unit inside the terminal device and a recording unit inside the recording device, receiving and analyzing the original event stream, constructing and distributing test events, the problems of low testing efficiency and dependence on the external environment in the prior art are solved, and efficient Flexible testing method.

CN119441016APending Publication Date: 2025-02-14GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310963002.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-08-01
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

Existing terminal device application testing methods cannot efficiently and flexibly test terminal device applications, resulting in low testing efficiency and high dependence on the external environment.

Method used

By receiving and parsing the original event stream, constructing test events, and distributing test events to drive the test device for testing. The method includes setting a test unit inside the test device and setting a recording unit inside the recording device, and transmitting the original event stream using a network connection.

Benefits of technology

It improves the efficiency of testing, reduces the dependence of testing methods on the external environment, enhances the flexibility of testing methods, and is suitable for large-scale remote automated testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119441016A_ABST
    Figure CN119441016A_ABST
Patent Text Reader

Abstract

The invention relates to a test method, a test unit and a recording unit. The test method is applied to a test unit arranged in test equipment, and comprises the following steps: receiving and analyzing an original event stream to obtain key information corresponding to the original event stream; constructing a test event by using the key information corresponding to the original event stream; and distributing the test event to drive the test equipment to test. The test efficiency can be improved; and the dependence degree of the test method on the external environment is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communications, and more specifically, to a testing method, a testing unit, and a recording unit. Background Art

[0002] In the prior art, with the rapid development of mobile Internet, the fields involved in terminal device applications are constantly expanding, and the complexity of application functions is constantly increasing. As a result, the testing methods for terminal device applications are gradually diversified.

[0003] However, the existing terminal device application testing methods cannot efficiently and flexibly test the terminal device application. Therefore, how to efficiently and flexibly test the terminal device application has become a technical problem that needs to be solved urgently. Summary of the invention

[0004] The embodiments of the present application provide a testing method, a testing unit and a recording unit, which can improve the efficiency of the test; and reduce the dependence of the testing method on the external environment.

[0005] The present application provides a testing method, which is applied to a testing unit disposed inside a testing device. The method includes:

[0006] Receive and parse the original event stream to obtain the key information corresponding to the original event stream;

[0007] Construct test events using the key information corresponding to the original event stream;

[0008] Distribute test events to drive the test equipment to perform tests.

[0009] The present application provides a testing method, which is applied to a recording unit disposed inside a recording device, and the method includes:

[0010] Generate original event stream according to operation events of recording device;

[0011] The original event stream is transmitted to the test unit inside the remote test device; the test device and the recording device are connected through the network.

[0012] The embodiment of the present application provides a test unit for testing, the test unit is arranged inside a test device, and the test unit includes:

[0013] The receiving and parsing module is used to receive and parse the original event stream to obtain key information corresponding to the original event stream;

[0014] A construction module is used to construct a test event using key information corresponding to the original event stream;

[0015] The distribution module is used to distribute test events to drive the test equipment to perform testing.

[0016] The embodiment of the present application provides a recording unit for testing, the recording unit is arranged inside a recording device, and the recording unit includes:

[0017] A generation module, used for generating an original event stream according to an operation event of a recording device;

[0018] The transmission module is used to transmit the original event stream to the test unit inside the remote test device; the test device and the recording device are connected through the network.

[0019] The present application provides a system for testing, wherein the system includes:

[0020] Any test unit; and,

[0021] Any recording unit.

[0022] The embodiment of the present application provides an electronic device, including: a processor and a memory. The memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory, so that the electronic device executes the test method in the embodiment of the present application.

[0023] The embodiment of the present application provides a chip for implementing the above-mentioned testing method.

[0024] Specifically, the chip includes: a processor, which is used to call and run a computer program from a memory, so that a device equipped with the chip executes the test method in the embodiment of the present application.

[0025] An embodiment of the present application provides a computer-readable storage medium for storing a computer program. When the computer program is executed by a device, the device executes the testing method in the embodiment of the present application.

[0026] An embodiment of the present application provides a computer program product, including computer program instructions, which enable a computer to execute the testing method in the embodiment of the present application.

[0027] The embodiment of the present application provides a computer program, which, when executed on a computer, enables the computer to execute the testing method in the embodiment of the present application.

[0028] In the embodiments of the present application, the test equipment program receives and parses the original event stream, and uses the original event stream to construct test events, which can avoid the dependence of the test method in the prior art on the operating environment or external tools to a certain extent, and improve the flexibility and efficiency of the test method; and distributes test events to drive the test equipment to perform testing, which can reduce the impact of manually writing test scripts or test cases on test efficiency in the prior art, and improve the efficiency of the test method. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 It is a schematic diagram of an application scenario of the present invention.

[0030] Figure 2 This is a flow diagram of the test method according to the embodiment of the present disclosure. Figure 1 .

[0031] Figure 3 The process diagram of the test method according to the embodiment of the present disclosure is as follows Figure 2 .

[0032] Figure 4 It is a schematic diagram of the application system structure of the testing method according to an embodiment of the present disclosure.

[0033] Figure 5 Schematic diagram of the structure of the "Calendar" application program of the embodiment of the present disclosure.

[0034] Fig. 6A A byte array corresponding to a single-click operation event according to an embodiment of the present disclosure.

[0035] Figure 6B is a byte array corresponding to the long press operation event according to an embodiment of the present disclosure.

[0036] Figure 6C is a byte array corresponding to the sliding operation event according to an embodiment of the present disclosure.

[0037] Figure 7 The process diagram of the test method according to the embodiment of the present disclosure is as follows Figure 3 .

[0038] Figure 8 It is a schematic diagram of the application system structure of another testing method according to an embodiment of the present disclosure.

[0039] Fig. 9 is a schematic block diagram of a test unit 900 for testing according to an embodiment of the present application.

[0040] Fig.10 is a schematic block diagram of a recording unit 1000 for testing according to an embodiment of the present application.

[0041] Fig.111 is a schematic diagram of the structure of a system 1100 for testing according to an embodiment of the present disclosure.

[0042] Fig.12 is a schematic structural diagram of an electronic device 1200 according to an embodiment of the present application.

[0043] Fig.13 is a schematic structural diagram of a chip 1300 according to an embodiment of the present application. DETAILED DESCRIPTION

[0044] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings in the embodiments of the present application. It should be understood that the specific embodiments described here are only used to explain the present application and are not used to limit the present application.

[0045] In addition, the term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0046] It should be understood that the "indication" mentioned in the embodiments of the present application can be a direct indication, an indirect indication, or an indication of an association relationship. For example, A indicates B, which can mean that A directly indicates B, for example, B can be obtained through A; it can also mean that A indirectly indicates B, for example, A indicates C, and B can be obtained through C; it can also mean that there is an association relationship between A and B.

[0047] In the description of the embodiments of the present application, the term "corresponding" may indicate a direct or indirect correspondence between two items, or an association relationship between the two items, or a relationship between indication and being indicated, configuration and being configured, and the like.

[0048] To facilitate understanding of the technical solutions of the embodiments of the present application, the relevant technologies of the embodiments of the present application are described below. The following related technologies can be arbitrarily combined with the technical solutions of the embodiments of the present application as optional solutions, and they all belong to the protection scope of the embodiments of the present application.

[0049] In order to better illustrate the present disclosure, some nouns or terms involved in the embodiments of the present application are explained below:

[0050] (1) Monkey: Monkey can refer to the automated testing tool provided by Android.

[0051] (2) Monkeyrunner: Monkeyrunner can refer to the open source Android testing framework.

[0052] (3) AppCrawler: AppCrawler can refer to an automatic traversal application testing tool for Android terminal devices.

[0053] (4)Instrumentation: Instrumentation can refer to the testing framework proposed by Android.

[0054] (5) Espresso: Espresso can refer to a testing framework.

[0055] (6) InputManager: InputManager can refer to system-level services.

[0056] (7) CTA: CTA refers to network access certification, which is the network access license system implemented by the state for telecommunications terminal equipment, radio communication equipment and telecommunications equipment involved in network interconnection used to access the public telecommunications network.

[0057] (8) General Data Protection Regulation (GDPR): GDPR is mainly used to protect personal data and privacy, and stipulates the standards and obligations for collecting, storing and processing personal data in the EU and outside the EU.

[0058] (9) Shell: Shell can refer to a command line tool that provides an interface to access the Linux (a computer operating system) kernel and the Android file system.

[0059] In the prior art, with the rapid development of mobile Internet and the differences in terminal device hardware information (such as the model of the terminal device, the system version of the terminal device, the operator information of the terminal device, the network environment of the terminal device, and the serial number of the terminal device, etc.), the fields involved in the application programs (App, application) on the terminal devices are constantly expanding, and the complexity of the functions included in the application programs is constantly increasing. Therefore, based on the above content, testing the application programs on the terminal devices has gradually become an indispensable and important part of the application development process. In some embodiments, by testing the application program, it can be understood whether there are errors in the operation of the application program, whether the operation process or operation results of the application program meet the expected requirements, and the pressure that the application program can withstand.

[0060] Currently, existing application testing methods include the following categories:

[0061] (1) Manual testing methods: Manual testing methods may include stress testing to test load, functional quality testing to test functional integrity, and special testing to test compliance with specific regulatory specifications (such as CTA, GDPR, and operator testing, etc.).

[0062] (2) Testing method based on automated testing tools: This testing method can deploy automated testing tools such as Monkey, Instrumentation, and AppCrawler inside the terminal device to achieve the purpose of testing the application program based on the terminal device.

[0063] (3) Testing method based on testing framework: The testing method based on testing framework can use testing frameworks such as Monkeyrunne and Espresso to test the applications of terminal devices.

[0064] (4) Automated testing method based on recording and playback: This method can perform the following steps in sequence to implement the testing of the terminal device application: click the start recording button to monitor the operation events of the application; click the end recording button to generate a recording file; read the content of the recording file and play back the operation events based on the content of the recording file; test the application by playing back the operation events.

[0065] However, the testing methods for the above four types of applications all have disadvantages to varying degrees. Specifically, method (1) requires a large amount of human resources to test the application; method (2) is affected by the shortcomings of the automated testing tool itself, which affects the test results and limits the feasibility; method (3) requires a large amount of manpower to write and update test scripts; and method (4) requires the system to frequently process instructions. In addition, the above four types of methods all need to rely on an external testing environment (such as AppCrawler relies on the Python environment and the automation tool Appium), that is, the above four types of testing methods are sensitive to the external operating environment.

[0066] Therefore, based on the above, the existing application testing methods cannot get rid of the dependence on the operating environment or external tools on the basis of improving the testing efficiency and feasibility; and the maintenance cost and opening cost required by the existing application testing methods are both high.

[0067] Therefore, in order to solve the problems existing in the existing testing methods, the embodiments of the present disclosure propose a testing method. Figure 1 is a schematic diagram of an application scenario of the present disclosure. Figure 1 As shown, the application scenario includes: a recording device 110 and a test device 120. In addition, the application scenario proposed in the embodiment of the present disclosure may include one or more test devices 120.

[0068] In some embodiments, the recording device 110 and the test device 120 may include electronic devices used by users, such as personal computers, mobile phones, tablet computers, notebooks, and e-book readers, etc., which are computer devices with certain computing capabilities. Among them, one or more components in the application scenario (such as the recording device 110 and the test device 120) can be connected via any type of wireless network.

[0069] Figure 2 This is a flow diagram of the test method according to the embodiment of the present disclosure. Figure 1 .like Figure 2 As shown, the embodiment of the present disclosure can sequentially perform five steps, namely, monitoring the operation events of the recording device, the recording device generating the original event stream, the recording device transmitting the original event stream, the test device receiving and parsing the original event stream, and driving the test device to perform the test based on the input manager, so as to implement the test method proposed in the embodiment of the present disclosure. In order to facilitate the description of the test method proposed in the embodiment of the present disclosure, the following content of the present application will sequentially describe the five steps included in the above test method.

[0070] (1) Monitoring the operation events of the recording device, generating the original event stream from the recording device, and transmitting the original event stream.

[0071] Figure 3 The process diagram of the test method according to the embodiment of the present disclosure is as follows Figure 2 , the method can be applied to a recording unit arranged inside a recording device, such as Figure 3 As shown, the method may include at least part of the following steps:

[0072] S310, generating an original event stream according to an operation event of the recording device;

[0073] S320, transmitting the original event stream to the test unit in the remote test device; the test device and the recording device are connected via a network.

[0074] In some examples, the recording unit may include a recording APP on a recording device, and the test unit may include a playback APP on a remote test device. The remote test device may be deployed in the cloud. In this way, the recording unit of the recording device may generate an original event stream and transmit the original event stream. Since the recording unit of the recording device is used to generate the original event stream, and the original event stream is transmitted to the test unit inside the remote test device, the dependence of the test method in the prior art on the operating environment or external tools can be avoided to a certain extent, thereby improving the flexibility of the test method and making the test method more suitable for large-scale remote automated testing; and since the recording unit of the recording device is used to generate the original event stream, the impact of manually writing test scripts or test cases on test efficiency in the prior art can be reduced, thereby improving the efficiency of the test method and improving customer satisfaction.

[0075] Figure 4 is a schematic diagram of the application system structure of the test method according to an embodiment of the present disclosure, such as Figure 4 As shown, the application system may include a test device and a recording device. In addition, the application system of the test method proposed in the embodiment of the present disclosure may include one or more test devices. Figure 4 As shown, the recording unit inside the recording device may include a network transmission module and a recording module. Specifically, the recording device and the test device can be connected to the network through the network transmission module, and then the original event stream is transmitted to the test unit inside the remote test device. A recording module can be set inside the recording device to generate an original event stream according to the operation event of the recording device.

[0076] Specifically, the method for generating an original event stream according to an operation event of a recording device comprises the following steps:

[0077] Step 1: Receive input events from the terminal device screen or terminal device keys according to the acquisition instruction (such as the getevent instruction), and start recording the operation events of the terminal device. For example, the tester starts the recording unit on the recording device, then after the recording unit is started, the getevent instruction can be sent through a command line tool (such as a shell) to start recording the operation events of the terminal device.

[0078] Step 2: Record the operation events (such as click events, long press events, and sliding events) on the recording device until the recording of the operation events on the terminal device is finished. For example, the tester can turn off the recording unit on the recording device, and after the recording unit is turned off, the recording of the operation events on the terminal device can be finished.

[0079] Step 3: Generate an original event stream according to the recorded operation events of the recording device.

[0080] Figure 5 is a schematic diagram of the structure of the "Calendar" application program in the embodiment of the present disclosure, such as Figure 5 As shown, taking the generation of the original event stream of the "Calendar" application as an example, the generation of the original event stream according to the operation events of the recording device may include the following steps:

[0081] Step 1: The tester can start the recording unit inside the recording device in the background and manually operate the "Calendar" application to obtain operation events. Figure 5 As shown, the operation event of the "Calendar" application may include a single-click event (such as clicking Figure 5 Control 1 shown in the figure, to select a specified date (ie, date "15")), long press event (such as long press Figure 5 The control 2 shown in the figure is used to create a new schedule for the day (i.e., create a schedule for the date "16") and a sliding event (such as sliding Figure 5 Control 3 shown to view the bimonthly schedule).

[0082] Step 2: Generate the original event stream based on the above operation events.

[0083] For example, the original event stream may be composed of position update events (events in which the position of the finger on the screen is updated); wherein the position update event may include a finger press event (also referred to as a screen press event), a finger lift event (also referred to as a screen release event) and a finger slide event (also referred to as a screen slide event). In addition, different operation events may generate different original event streams, such as the original event stream corresponding to the slide operation event may include a finger press event, a finger lift event and a finger slide event; the original event stream corresponding to the single-click operation event and the long-press operation event may include a finger lift event and a finger press event. However, it should be noted that the time difference between the finger press event and the finger lift event corresponding to the single-click operation event and the long-press operation event is different. Specifically, the time difference between the finger press event and the finger lift event corresponding to the single-click operation event is shorter than the time difference between the finger press event and the finger lift event corresponding to the long-press operation event.

[0084] Afterwards, after the original event stream is generated, the embodiment of the present disclosure may also use a network transmission module to transmit the original event stream to a test unit inside a remote test device. Specifically, transmitting the original event stream to a test unit inside a remote test device includes:

[0085] Determine at least one byte array corresponding to the operation event by using key information of the operation event contained in the original event stream;

[0086] At least one byte array corresponding to the original event stream is transmitted to a test unit in a remote test device.

[0087] For example, a network transmission module in the recording unit can be used to establish a network connection with the test device, and the original event stream can be transmitted to the test unit inside the remote test device in a specified data format (such as a byte array format). Specifically, a socket connection can be established with the test unit inside the test device through the network transmission module contained in the recording unit inside the recording device, and the original event stream can be transmitted to the test unit inside the remote test device in a specified data format (such as a byte array format) through the network transmission module in the recording unit.

[0088] In this way, the recording unit of the recording device can transmit the original event stream to the test device, which can avoid the dependence of the test method in the prior art on the operating environment or external tools to a certain extent, and improve the flexibility of the test method; and, by transmitting the original event stream to the test device through the recording unit of the recording device, there is no problem of resource waste caused by maintenance scripts.

[0089] In some embodiments, the key information proposed in the embodiments of the present disclosure includes at least one of the event type, the event occurrence time, and the event occurrence location; the byte array includes at least one of the event type byte, the event occurrence time byte, and the event location offset rate byte; the location offset rate byte includes the location longitudinal offset rate byte and / or the location lateral offset rate byte.

[0090] Therefore, based on the above content, the specified data format corresponding to the original event stream proposed in the embodiment of the present disclosure may include the format of a byte array. Table 1 is the format of the byte array corresponding to the original event stream according to the embodiment of the present disclosure. As shown in Table 1, a byte array corresponding to the original event stream may include 1 event type byte, 4 event occurrence time bytes and 8 event position offset rate bytes (including 4 event position lateral offset rate bytes and 4 event position longitudinal offset rate bytes).

[0091] Table 1

[0092]

[0093] Fig. 6AAccording to the byte array corresponding to the single-click operation event of the embodiment of the present disclosure. Taking the original event stream corresponding to the single-click operation event as an example, the original event stream corresponding to the single-click operation event may include a finger press event (also referred to as a screen press event) and a finger lift event (also referred to as a screen release event). Specifically, the key information contained in the original event stream of the single-click operation event can be used to determine the event type, event position offset rate (such as the event position lateral offset rate and the event position longitudinal offset rate) and event occurrence time corresponding to the single-click operation event, and then determine the byte array of the finger press event corresponding to the single-click operation event (i.e., a byte array containing the event type, event position offset rate and event occurrence time) and the byte array of the finger lift event.

[0094] Figure 6B It is a byte array corresponding to the long press operation event according to the embodiment of the present disclosure. Taking the original event stream corresponding to the long press operation event as an example, the original event stream of the long press operation event may include a finger press event and a finger lift event. Specifically, the key information contained in the original event stream of the long press operation event can be used to determine the event type, event position offset rate (such as the event position lateral offset rate and the event position longitudinal offset rate) and event occurrence time corresponding to the long press operation event, and then determine the byte array of the finger press event and the byte array of the finger lift event corresponding to the long press operation event.

[0095] Figure 6C It is a byte array corresponding to the sliding operation event according to the embodiment of the present disclosure. Taking the original event stream corresponding to the sliding operation event as an example, the original event stream of the sliding operation event may include a finger press event, a multiple finger sliding event (also referred to as a screen sliding event) and a finger lift event. Specifically, the key information contained in the original event stream of the sliding operation event can be used to determine the event type, event position offset rate (such as the event position lateral offset rate and the event position longitudinal offset rate) and event occurrence time corresponding to the sliding operation event, and then determine the byte array of the finger press event, the byte array of the multiple finger sliding event and the byte array of the finger lift event corresponding to the sliding operation event.

[0096] The original event stream is transmitted by using a byte array, and the original event stream is transmitted from the recording device to the test device, so that the stability of the original event stream can be improved and the accuracy of the test can be improved.

[0097] Specifically, the method of determining at least one byte array corresponding to the operation event by using the key information of the operation event contained in the original event stream may include the following steps:

[0098] Step 1: for a byte array corresponding to the original event stream, when the key information includes the event type, the key information of the operation event contained in the original event stream is used to determine the byte array corresponding to the operation event, including:

[0099] Determine the event type of the operation event, and determine the data corresponding to the event type of the operation event according to the correspondence between the data and the event type;

[0100] Determine the event type byte according to the data corresponding to the event type of the operation event;

[0101] Based on the event type byte of the operation event, determine the byte array corresponding to the operation event.

[0102] Table 2 is the correspondence between data and event types proposed according to the embodiments of the present disclosure. As shown in Table 2, the event types proposed in the embodiments of the present disclosure include screen events and / or key events; screen events include at least one of screen sliding events, screen pressing events, and screen releasing events; key events include at least one of volume down key events, volume up key events, power key events, and return key events.

[0103] As shown in Table 2, the data corresponding to the event type proposed in the embodiment of the present disclosure may include binary data. Specifically, as shown in Table 2, the binary data corresponding to the screen pressing event (also referred to as the finger pressing event) proposed in the embodiment of the present disclosure is "0000 0000", the binary data corresponding to the screen sliding event (also referred to as the finger sliding event) is "0000 0010", the binary data corresponding to the screen releasing event (also referred to as the finger lifting event) is "0000 0001", the binary data corresponding to the lock screen key event (also referred to as the power key event) is "0001 1010", the binary data corresponding to the return key event is "0000 0100", the binary data corresponding to the volume increasing event is "0001 1000", and the binary data corresponding to the volume decreasing key event is "0001 1001".

[0104] Table 2

[0105]

[0106] In addition, after determining the data corresponding to the event type of the operation event, the binary data corresponding to the event type can be encapsulated and written into the first byte of the byte array of the corresponding original event stream (ie, the header of the byte array) to obtain the event type byte.

[0107] Step 2: for a byte array of the original event stream corresponding to the operation event, when the key information includes the location of the event, the key information of the operation event contained in the original event stream is used to determine the byte array corresponding to the operation event, including:

[0108] Determine the event occurrence position of the operation event, and determine the position shift rate of the operation event according to the screen resolution of the recording device and the event occurrence position; the position shift rate includes the position longitudinal shift rate and / or the position lateral shift rate;

[0109] According to the position offset rate of the operation event, determine the event position offset rate byte;

[0110] Based on the event position offset rate byte, determine the byte array corresponding to the operation event.

[0111] Among them, the lateral offset rate of the event position may refer to the coordinate offset rate of the event occurrence position in the x-axis (i.e., horizontal axis) direction of the recording device screen; the longitudinal offset rate of the event position may refer to the coordinate offset rate of the event occurrence position in the y-axis (i.e., vertical axis) direction of the recording device screen.

[0112] In addition, if the event type is a screen event, the event position offset rate (including the event position horizontal offset rate and the event position vertical offset rate) can be determined according to the following method:

[0113] First, the maximum values ​​of the horizontal axis coordinate and the vertical axis coordinate corresponding to the recording device screen are obtained; the event occurrence position and the horizontal axis coordinate and the vertical axis coordinate of the recording device screen corresponding to the event occurrence position are determined.

[0114] The method for obtaining the maximum values ​​of the horizontal axis coordinate and the vertical axis coordinate corresponding to the recording device screen may include: obtaining the information of the terminal device screen (touch panel) (i.e., the screen resolution information) through the getevent instruction, and then determining the maximum value X of the horizontal axis of the recording device screen. max and the maximum value Y of the vertical axis max .

[0115] The method for determining the event occurrence location, and the horizontal axis coordinate and the vertical axis coordinate of the recording device screen corresponding to the event occurrence location may include: in some embodiments, if the coordinates of the recording device screen corresponding to the single-click operation event (i.e., the event occurrence location) are (3712, 5857), then the horizontal axis coordinate of the recording device screen corresponding to the single-click operation event is 3712, and the vertical axis coordinate of the recording device screen corresponding to the single-click operation event is 5857; if the screen coordinates of the recording device corresponding to the long-press operation event (i.e., the event occurrence location) are (4346, 5 850), then the horizontal axis coordinate of the recording device screen corresponding to the long press operation event is 4346, and the vertical axis coordinate of the recording device screen corresponding to the long press operation event is 5850; or, if it is determined that the coordinates of the recording device screen corresponding to the sliding operation event (i.e., the event occurrence location) include (4611, 4839), (4396, 4812), (3185, 4969), (2963, 4967) and (2505, 4950), then the horizontal axis coordinates of the recording device screen corresponding to the sliding operation event are 4611, 4396, 3785 2963 and 2505 respectively, and the vertical axis coordinates of the recording device screen corresponding to the horizontal axis coordinates of the sliding operation event are 4839, 4812, 4969, 4967 and 4950 respectively.

[0116] Then, according to the maximum values ​​of the horizontal and vertical coordinates of the recording device screen, and the horizontal and vertical coordinates of the recording device screen corresponding to the event occurrence position, the event position offset rate corresponding to the operation event (including the event position horizontal offset rate and the event position vertical offset rate) is calculated. That is, the event position offset rate can be calculated according to Formula 1:

[0117]

[0118] Among them, X coor Indicates the horizontal coordinate of the recording device screen corresponding to the location where the event occurred, Y coor Indicates the vertical coordinate of the recording device screen corresponding to the location where the event occurred; X max Indicates the maximum value of the horizontal axis coordinate corresponding to the recording device screen, Y max Indicates the maximum value of the horizontal axis coordinate corresponding to the recording device screen; X diff Indicates the lateral offset rate of the event position corresponding to the operation event, Y diff Indicates the longitudinal offset rate of the event position corresponding to the operation event.

[0119] Finally, the position offset rate of the operation event (i.e., X diff and Y diff) is encapsulated and written into the 2nd to 9th bytes (i.e. the middle part of the byte array) of the corresponding original event stream to obtain the event position offset rate byte. Specifically, Figure 6C As shown, the data corresponding to the event position horizontal offset rate can be encapsulated and written into the 2nd to 5th bytes of the byte array of the corresponding original event stream (i.e., the event position horizontal offset rate bytes); the data corresponding to the event vertical offset rate can be encapsulated and written into the 6th to 9th bytes of the byte array of the corresponding original event stream (i.e., the event position vertical offset rate bytes).

[0120] Alternatively, if the event type is a key event, the event position offset rate (including the event position horizontal offset rate and the event position vertical offset rate) bytes of the corresponding original event stream byte array can be directly filled with 0. Specifically, 0 can be written into the 2nd to 9th bytes of the corresponding byte array.

[0121] Step 3: for a byte array of the original event stream corresponding to the operation event, when the key information includes the time of event occurrence, the key information of the operation event contained in the original event stream is used to determine the byte array corresponding to the operation event, including:

[0122] Record the time when the operation event occurs. The time when the operation event occurs is represented by a timestamp.

[0123] Convert the event occurrence time of the operation event into a long integer, and determine the event occurrence time byte corresponding to the operation event according to the converted event occurrence time of the operation event;

[0124] Based on the event occurrence time byte of the operation event, determine the byte array corresponding to the operation event.

[0125] It should be noted that since the data corresponding to the event occurrence time of the operation event is long integer data, after determining the data corresponding to the event occurrence time of the operation event, the data corresponding to the event occurrence time can be encapsulated and written into the multiple bytes at the end of the byte array of the corresponding original event stream to obtain the event occurrence time bytes. Figure 6C As shown, the data corresponding to the event occurrence time can be encapsulated and written into the 10th to 17th bytes (i.e., the end of the byte array) of the corresponding original event stream to obtain the event occurrence time byte.

[0126] It should be noted that the embodiments of the present disclosure do not limit the specific execution order of the above three steps (ie, the steps of determining the event type byte, the event position offset rate byte, and the event occurrence time byte).

[0127] (ii) receiving and parsing the original event stream and transmitting the original event stream and driving the test equipment to perform the test based on the input manager.

[0128] The present disclosure also provides a testing method, which is applied to a testing unit disposed inside a testing device. Figure 7 The process diagram of the test method according to the embodiment of the present disclosure is as follows Figure 3 ,like Figure 7 As shown, the method may include at least some of the following steps:

[0129] S710, receiving and parsing the original event stream to obtain key information corresponding to the original event stream;

[0130] S720, constructing a test event using key information corresponding to the original event stream;

[0131] S730: Distribute test events to drive the test equipment to perform testing.

[0132] The key information includes at least one of the event type, the event occurrence time and the event occurrence location. The event type includes screen events and / or key events; the screen event includes at least one of the screen sliding event, the screen pressing event and the screen releasing event; the key event includes at least one of the volume down key event, the volume up key event, the power key event and the return key event.

[0133] In this way, the test unit inside the test device can receive and parse the original event stream, construct test events using the original event stream, and drive the test device to perform tests using the test events. Since the test unit inside the test device receives and parses the original event stream, constructs test events using the original event stream, and drives the test device to perform tests using the test events, it can avoid the dependence of the test method in the prior art on the operating environment or external tools to a certain extent, thereby improving the flexibility of the test method and making the test method more suitable for large-scale remote automated testing; and since the test unit inside the test device receives and parses the original event stream, and constructs test events using the original event stream, it can reduce the impact of manually writing test scripts or test cases on test efficiency in the prior art, improve the efficiency of the test method, and improve customer satisfaction.

[0134] Figure 8 is a schematic diagram of an application system structure of another testing method according to an embodiment of the present disclosure, such as Figure 8The test unit inside the test device shown includes an event playback module and an event parsing module. Specifically, the test device and the recording device can be connected to the network through the network transmission module and the event parsing module, so that the test unit inside the test device receives the original event stream. An event playback module can be set inside the test device, and the event playback module is used to construct a test event using the key information corresponding to the original event stream; and distribute the test event to drive the test device to perform the test.

[0135] In one example, the original event stream is received and parsed to obtain key information corresponding to the original event stream, including:

[0136] Parsing multiple byte arrays corresponding to the original event stream to obtain key information corresponding to each byte array; any byte array includes at least one of an event type byte, an event occurrence time byte, and an event position offset rate byte;

[0137] According to the key information corresponding to each byte array, the key information corresponding to the original event stream is determined.

[0138] Specifically, the original event stream can be received in a specified data format (such as a byte array format), and the key information contained therein (such as event type, event occurrence location, and event occurrence time) can be parsed. For example, the event parsing module of the test device of the embodiment of the present disclosure can first receive the original event stream from the recording unit inside the recording device through a socket, and then parse the key information of the event (including event type, event occurrence location, and event occurrence time).

[0139] In some implementations, the embodiments of the present disclosure may adopt the following steps to receive and parse the original event stream to obtain key information corresponding to the original event stream:

[0140] Step 1: for a byte array corresponding to the original event stream, if the byte array includes an event type byte, parse the byte array corresponding to the original event stream to obtain key information corresponding to the byte array including:

[0141] Determine the data corresponding to the event type byte;

[0142] Using the correspondence between data and event types, parse the event type bytes to obtain the event type corresponding to the byte array.

[0143] Specifically, the disclosed embodiment can parse the event type byte of the byte array corresponding to the original event stream (i.e., the first byte of the byte array corresponding to the original event stream) according to the corresponding relationship between data and event types, and the data corresponding to the event type byte, to obtain the event type corresponding to the byte array. In addition, the data corresponding to the event type byte may include binary data; in the disclosed embodiment, eventType may be used to represent the event type.

[0144] Step 2: for a byte array corresponding to the original event stream, if the byte array includes event position offset bytes, parse the byte array corresponding to the original event stream to obtain key information corresponding to the byte array, including:

[0145] Parse the event position offset rate byte, and convert the parsed event position offset rate byte into a floating point number to obtain the event position offset rate corresponding to the byte array; the event position offset rate includes the event position horizontal offset rate and / or the event position vertical offset rate;

[0146] Calculate the event position corresponding to the byte array based on the event position offset rate and the screen resolution of the test device.

[0147] Specifically, if the event type corresponding to the original time stream belongs to a screen event, the event occurrence position (including the horizontal coordinate of the event occurrence position and the vertical coordinate of the event occurrence position) can be determined in the following manner:

[0148] First, the screen resolution of the test device is obtained through the window manager, and the event position offset rate byte is parsed, and the parsed event position offset rate byte is converted into a floating point number.

[0149] Specifically, the screen resolution of the test device obtained through the window manager is 1080×2412, so the horizontal axis pixel number X of the test device can be determined. px The vertical axis of the test device is 1080 pixels. px is 2412. In addition, the 2nd to 5th bytes (i.e., event position horizontal offset rate bytes) and the 6th to 9th bytes (i.e., event position vertical offset rate bytes) of the original event stream can be parsed separately, and the parsed event position offset rate bytes are converted into floating point numbers to obtain X diff (i.e., the lateral offset rate of the event position) and Y diff (i.e. the longitudinal offset rate of the event position).

[0150] Secondly, according to the maximum values ​​of the horizontal and vertical coordinates of the test device screen, the horizontal and vertical position offsets corresponding to the byte array are determined, that is, the horizontal and vertical position offsets of the event occurrence position corresponding to the byte array are calculated using formula (2):

[0151]

[0152] Among them, X px Can represent the number of pixels on the horizontal axis of the test device, Y px It can represent the number of pixels on the horizontal and vertical axes of the test device; X offs(t It can represent the horizontal axis offset of the event location, Y offs(t It can indicate the horizontal and vertical axis offset of the location where the event occurred.

[0153] Finally, the position offset corresponding to the original event stream is used to determine the event position corresponding to the byte array. offs() Indicates the horizontal axis offset of the event location, Y offs(t Indicates the horizontal and vertical axis offset of the event occurrence position, then the horizontal axis coordinate (i.e., x coordinate) corresponding to the byte number corresponding to the original event stream event occurrence position can be set as X offs(t , the vertical coordinate (i.e. y coordinate) corresponding to the location where the event occurs is Y offs(t .

[0154] In addition, if the event type is a key event, the event occurrence position of a byte array corresponding to the original event stream may be represented by 0.

[0155] Step 3: For a byte array corresponding to the original event stream, if the byte array includes event occurrence time bytes, parse the byte array corresponding to the original event stream to obtain key information corresponding to the byte array, including:

[0156] Parse the event occurrence time byte, and convert the parsed event occurrence time byte into a long integer to obtain the event occurrence time corresponding to the byte array; the event occurrence time is represented by a timestamp.

[0157] Specifically, the 10th to 17th bytes (i.e., event occurrence time bytes) of the byte array corresponding to the original event stream may be parsed and converted into a long integer to obtain the event occurrence time, wherein the event occurrence time may be stored in a timestamp format, and the event occurrence time may be represented by eventTime.

[0158] Furthermore, the event occurrence time corresponding to the finger press event (also called screen press event) contained in the original event stream can be represented by down_time, and the event occurrence time corresponding to the finger lift event (also called screen release event) contained in the original event stream can be represented by up_time.

[0159] It should be noted that the embodiments of the present disclosure do not limit the specific execution order of the above-mentioned determination of key information (ie, determination of event type, event occurrence time and event location).

[0160] Afterwards, after determining the key information corresponding to the original event stream, the embodiment of the present disclosure can construct a test event using the key information corresponding to the original event stream.

[0161] Specifically, the key information corresponding to the original event stream is used to construct a test event, including:

[0162] Determine the key information corresponding to the test event based on the key information corresponding to the original event stream;

[0163] Determine the actual event information corresponding to the original event stream, and determine the event code corresponding to the test event based on the actual event information;

[0164] Construct a test event based on the key information and event code corresponding to the test event.

[0165] In one example, according to the key information and event code corresponding to the test event, the following steps can be used to construct the test event:

[0166] Step 1: Determine the key information corresponding to the test event based on the key information corresponding to the original event stream.

[0167] According to the event type corresponding to the original event stream, the event type of the test event is determined. For example, if the event type corresponding to the original event stream includes screen events, then the event type corresponding to the test event may include screen events (also called gesture events (MotionEvent)); if the event type corresponding to the original event stream includes key events, then the event type corresponding to the test event may include key events (keyEvent). In addition, the event occurrence time and event occurrence location corresponding to the test event can also be determined according to the event occurrence time and event occurrence location corresponding to the original event stream.

[0168] Step 2: Set the event code according to the actual event information corresponding to the original event stream.

[0169] In the case where the event type corresponding to the original event stream includes screen events, the parameter action can be used to represent the event code. For example, if the actual event information corresponding to the original event stream includes a finger press operation, then the event code corresponding to the test event (also referred to as the parameter action) can be set to include ACTION_DOWN; if the actual event information corresponding to the original event stream includes a finger lift operation, then the event code corresponding to the test event (also referred to as the parameter action) can be set to include ACTION_UP; if the actual event information corresponding to the original event stream includes a sliding operation, then the event code corresponding to the test event (also referred to as the parameter action) can be set to include ACTION_DOWN, ACTION_MOVE and ACTION_UP.

[0170] Alternatively, in the case where the event type corresponding to the original event stream includes a key event, if the actual event information corresponding to the original event stream includes a return key operation, then the event code corresponding to the test event may be set to include KEYCODE_BACK.

[0171] Step 3: Construct a test event based on the event occurrence time, location and event code.

[0172] That is, a test event is constructed according to the event occurrence time, event occurrence location and event code corresponding to the test event determined in the above steps.

[0173] In addition, after constructing the test event using the key information corresponding to the original event stream, the test event can also be distributed to drive the test equipment to perform the test.

[0174] Specifically, the distribution of test events to drive the test equipment to perform the test includes:

[0175] Use the input manager and / or Android test framework to dispatch test events to drive the test device for testing.

[0176] Among them, the Android testing framework may include Instrumentation.

[0177] For example, the embodiment of the present disclosure can use the input manager (InputManager) to mobilize injectInputEvent to distribute test events (such as gesture events and key events) to drive the test equipment to perform automated testing. However, it should be noted that the method of distributing test events by injectInputEvent is a hidden method (that is, the method of distributing test events by injectInputEvent is invisible to the application). Therefore, if injectInputEvent is used to distribute test events to drive automated testing, it is necessary to drive automated testing by repeatedly calling and transmitting test events. In addition, when using injectInputEvent to distribute test events, the difference between the event occurrence time down_time corresponding to the finger pressing event (also called screen pressing event) contained in the original event stream and the event occurrence time up_time corresponding to the finger lifting event (also called screen release event) contained in the original event stream can also be used to calculate the difference between the finger pressing event and the finger lifting event; and, the distribution of test events is suspended by delay.

[0178] It should be noted that since the method of using injectInputEvent to distribute test events to drive the test equipment to perform automated testing requires driving automated testing by repeatedly calling and passing in test events, the method of using injectInputEvent to distribute test events to drive the test equipment to perform automated testing has the problem of low efficiency.

[0179] Therefore, based on the above content, the disclosed embodiment can also use the Android test framework (such as Instrumentation) to distribute test events to solve the problem of low efficiency of the method of using injectInputEvent to distribute test events to drive the test device to perform automated testing. Specifically, the method of using the Android test framework (such as Instrumentation) to distribute test events can construct an Instrumentation object by starting a child thread to achieve the purpose of distributing test events through Instrumentation.sendPointerSync and driving the test device to perform testing.

[0180] Fig. 9 FIG. 9 is a schematic block diagram of a test unit 900 for testing according to an embodiment of the present application. Fig. 9 As shown, the test unit 900 for testing may include:

[0181] The receiving and parsing module 910 is used to receive and parse the original event stream to obtain key information corresponding to the original event stream;

[0182] A construction module 920, used to construct a test event using key information corresponding to the original event stream;

[0183] The distribution module 930 is used to distribute test events to drive the test equipment to perform testing.

[0184] In some implementations, the key information includes at least one of the event type, the event occurrence time, and the event occurrence location.

[0185] In some embodiments, the configuration module 920 is used to:

[0186] Determine the key information corresponding to the test event based on the key information corresponding to the original event stream;

[0187] Determine the actual event information corresponding to the original event stream, and determine the event code corresponding to the test event based on the actual event information;

[0188] Construct a test event based on the key information and event code corresponding to the test event.

[0189] In some implementations, the receiving and parsing module 910 is configured to:

[0190] Parsing multiple byte arrays corresponding to the original event stream to obtain key information corresponding to each byte array; any byte array includes at least one of an event type byte, an event occurrence time byte, and an event position offset rate byte;

[0191] According to the key information corresponding to each byte array, the key information corresponding to the original event stream is determined.

[0192] In some implementations, when the byte array includes an event type byte, the receiving and parsing module 910 is configured to:

[0193] Determine the data corresponding to the event type byte;

[0194] Using the correspondence between data and event types, parse the event type bytes to obtain the event type corresponding to the byte array.

[0195] In some implementations, when the byte array includes event occurrence time bytes, the construction module 920 is configured to:

[0196] Parse the event occurrence time byte, and convert the parsed event occurrence time byte into a long integer to obtain the event occurrence time corresponding to the byte array; the event occurrence time is represented by a timestamp.

[0197] In some implementations, when the byte array includes an event position offset byte, the receiving and parsing module 910 is configured to:

[0198] Parse the event position offset rate byte, and convert the parsed event position offset rate byte into a floating point number to obtain the event position offset rate corresponding to the byte array; the event position offset rate includes the event position horizontal offset rate and / or the event position vertical offset rate;

[0199] Calculate the event sending position corresponding to the byte array based on the event position offset rate and the screen resolution of the test device.

[0200] In some implementations, the event type includes a screen event and / or a key event;

[0201] The screen event includes at least one of a screen sliding event, a screen pressing event, and a screen releasing event;

[0202] The key event includes at least one of a volume down key event, a volume up key event, a power key event, and a return key event.

[0203] In some implementations, the distribution module 930 is used to distribute test events using an input manager and / or an Android test framework to drive the test device to perform testing.

[0204] Fig.10 is a schematic block diagram of a recording unit 1000 for testing according to an embodiment of the present application, such as Fig.10 As shown, in some implementations, the recording unit 1000 for testing proposed in the embodiment of the present application may include:

[0205] A generating module 1010, used to generate an original event stream according to an operation event of a recording device;

[0206] The transmission module 1020 is used to transmit the original event stream to the test unit inside the remote test device; the test device and the recording device are connected via a network.

[0207] In some implementations, the transmission module 1020 is configured to:

[0208] Determine at least one byte array corresponding to the operation event by using key information of the operation event contained in the original event stream;

[0209] At least one byte array corresponding to the original event stream is transmitted to a test unit in a remote test device.

[0210] In some embodiments, the key information includes at least one of the event type, event occurrence time, and event occurrence location; the byte array includes at least one of the event type byte, event occurrence time byte, and event location offset rate byte; the location offset rate byte includes a location longitudinal offset rate byte and / or a location lateral offset rate byte.

[0211] In some implementations, when the key information includes the event type, the transmission module 1020 is configured to:

[0212] Determine the event type of the operation event, and determine the data corresponding to the event type of the operation event according to the correspondence between the data and the event type;

[0213] Determine the event type byte according to the data corresponding to the event type of the operation event;

[0214] Based on the event type byte of the operation event, determine the byte array corresponding to the operation event.

[0215] In some implementations, when the key information includes an event occurrence time byte, the transmission module 1020 is configured to:

[0216] Record the time when the operation event occurs. The time when the operation event occurs is represented by a timestamp.

[0217] Convert the event occurrence time of the operation event into a long integer, and determine the event occurrence time byte corresponding to the operation event according to the converted event occurrence time of the operation event;

[0218] Based on the event occurrence time byte of the operation event, determine the byte array corresponding to the operation event.

[0219] In some implementations, when the key information includes the location where the event occurred, the transmission module 1020 is configured to:

[0220] Determine an event occurrence position of the operation event, and determine a position offset rate of the operation event according to a screen resolution of the recording device and the event occurrence position;

[0221] According to the position offset rate of the operation event, determine the event position offset rate byte;

[0222] Based on the event position offset byte, determine the byte array corresponding to the operation event.

[0223] In some implementations, the event type includes a screen event and / or a key event;

[0224] The screen event includes at least one of a screen sliding event, a screen pressing event, and a screen releasing event;

[0225] The key event includes at least one of a volume down key event, a volume up key event, a power key event, and a return key event.

[0226] The present disclosure also provides a system for testing. Fig.11 1 is a schematic diagram of the structure of a system 1100 for testing according to an embodiment of the present disclosure, including: a testing unit 1110 and a recording unit 1120 .

[0227] The test unit 1110 is used to implement the corresponding functions implemented by the test unit in the above method, and the recording unit 1120 can be used to implement the corresponding functions implemented by the recording unit in the above method. For the sake of brevity, they will not be described in detail here.

[0228] Fig.12 1 is a schematic structural diagram of an electronic device 1200 according to an embodiment of the present application. The electronic device 1200 includes a processor 1210 and a memory 1220. The processor 1210 can call and run a computer program from the memory 1220 to enable the electronic device 1200 to implement the method in the embodiment of the present application.

[0229] The memory 1220 may be a separate device independent of the processor 1210 , or may be integrated into the processor 1210 .

[0230] In one implementation, the electronic device 1200 may further include a transceiver 1230, and the processor 1210 may control the transceiver 1230 to communicate with other devices, specifically, may send information or data to other devices, or receive information or data sent by other devices.

[0231] The transceiver 1230 may include a transmitter and a receiver. The transceiver 1230 may further include an antenna, and the number of the antennas may be one or more.

[0232] In one implementation, the electronic device 1200 may be the electronic device of the embodiment of the present application, and the electronic device 1200 may implement the corresponding processes implemented by the electronic device in each method of the embodiment of the present application, which will not be described in detail here for the sake of brevity.

[0233] Fig.13 1 is a schematic structural diagram of a chip 1300 according to an embodiment of the present application. The chip 1300 includes a processor 1310, and the processor 1310 can call and run a computer program from a memory to implement the method in the embodiment of the present application.

[0234] In one implementation, the chip 1300 may further include a memory 1320. The processor 1310 may call and run a computer program from the memory 1320 to implement the method executed by the electronic device in the embodiment of the present application.

[0235] The memory 1320 may be a separate device independent of the processor 1310 , or may be integrated into the processor 1310 .

[0236] In one implementation, the chip 1300 may further include an input interface 1330. The processor 1310 may control the input interface 1330 to communicate with other devices or chips, and specifically, may obtain information or data sent by other devices or chips.

[0237] In one implementation, the chip 1300 may further include an output interface 1340. The processor 1310 may control the output interface 1340 to communicate with other devices or chips, and specifically, may output information or data to other devices or chips.

[0238] In one implementation, the chip can be applied to the electronic device in the embodiments of the present application, and the chip can implement the corresponding processes implemented by the electronic device in each method of the embodiments of the present application, which will not be described in detail here for the sake of brevity.

[0239] The chips applied to the electronic device may be the same chip or different chips.

[0240] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.

[0241] The processor mentioned above may be a general-purpose processor, a digital signal processor (DSP), a field programmable gate array (FPGA), an application specific integrated circuit (ASIC) or other programmable logic devices, transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor mentioned above may be a microprocessor or any conventional processor, etc.

[0242] The memory mentioned above may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable ROM (PROM), an erasable programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM) or a flash memory. The volatile memory may be a random access memory (RAM).

[0243] It should be understood that the above-mentioned memory is exemplary but not restrictive. For example, the memory in the embodiments of the present application may also be static random access memory (static RAM, SRAM), dynamic random access memory (dynamic RAM, DRAM), synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous link dynamic random access memory (synch link DRAM, SLDRAM) and direct memory bus random access memory (Direct Rambus RAM, DR RAM), etc. That is to say, the memory in the embodiments of the present application is intended to include but not limited to these and any other suitable types of memory.

[0244] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instruction is loaded and executed on a computer, the process or function in accordance with the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instruction can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (Digital Subscriber Line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, data center, etc. that contains one or more available media integrations. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).

[0245] It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0246] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0247] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A testing method, applied to a testing unit arranged inside a testing device, the method comprising: Receiving and parsing an original event stream to obtain key information corresponding to the original event stream; Constructing a test event using key information corresponding to the original event stream; The test event is distributed to drive the test equipment to perform the test.

2. The method according to claim 1, wherein: The key information includes at least one of the event type, the event occurrence time and the event occurrence location.

3. The method according to claim 2, wherein: The constructing a test event by using the key information corresponding to the original event stream includes: Determine the key information corresponding to the test event according to the key information corresponding to the original event stream; Determine the actual event information corresponding to the original event stream, and determine the event code corresponding to the test event based on the actual event information; The test event is constructed according to the key information corresponding to the test event and the event code.

4. The method according to claim 2 or 3, wherein receiving and parsing the original event stream to obtain key information corresponding to the original event stream comprises: Parsing multiple byte arrays corresponding to the original event stream to obtain key information corresponding to each of the byte arrays; Any of the byte arrays includes at least one of an event type byte, an event occurrence time byte, and an event position offset rate byte; According to the key information corresponding to each of the byte arrays, the key information corresponding to the original event stream is determined.

5. The method according to claim 4, wherein: In the case where the byte array includes an event type byte, parsing the byte array corresponding to the original event stream to obtain key information corresponding to the byte array includes: Determine the data corresponding to the event type byte; The event type byte is parsed using the correspondence between the data and the event type to obtain the event type corresponding to the byte array.

6. The method according to claim 4, wherein: In the case where the byte array includes event occurrence time bytes, parsing the byte array corresponding to the original event stream to obtain key information corresponding to the byte array includes: The event occurrence time byte is parsed, and the parsed event occurrence time byte is converted into a long integer to obtain the event occurrence time corresponding to the byte array; the event occurrence time is represented by a timestamp.

7. The method according to claim 4, wherein: In the case where the byte array includes an event position offset rate byte, parsing the byte array corresponding to the original event stream to obtain key information corresponding to the byte array includes: Parsing the event position offset rate byte, and converting the parsed event position offset rate byte into a floating point number to obtain the event position offset rate corresponding to the byte array; the event position offset rate includes the event position lateral offset rate and / or the event position longitudinal offset rate; The event occurrence position corresponding to the byte array is calculated according to the event position offset rate and the screen resolution of the test device.

8. The method according to claim 2, wherein: The event types include screen events and / or key events; The screen event includes at least one of a screen sliding event, a screen pressing event, and a screen releasing event; The key event includes at least one of a volume down key event, a volume up key event, a power key event, and a return key event.

9. The method according to any one of claims 1 to 3, wherein distributing the test event to drive the test device to perform the test comprises: The test event is distributed using an input manager and / or an Android test framework to drive the test device to perform the test.

10. A testing method, applied to a recording unit disposed inside a recording device, the method comprising: Generate an original event stream according to the operation event of the recording device; Transmitting the original event stream to a test unit in a remote test device; The testing device and the recording device are connected via a network.

11. The method according to claim 10, wherein: The transmitting the original event stream to the test unit in the remote test device includes: Determine at least one byte array corresponding to the operation event by using key information of the operation event contained in the original event stream; At least one byte array corresponding to the original event stream is transmitted to a test unit in the remote test device.

12. The method according to claim 11, wherein: The key information includes at least one of the event type, event occurrence time and event occurrence position; the byte array includes at least one of the event type byte, event occurrence time byte and event position offset rate byte; the position offset rate byte includes the position longitudinal offset rate byte and / or the position lateral offset rate byte.

13. The method according to claim 12, wherein: In the case where the key information includes an event type, determining a byte array corresponding to the operation event by using the key information of the operation event contained in the original event stream includes: Determine the event type of the operation event, and determine data corresponding to the event type of the operation event according to the correspondence between the data and the event type; Determining the event type byte according to data corresponding to the event type of the operation event; Based on the event type byte of the operation event, a byte array corresponding to the operation event is determined.

14. The method according to claim 12, wherein: In the case where the key information includes the time of event occurrence, determining the byte array corresponding to the operation event by using the key information of the operation event contained in the original event stream includes: Recording the time when the operation event occurs, where the time when the operation event occurs is represented by a timestamp; Convert the event occurrence time of the operation event into a long integer, and determine the event occurrence time byte corresponding to the operation event according to the converted event occurrence time of the operation event; Based on the event occurrence time byte of the operation event, a byte array corresponding to the operation event is determined.

15. The method according to claim 12, wherein: In the case where the key information includes the event occurrence location, determining the byte array corresponding to the operation event by using the key information of the operation event contained in the original event stream includes: Determine an event occurrence position of the operation event, and determine a position offset rate of the operation event according to a screen resolution of the recording device and the event occurrence position; According to the position offset rate of the operation event, determine the event position offset rate byte; Based on the event position offset byte, a byte array corresponding to the operation event is determined.

16. The method according to any one of claims 12 to 15, wherein: The event types include screen events and / or key events; The screen event includes at least one of a screen sliding event, a screen pressing event, and a screen releasing event; The key event includes at least one of a volume down key event, a volume up key event, a power key event, and a return key event.

17. A test unit for testing, the test unit being arranged inside a test device, the test unit comprising: A receiving and parsing module, used for receiving and parsing the original event stream to obtain key information corresponding to the original event stream; A construction module, used to construct a test event using key information corresponding to the original event stream; The distribution module is used to distribute the test event to drive the test device to perform the test.

18. A recording unit for testing, the recording unit being arranged inside a recording device, the recording unit comprising: A generating module, used for generating an original event stream according to the operation event of the recording device; A transmission module, used for transmitting the original event stream to a test unit in a remote test device; The testing device and the recording device are connected via a network.

19. A system for testing, wherein: The system comprises: The test unit of claim 17; and The recording unit according to claim 18.

20. An electronic device, comprising: A processor and a memory, the memory being used to store a computer program, the processor being used to call and run the computer program stored in the memory so that the electronic device executes the method as described in any one of claims 1 to 9 or 10 to 16.

21. A chip, comprising: A processor, configured to call and run a computer program from a memory, so that a device equipped with the chip executes a method as claimed in any one of claims 1 to 9 or 10 to 16.

22. A computer-readable storage medium for storing a computer program, which, when executed by a device, causes the device to perform the method according to any one of claims 1 to 9 or 10 to 16.

23. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 9 or 10 to 16.