Test method and device of electronic equipment, electronic equipment and storage medium

By listening to user operations to generate test events and building event sequences, the problem of difficulty in generating use cases in electronic device testing is solved, automated testing is realized, and testing efficiency and applicability are improved.

CN120371690APending Publication Date: 2025-07-25BEIJING XIAOMI MOBILE SOFTWARE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410081044.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-01-19
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

In the prior art, electronic equipment functional tests have problems such as difficulty in automatically generating test cases, inaccurate execution of test steps, and difficult to achieve automated tests, resulting in low testing efficiency and applicability.

Method used

By listening to the test actions performed by the user on the test electronic device, corresponding test events are generated, and test cases are generated based on these events, including click operations, key operations, etc., and combining preset events to form an event sequence to realize the automated generation of test cases.

Benefits of technology

It realizes automated generation of test cases, improves testing efficiency and applicability, makes test cases easy to read and change, and ensures the accuracy and efficiency of functional testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371690A_ABST
    Figure CN120371690A_ABST
Patent Text Reader

Abstract

The invention relates to a testing method and device of electronic equipment, the electronic equipment and a storage medium, the testing method of the electronic equipment comprises the steps that at least one testing action executed by a user on the electronic equipment for testing is monitored, a corresponding testing event is generated based on the testing action, and the testing event is used for describing the corresponding testing action; based on the test events, test cases are generated, and the test cases are used for conducting function testing on the to-be-tested electronic equipment. By monitoring the at least one test action executed by the user on the electronic equipment for testing and generating the corresponding test event according to the test action, the test case can be generated according to each test event, and automatic generation of the test case is realized. Besides, the test case is generated in a mode of describing the test action through the test event, so that the test case is convenient to read and change, and the efficiency and applicability of subsequently performing the function test on the to-be-tested electronic equipment by executing the test case are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of electronic devices, and particularly to a test method, apparatus, electronic device, and storage medium for an electronic device. Background Art

[0002] In recent years, with the rapid development of technologies related to electronic devices, the functions of electronic devices have become increasingly diversified, such that electronic devices have been widely used in people's daily lives. After an electronic device is produced and prepared, it is usually necessary to test the functions of the electronic device to detect whether the electronic device meets the standards and requirements for being put into use.

[0003] However, when using the test methods of related technologies to perform functional tests on electronic devices, there are problems such as difficulty in automatically generating test cases and inaccurate execution of test steps, making it difficult to achieve automated testing, and the test efficiency and test applicability are low. Summary of the Invention

[0004] To overcome the problems existing in related technologies, the present disclosure provides a test method, apparatus, electronic device, and storage medium for an electronic device.

[0005] According to a first aspect of an embodiment of the present disclosure, there is provided a test method for an electronic device, the test method for the electronic device including:

[0006] Listening for at least one test action performed by a user on a test electronic device, and generating a corresponding test event based on the test action, the test event being used to describe the corresponding test action;

[0007] Generating a test case based on each of the test events, the test case being used to perform a functional test on an electronic device to be tested.

[0008] In some embodiments of the present disclosure, the listening for at least one test action performed by a user on a test electronic device, and generating a corresponding test event based on the test action, includes:

[0009] When a click operation is detected, determining first operation information corresponding to the click operation, the first operation information including any one or more combinations of a click coordinate, click text, a click control icon, and a click purpose;

[0010] Generating the test event corresponding to the click operation based on the first operation information.

[0011] In some embodiments of the present disclosure, the listening for at least one test action performed by a user on a test electronic device, and generating a corresponding test event based on the test action, includes:

[0012] Analyze the log file to monitor the volume key operation and the lock screen key operation;

[0013] When the volume key operation or the lock screen key operation is monitored, determine the second operation information corresponding to the volume key operation or the lock screen key operation according to the log file, where the second operation information includes the purpose of the key operation;

[0014] Generate the test event corresponding to the volume key operation or the lock screen key operation based on the second operation information.

[0015] In some embodiments of the present disclosure, each of the test events includes a plurality of information items, and the plurality of information items include the event action executor, the information required for event execution, the event execution method, and the target result of event execution.

[0016] In some embodiments of the present disclosure, the test method of the electronic device further includes:

[0017] Receive a preset event, and form an event sequence by arranging the generated test events and the preset event in chronological order;

[0018] The generating a test case based on each of the test events includes:

[0019] Generate the test case based on the event sequence.

[0020] In some embodiments of the present disclosure, the preset event includes any one or a combination of events corresponding to judgment action operations, events corresponding to waiting action operations, and events corresponding to interaction actions between the test electronic device and the auxiliary device.

[0021] In some embodiments of the present disclosure, the test case is used to perform an audio function test on the electronic device to be tested, and the auxiliary device includes any one or a combination of a wired headphone automatic plugging and unplugging device, an audio playback device, a recording device, and an auxiliary answering device.

[0022] In some embodiments of the present disclosure, before monitoring at least one test action performed by the user on the test electronic device and generating a corresponding test event based on the test action, the test method of the electronic device further includes:

[0023] Adjust the test electronic device to an initial state, where the test electronic device displays the main interface and all applications are in a closed state in the initial state.

[0024] According to the second aspect of the embodiments of the present disclosure, there is provided a test method for an electronic device, using the test case generated by the test method as described in the first aspect, where the test method of the electronic device includes:

[0025] Execute the test case to send execution instructions corresponding to each test event in the test case to the test system, so that the test system performs test actions corresponding to the test events, and the test system includes the electronic device to be tested;

[0026] In response to meeting the preset test stop condition, determine the test result.

[0027] In some embodiments of the present disclosure, the executing the test case includes:

[0028] Read the event sequence in the test case, and the events in the event sequence include at least one of the test events;

[0029] Execute the events in the event sequence in chronological order of the event sequence, and sequentially send execution instructions corresponding to the events in the event sequence to the test system;

[0030] Wherein, if the nth event in the event sequence is a non-confirmation event, after the sending of the execution instruction is completed, it is determined that the nth event in the event sequence is executed, and the (n + 1)th event in the event sequence is continued to be executed;

[0031] If the nth event in the event sequence is a confirmation-required event, after the sending of the execution instruction is completed, it is determined that the nth event in the event sequence is executed and the execution result feedback by the test system is received. When the execution result is consistent with the event execution target result, the (n + 1)th event in the event sequence is continued to be executed.

[0032] In some embodiments of the present disclosure, the executing the events in the event sequence in the order of the events in the event sequence, and sequentially sending execution instructions corresponding to the events in the event sequence to the test system includes:

[0033] If the event currently being executed in the event sequence is a click event among the test events, parse the test event, and generate corresponding execution instructions according to the event execution method parsed out in the order of decreasing priority of click purpose, click text, click control icon, and click coordinates, and send the execution instructions to the electronic device to be tested in the test system.

[0034] In some embodiments of the present disclosure, the test system further includes an auxiliary device, and the events in the event sequence further include at least one preset event, and the preset event includes an event corresponding to an interaction action between the test electronic device and the auxiliary device. The executing the events in the event sequence in the order of the events in the event sequence, and sequentially sending execution instructions corresponding to the events in the event sequence to the test system includes:

[0035] When the event in the currently executed event sequence is an event corresponding to an interaction action between the test electronic device and the auxiliary device, parse the event, generate execution instructions corresponding to the test electronic device and the auxiliary device respectively according to the method for executing the parsed event, and send the corresponding execution instructions to the test electronic device and the auxiliary device.

[0036] In some embodiments of the present disclosure, the preset test stop conditions include:

[0037] The last event in the event sequence is executed; and / or,

[0038] Any event in the event sequence fails to execute.

[0039] According to the third aspect of the embodiments of the present disclosure, there is provided a test device for an electronic device, the test device for the electronic device includes:

[0040] A listening module, the listening module is configured to listen to at least one test action performed by a user on a test electronic device, and generate a corresponding test event based on the test action, the test event is used to describe the corresponding test action;

[0041] A generating module, the generating module is configured to generate a test case based on each of the test events, the test case is used to perform a function test on the electronic device to be tested.

[0042] According to the fourth aspect of the embodiments of the present disclosure, there is provided a test device for an electronic device, the test device for the electronic device includes:

[0043] An execution module, the execution module is configured to execute the test case to send execution instructions corresponding to each test event in the test case to a test system, so that the test system executes the test actions corresponding to the test events, and the test system includes an electronic device to be tested;

[0044] A determining module, the determining module is configured to determine a test result in response to meeting a preset test stop condition.

[0045] According to the fifth aspect of the embodiments of the present disclosure, there is provided an electronic device, the electronic device includes:

[0046] A processor;

[0047] A memory for storing processor-executable instructions;

[0048] Wherein, the processor is configured to execute the test method for the electronic device as described in the first aspect or the second aspect.

[0049] According to a sixth aspect of the embodiments of the present disclosure, there is provided a non-transitory computer-readable storage medium. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the test method of the electronic device as described in the first aspect or the second aspect.

[0050] The technical solutions provided by the embodiments of the present disclosure may include the following beneficial effects: By listening to at least one test action performed by a user on a test electronic device and generating corresponding test events according to the test actions, test cases can be generated based on each test event, realizing the automatic generation of test cases. In addition, by generating test cases in a way that describes test actions through test events, the test cases are convenient to read and modify, ensuring the efficiency and applicability of subsequent functional testing of the electronic device to be tested by executing the test cases.

[0051] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present invention and used together with the specification to explain the principles of the present invention.

[0053] Figure 1 is a flowchart of a test method for an electronic device shown according to an exemplary embodiment.

[0054] Figure 2 is a flowchart of listening to at least one test action performed by a user on a test electronic device and generating corresponding test events based on the test actions shown according to an exemplary embodiment.

[0055] Figure 3 is a flowchart of listening to at least one test action performed by a user on a test electronic device and generating corresponding test events based on the test actions shown according to another exemplary embodiment.

[0056] Figure 4 is a flowchart of a test method for an electronic device shown according to another exemplary embodiment.

[0057] Figure 5 is a flowchart of a test method for an electronic device shown according to another exemplary embodiment.

[0058] Figure 6 is a flowchart of executing a test case shown according to an exemplary embodiment.

[0059] Figure 7 is a flowchart of a test method for an electronic device shown according to another exemplary embodiment.

[0060] Figure 8 It is a block diagram of a test device for an electronic device shown according to an exemplary embodiment.

[0061] Figure 9 It is a block diagram of a test device for an electronic device shown according to another exemplary embodiment.

[0062] Figure 10 It is a block diagram of an electronic device shown according to an exemplary embodiment.

[0063] In the figure:

[0064] 10 - Monitoring module; 20 - Generation module; 30 - Execution module; 40 - Determination module; 101 - Processing component; 102 - Memory; 103 - Power component; 104 - Multimedia component; 105 - Audio component; 106 - Input / output interface; 107 - Sensor component; 108 - Communication component; 109 - Processor. Detailed implementation manners

[0065] Here, the exemplary embodiments will be described in detail, and the examples are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all the implementation manners consistent with the present invention. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.

[0066] In recent years, with the rapid development of related technologies such as hardware devices and software development of electronic devices such as mobile phones, tablet computers, and laptop computers, the functions that electronic devices can achieve have become increasingly diverse, making electronic devices widely used in scenarios such as office and entertainment in people's daily lives. After the production and preparation of an electronic device are completed, it is usually necessary to test the functions of the electronic device to detect whether the electronic device meets the standards and requirements for being put into use and to prevent defective products from entering the market.

[0067] In the related art, when testing functions such as a human - machine interaction interface (User Interface, UI), test tools such as monkeyrunner and UI Automator are usually used to simulate the behavior of a user operating an electronic device. When testing functions such as audio, since it involves both the device to be tested and auxiliary devices such as headphones, test personnel usually need to manually execute the test steps.

[0068] However, when using testing tools such as monkeyrunner and UI Automator to perform functional testing on an electronic device, it is necessary to simulate the behavior of a user operating the electronic device according to a program manually written in advance by the user or in a random manner. And when using the method of testers manually executing test steps to perform functional testing on the electronic device, it requires a high labor cost, resulting in problems such as difficulty in automatically generating test cases and inaccurate execution of test steps in the testing methods of related technologies, making it difficult to achieve automated testing, with low test efficiency and test applicability.

[0069] Based on this, the exemplary embodiments of the present disclosure provide a testing method for an electronic device. By listening to at least one test action performed by a user on a test electronic device and generating corresponding test events according to the test action, it is possible to generate test cases based on each test event, achieving the automated generation of test cases. In addition, generating test cases by describing test actions through test events makes the test cases easy to read and modify, ensuring the efficiency and applicability of subsequent functional testing of the electronic device to be tested by executing the test cases.

[0070] In an exemplary embodiment, referring to Figure 1 as shown, a testing method for an electronic device is provided. The testing method for the electronic device includes:

[0071] S100. Listen to at least one test action performed by a user on a test electronic device, and generate a corresponding test event based on the test action. The test event is used to describe the corresponding test action.

[0072] In step S100, listen to the test actions performed by a user on the test electronic device. The test electronic device has the same type and model as the electronic device to be tested. The test electronic device can be, for example, a device such as a mobile phone or a tablet computer. The test action can be, for example, a click operation or a key operation, etc., which are the behaviors and actions made by the user when operating the test electronic device. The monitored test action can be one or more. Whenever a test action is monitored, a corresponding test event is generated according to the test action. The test event includes some or all of the relevant information when the corresponding test action occurs, enabling the test event to describe the corresponding test action.

[0073] S200. Generate test cases based on each test event. The test cases are used to perform functional testing on the electronic device to be tested.

[0074] In step S200, after each test event is generated, test cases are generated according to the test events. A test case is a set of elements provided to the electronic device under test or the test system where the electronic device under test is located for the purpose of implementing a test, so as to achieve the test purpose of functionally testing the electronic device under test. Elements such as a test environment, test steps, and test data can be included in the test case, which reflects the test plan, technology, and strategy. The test case can be stored and transmitted in the form of a data file in json format, for example. Subsequently, by executing the test case, the accuracy and stability of the electronic device under test when its function is triggered can be verified.

[0075] Exemplarily, if it is necessary to test the audio call function of a preset application, test actions such as click operations, swipe operations, and key operations performed by the user on the test electronic device can be monitored, and test events corresponding to the test actions such as "open the preset application" and "make an audio call" can be generated according to the monitored test actions. Then, test cases are generated according to the test events, realizing the automatic generation of test cases and ensuring the accuracy of the generated test cases. Subsequently, by executing the test case, the electronic device under test can execute each test event to test the audio call function of the electronic device under test.

[0076] It should be noted that the above steps of monitoring test actions, generating test events, and generating test cases can be executed in the test electronic device or in the main control computer connected to the test electronic device. The execution of the steps can be realized by software with recording and generating functions in the test electronic device or the main control computer, for example.

[0077] In this embodiment, by monitoring at least one test action performed by the user on the test electronic device and generating corresponding test events according to the test actions, test cases can be generated according to the test events, realizing the automatic generation of test cases. In addition, by generating test cases in the way of describing test actions through test events, the test cases are convenient to read and modify, ensuring the efficiency and applicability of functionally testing the electronic device under test by executing the test cases subsequently.

[0078] In some embodiments, referring to Figure 2 as shown, monitoring at least one test action performed by the user on the test electronic device and generating corresponding test events based on the test actions includes:

[0079] S110. When a click operation is monitored, determine the first operation information corresponding to the click operation. The first operation information includes any combination of one or more of the click coordinates, click text, click control icon, and click purpose.

[0080] In step S110, the test action includes a click operation. When the user is monitored to perform a click operation on the test electronic device, the monitored click operation is analyzed to determine the first operation information corresponding to the click operation. The first operation information includes any one or more combinations of click coordinates, click text, click control icon, and click purpose, wherein the click coordinates are the position coordinates of the click operation trigger position in the display interface of the test electronic device, the click text is the text content corresponding to the click operation trigger position, the click control icon is the control icon corresponding to the click operation trigger position, and the click purpose is the purpose that can be achieved by performing the click operation.

[0081] Exemplarily, for example, the input event of the device can be obtained through the getevent tool provided by the electronic device to be tested, and the click operation can be parsed according to the multi-touch protocol to implement the monitoring of the click operation. After the click operation is monitored, the click operation is analyzed, for example, the click coordinates, click text, click control icon and click purpose can be analyzed and obtained at the same time, and all or part of them that can be analyzed are used as the first operation information, and the click purpose, click text, click control icon and click coordinates can also be analyzed and obtained in sequence, and the first one that can be analyzed is used as the first operation information.

[0082] S120. Generate a test event corresponding to the click operation based on the first operation information.

[0083] In step S120, after determining the first operation information corresponding to the click operation, a test event corresponding to the click operation can be generated according to the first operation information. By way of example, if the first operation information determined according to the click operation is clicking a control icon, a test event corresponding to the test action of "clicking the control icon" is generated; if the first operation information determined according to the click operation is a click purpose of "opening a preset application", a test event corresponding to the test action of "opening the preset application" is generated.

[0084] In this embodiment, by monitoring the click operation and determining the first operation information corresponding to the click operation when the click operation is monitored, a test event corresponding to the click operation can be generated according to the first operation information, and the generation of the test event describing the click operation is realized, which provides a basis for the subsequent generation of test cases according to the test event. The first operation information includes any one or more combinations of click coordinates, click text, click control icon, and click purpose, and can analyze the click operation in different ways to determine different first operation information. When a certain type of information in the first operation information cannot be determined, the acquisition of the first operation information can be ensured by determining other information in the first operation information, so as to avoid the test action corresponding to the click operation from failing to generate a test event.

[0085] It should be noted that the test actions include sliding operations in addition to click operations. Compared with click operations, there is no need to analyze the sliding operations to obtain the operation purposes corresponding to the sliding operations. Instead, the corresponding test actions can be directly generated based on the monitored sliding operations, and the simulation of the sliding operations can be achieved by executing the corresponding test events when the test cases are subsequently executed.

[0086] In some embodiments, as shown in Figure 3 monitor at least one test action performed by the user on the test electronic device, and generate corresponding test events based on the test actions, including:

[0087] S130. Analyze the log file to monitor the volume key operation and the lock screen key operation.

[0088] In step S130, the test actions also include the volume key operation and the lock screen key operation. The volume key operation and the lock screen key operation can be monitored by analyzing the log file recorded by the logcat tool.

[0089] S140. When the volume key operation or the lock screen key operation is monitored, determine the second operation information corresponding to the volume key operation or the lock screen key operation according to the log file. The second operation information includes the key operation purpose.

[0090] In step S140, when the user's volume key operation or lock screen key operation on the test electronic device is monitored, analyze the monitored volume key operation or lock screen key operation according to the log file to determine the second operation information corresponding to the volume key operation and the lock screen key operation. The second operation information includes the key operation purpose. Exemplarily, when the volume key operation of "volume increase" is monitored, it can be determined according to the log file that the purpose of this volume key operation is "adjust the volume to the preset volume", and this is used as the second operation information.

[0091] S150. Generate a test event corresponding to the volume key operation or the lock screen key operation based on the second operation information.

[0092] In step S150, after determining the second operation information corresponding to the volume key operation or the lock screen key operation, a test event corresponding to the volume key operation or the lock screen key operation can be generated according to the second operation information. Exemplarily, if the second operation information determined according to the volume key operation is the key operation purpose of "adjust the volume to the preset volume", then a test event corresponding to the test action of "adjust the volume to the preset volume" is generated accordingly.

[0093] In this embodiment, by monitoring the volume button operation and the lock screen button operation, and determining the corresponding second operation information when the volume button operation or the lock screen button operation is monitored, it is possible to generate a test event corresponding to the volume button operation or the lock screen button operation according to the second operation information, realizing the generation of test events describing the volume button operation and the lock screen button operation, providing a basis for generating test cases according to the test events subsequently, and realizing the automatic generation of test cases.

[0094] In some embodiments, each test event includes multiple information items, and the multiple information items include the event action executor, the information required for event execution, the event execution method, and the event execution target result.

[0095] Each test event includes multiple information items, and each information item is used to describe the relevant information when the test action occurs. The multiple information items include the event action executor, the information required for event execution, the event execution method, and the event execution target result, enabling the test event to describe the corresponding test action. For some test events, some of the information items among the multiple information items may be blank information.

[0096] Exemplarily, when the test event is the test event corresponding to the test action of "opening a preset application", the event executor in the information item of the test event is the electronic device to be tested, the event execution method in the information item is "clicking the control icon corresponding to the preset application", and the event execution target result is "the preset application is successfully opened", enabling the test event to describe the "opening a preset application" test action through the included information items.

[0097] In this embodiment, each test event includes multiple information items, and the multiple information items include the event executor, the information required for event execution, the event execution method, and the event execution target result, which can characterize some or all of the relevant information when the corresponding test action occurs through the information items, enabling the test event to describe the corresponding test action, and making the test case easy to read and modify, providing a basis for the generation of test events and the subsequent execution of test events.

[0098] It can be understood that if functional testing needs to be performed on the electronic device to be tested, in addition to the test events generated corresponding to the test actions, the test cases used may also need to include events corresponding to other actions, such as events corresponding to actions performed on other devices outside the test electronic device, or events corresponding to subjective judgment actions, and these actions cannot or are difficult to be described by test events.

[0099] Based on this, in some embodiments, the test method of the electronic device further includes: receiving a preset event, and forming an event sequence by arranging the generated test events and the preset event in chronological order.

[0100] Before generating test cases based on each test event, a preset event is received. The preset event is an event corresponding to an action that cannot be described by a test event. For example, the preset event can be set and stored in a preset event list in advance according to requirements, and a suitable preset event can be selected from the preset event list and sent according to the actions required for the test purpose. The number of received preset events can be zero, one, or more. When there is at least one preset event, each test event and the preset event are formed into an event sequence in chronological order. The chronological order is the sorting of the occurrence time of the test actions corresponding to each test event and the reception time of the preset event, so that each test event and preset event in the event sequence can be arranged in chronological order.

[0101] It should be noted that when forming an event sequence with each test event and preset event in chronological order, the time interval between events can be described by an additional preset event, or can be directly obtained by analyzing the occurrence time of the test actions corresponding to each test event and the reception time of the preset event. After each test event and preset event are formed into an event sequence in chronological order, test cases can be generated according to the event sequence. Exemplarily, for example, the event sequence can be generated into a data file in json format to obtain test cases, thus realizing the generation of test cases based on each test event.

[0102] In this embodiment, by receiving preset events and forming an event sequence with each generated test event and preset event in chronological order, the generation of test cases can be realized according to the event sequence, so that the test cases can not only describe test actions through test events, but also describe other actions through preset events, which can meet the test purposes for various different functions, ensure that the subsequent automated testing of the electronic device to be tested can be realized by executing the test cases, and improve the test efficiency and test applicability.

[0103] In some embodiments, the preset event includes any one or a combination of events corresponding to judgment action, waiting action, and interaction action between the test electronic device and the auxiliary device.

[0104] The preset event can describe actions that cannot be described by test events such as judgment actions, waiting actions, and interaction actions between the test electronic device and the auxiliary device. Among them, the judgment action is a behavior action that requires subjective judgment, the waiting action is a behavior action that maintains the previous action for a certain duration, and the interaction action between the test electronic device and the auxiliary device is an action performed by the test electronic device on the auxiliary device or the auxiliary device on the test electronic device.

[0105] Exemplarily, when testing the audio call function of a preset application, the event corresponding to the judgment action of "judging whether the call sound is normal" can be used as a preset event, the event corresponding to the waiting action of "waiting for the audio call to be answered" can be used as a preset event, and the interaction action of "the auxiliary device receives the audio call request of the test electronic device" can also be used as a preset event. After each test event and preset event form an event sequence in chronological order, a test case can be generated according to the event sequence.

[0106] In this embodiment, the events corresponding to the judgment action, the waiting action, and the interaction action between the test electronic device and the auxiliary device are used as preset events, so that the judgment action, the waiting action, and the interaction action between the test electronic device and the auxiliary device can be described by the preset events, so that the test case can meet the test purposes of various different functions, ensuring that the subsequent automated test of the electronic device to be tested can be realized by executing the test case, and improving the test efficiency and test applicability.

[0107] In some embodiments, the test case is used to perform an audio function test on the electronic device to be tested, and the auxiliary device includes any one or a combination of a wired headphone automatic plugging and unplugging device, an audio playback device, a recording device, and an auxiliary answering device.

[0108] Any one or a combination of a wired headphone automatic plugging and unplugging device, an audio playback device, a recording device, and an auxiliary answering device can be used as an auxiliary device to perform interaction actions with the test electronic device or the electronic device to be tested. The wired headphone automatic plugging and unplugging device can perform the interaction action of plugging and unplugging the wired headphone on the test electronic device or the electronic device to be tested, the audio playback device can perform the interaction action of playing audio on the test electronic device or the electronic device to be tested, the recording device can perform the interaction action of recording audio on the test electronic device or the electronic device to be tested, and the auxiliary answering device can perform the interaction action of controlling it to answer an audio or video call on the test electronic device or the electronic device to be tested.

[0109] The interaction actions between the wired headphone automatic plugging and unplugging device, the audio playback device, the recording device, the auxiliary answering device and the test electronic device can be described by preset events, so that the subsequent execution of the test case including the preset events can control the auxiliary device and the electronic device to be tested to perform corresponding interaction actions, so as to perform tests on the headphone function, audio reception function, audio playback function and audio call function through the interaction actions, and further enable the test case to perform an audio function test on the electronic device to be tested.

[0110] In this embodiment, any one or a combination of a wired earphone automatic plugging and unplugging device, an audio playback device, a recording device, and an auxiliary answering device is used as an auxiliary device. The interaction actions between the auxiliary device and the test electronic device can be described through preset events, so that the test case can control the auxiliary device and the electronic device to be tested to perform interaction actions during subsequent execution, enabling the automatically generated test case to be used for audio function testing and improving the efficiency and applicability of audio function testing.

[0111] In some embodiments, before listening to at least one test action performed by the user on the test electronic device and generating a corresponding test event based on the test action, the test method of the electronic device further includes: adjusting the test electronic device to an initial state, where the test electronic device displays the main interface and all applications are in a closed state in the initial state.

[0112] Before listening to the test action, the test electronic device is adjusted to an initial state, which means that the test electronic device displays the main interface and there are no opened applications. After adjusting the test electronic device to the initial state, the actions performed by the user on the electronic device are test actions, so that the first test action monitored is executed on the main interface of the test electronic device, and no already opened application interferes with the monitoring and analysis of the test action.

[0113] In this embodiment, adjusting the test electronic device to the initial state before listening to the test action can ensure that the first test action monitored is executed on the main interface of the test electronic device and avoid interference caused by the opening of applications to the monitoring and analysis of the test action. When executing the test case subsequently, only by adjusting the electronic device to be tested to the same initial state can the effect consistent with that of executing the test action on the test electronic device be ensured, thereby ensuring the accuracy of automatic execution of the test case.

[0114] In an exemplary embodiment, a test method for an electronic device is provided. Refer to Figure 4 As shown, the test method for the electronic device includes:

[0115] S1. Adjust the test electronic device to an initial state, where the test electronic device displays the main interface and all applications are in a closed state in the initial state;

[0116] S2. Listen for click operations;

[0117] S3. When a click operation is monitored, determine the first operation information corresponding to the click operation, where the first operation information includes any one or a combination of click coordinates, click text, click control icons, and click purposes;

[0118] S4. Generate a test event corresponding to the click operation based on the first operation information;

[0119] S5. Analyze the log file to monitor the volume key operation and the lock screen key operation;

[0120] S6. When the volume key operation or the lock screen key operation is monitored, determine the second operation information corresponding to the volume key operation or the lock screen key operation according to the log file, and the second operation information includes the purpose of the key operation;

[0121] S7. Generate a test event corresponding to the volume key operation or the lock screen key operation based on the second operation information;

[0122] S8. Receive the preset event, and form an event sequence with the generated test events and the preset event in chronological order;

[0123] S9. Generate a test case based on the event sequence.

[0124] In this embodiment, by monitoring at least one test action performed by the user on the test electronic device and generating corresponding test events according to the test actions, test cases can be generated based on the test events, realizing the automatic generation of test cases. In addition, by generating test cases in the way of describing test actions through test events, the test cases are convenient to read and modify, ensuring the efficiency and applicability of subsequent functional testing of the electronic device to be tested by executing the test cases.

[0125] In an exemplary embodiment, as shown in Figure 5 a test method for an electronic device is provided. Using the test cases generated by the above test method, the test method for the electronic device includes:

[0126] S300. Execute the test case to send an execution instruction corresponding to each test event in the test case to the test system, so that the test system executes the test action corresponding to the test event. The test system includes the electronic device to be tested.

[0127] In step S300, execute the test case generated according to the above test method to send an execution instruction corresponding to each test event in the test case to the test system. The test system can execute the test action corresponding to the test event according to the execution instruction after receiving the execution instruction, realizing the restoration of the test action in the test system. The test system includes the electronic device to be tested, and the electronic device to be tested has the same type and model as the test electronic device. The electronic device to be tested can be, for example, a mobile phone, a tablet computer, or other devices.

[0128] It can be understood that when the test case includes preset events, when executing the test case, an execution instruction corresponding to each preset event can also be sent to the test system, so that the test system executes actions such as judgment actions, waiting actions, and interaction actions between the electronic device under test and the auxiliary device corresponding to the preset events.

[0129] S400. In response to meeting a preset test stop condition, determine the test result.

[0130] In step S400, when the preset test stop condition is met, the execution of the test case is stopped, and the final test result can be determined according to the execution results of the events that have been executed at this time. Exemplarily, if all events have been executed and the execution results are normal, it can be determined that the function tested by the electronic device under test is normal; if some events have not been executed or the test results of some executed events are abnormal, it can be determined that the function tested by the electronic device under test is abnormal.

[0131] In this embodiment, by executing the test case, the test system executes the test actions corresponding to the test events in the test case, and determines the test result when the preset test stop condition is met, realizing the automated test of the electronic device under test. The test case used describes the test actions through test events, making the test case easy to read and modify, and ensuring the efficiency and applicability of the functional test of the electronic device under test.

[0132] It should be noted that the above steps of executing the test case and determining the test result are executed in the main control computer connected to the test system, and the execution of the steps can be realized, for example, through software with the function of executing test cases in the main control computer. If the generation process of the test case is also executed in the main control computer, the execution subject of the test method corresponding to the test case generation process is the same as that of the test method corresponding to the test case usage process; if the test case generation process is executed in the electronic device under test, the execution subject of the test method corresponding to the test case generation process is different from that of the test method corresponding to the test case usage process.

[0133] In some embodiments, as shown in Figure 6 executing the test case includes:

[0134] S310. Read the event sequence in the test case, and the events in the event sequence include at least one test event.

[0135] In step S310, the test case executed by the main control computer is generated according to the event sequence. When executing the test case, the event sequence in the test case is read first. The events in the event sequence include one or more test events. On the basis that the events in the event sequence include at least one test event, preset events can also be included.

[0136] S320. Execute the events in the event sequence in chronological order, and sequentially send execution instructions corresponding to the events in the event sequence to the test system. If the nth event in the event sequence is a non-confirmation event, after sending the execution instruction, it is determined that the nth event in the event sequence has been executed, and then continue to execute the (n + 1)th event in the event sequence. If the nth event in the event sequence is a confirmation-required event, after sending the execution instruction, it is determined that the nth event in the event sequence has been executed and receive the execution result feedback by the test system. When the execution result is consistent with the event execution target result, continue to execute the (n + 1)th event in the event sequence.

[0137] In step S320, since the event sequence is composed of test events and preset events in chronological order, the events read from the event sequence also have chronological order. The main control computer executes the events in the event sequence in chronological order, and sequentially sends execution instructions corresponding to the events in the event sequence to the test system. The execution instructions include the execution instructions corresponding to the test events and the execution instructions corresponding to the preset events. The execution instruction can be an instruction indicating the test system to execute the corresponding action, or the event itself. When the execution instruction is the event itself, the test system that receives the execution instruction parses the event and executes the corresponding action.

[0138] For non-confirmation events that do not require confirmation of the event execution result, after sending the execution instruction corresponding to the event, the test system receives the execution instruction and executes the action corresponding to the event. After the main control computer confirms that the event has been executed, it continues to execute the next event in the event sequence. For confirmation-required events that require confirmation of the event execution result, after sending the execution instruction corresponding to the event, the test system receives the execution instruction and executes the action corresponding to the event. The main control computer confirms that the event has been executed and receives the execution result of the event feedback by the test system. Only when the execution result is consistent with the event execution target result in the information item of the event, it represents that the event has been executed successfully, and then continue to execute the next event in the event sequence.

[0139] It can be understood that when the execution result is inconsistent with the event execution target result in the information item of the event or the execution result is not received within the preset time, it represents that the event has been executed failed, which may lead to errors in the execution of subsequent events. At this time, the main control computer may no longer execute the next event in the time sequence, that is, stop the execution of subsequent events and the sending of execution instructions.

[0140] Exemplarily, for the event corresponding to the waiting behavior action of "waiting for the audio call to be answered" in the test case, it is necessary to confirm the execution result of the event, that is, whether the audio call is answered. When the execution result fed back by the test system received by the master computer is consistent with the event execution target result in this event information item, both being "the audio call is successfully answered", then continue to execute the event corresponding to the subsequent judgment action such as "judging whether the sound is normal". When the execution result fed back by the test system received by the master computer is "the audio call is not answered" or no feedback execution result is received within the preset time, it means that the event execution fails, making the execution of the event corresponding to the subsequent "judging whether the sound is normal" judgment action meaningless, and then stop the execution of the subsequent events and the sending of the execution instructions.

[0141] In this embodiment, by reading the event sequence in the test case and executing the events in the event sequence in the chronological order of the event sequence, and sequentially sending the execution instructions corresponding to the events in the event sequence to the test system, the sending of the execution instructions is realized, providing a basis for the test system to execute the actions corresponding to the events. The sequential sending method of the execution instructions differentiates between non-confirmation events and events that need to be confirmed, enabling the confirmation of the execution result according to the nature of the event when executing the events in the chronological order of the event sequence, avoiding meaningless execution of events, and ensuring the execution efficiency and accuracy of the test case.

[0142] In some embodiments, executing the events in the event sequence in the order of the events in the event sequence and sequentially sending the execution instructions corresponding to the events in the event sequence to the test system includes: when the event in the currently executed event sequence is a click event in the test events, parsing the test event, and generating the corresponding execution instructions according to the event execution method parsed in the order of decreasing priority of the click purpose, click text, click control icon, and click coordinate, and sending the execution instructions to the electronic device under test in the test system.

[0143] When the event in the currently executed event sequence is a click event in the test events, that is, the test event corresponding to the click operation, it is necessary for the master computer to send an execution instruction to the test system so that the electronic device under test performs the same click operation. The master computer can parse the test event to obtain the first operation information corresponding to the click event and use the first operation information as the event execution method. As mentioned above, the first operation information includes any one or a combination of multiple of the click coordinate, click text, click control icon, and click purpose. At this time, the first operation information, that is, the event execution method, is parsed in the order of decreasing priority of the click purpose, click text, click control icon, and click coordinate, and the execution instruction is generated according to the event execution method with the highest parsed priority and sent to the electronic device under test.

[0144] Exemplarily, if the click purpose is parsed, the click purpose is used as the event execution method to generate the corresponding execution instruction. If the click purpose is not parsed but the click text is parsed, the click text is used as the event execution method to generate the corresponding execution instruction. First, the click purpose is parsed. If the click purpose of the click event can be parsed, for example, "open a preset application", the click purpose is used as the event execution method of the click event, and the corresponding shell execution instruction is generated and sent to the electronic device under test, so that the electronic device can execute the action of opening the preset application through its own shell command line interpreter. If the click purpose is not parsed, the click text is parsed. If the click text of the click event can be parsed, the click text is used as the execution method of the click event. The location of the text can be found by exporting the view structure or using optical character recognition (OCR), and then the corresponding shell instruction is generated and sent to the electronic device under test, so that the electronic device can execute the action at the location of the click text through its own shell command line interpreter.

[0145] In this embodiment, if the event in the currently executed event sequence is a click event in the test event, by parsing the test event, the corresponding execution instruction is generated according to the parsed event execution method and sent to the electronic device under test, realizing the generation and sending of the execution instruction, enabling the electronic device under test to execute the click operation corresponding to the click event, and providing guarantee for the automated function test of the electronic device under test. The events are parsed in the order of decreasing priority of click purpose, click text, click control icon, and click coordinates, so that the corresponding generated execution instructions are as easy to read and execute as possible, improving the efficiency and accuracy of the click operation executed by the electronic device under test, and further improving the efficiency and accuracy of the main control computer executing the event.

[0146] In some embodiments, the test system further includes an auxiliary device, and the events in the event sequence further include at least one preset event, and the preset event includes an event corresponding to the interaction action between the test electronic device and the auxiliary device. As mentioned above, the auxiliary device can include, for example, any combination of a wired headphone automatic plugging and unplugging device, an audio playback device, a recording device, and an auxiliary answering device. The events in the event sequence include at least one preset event in addition to the test events, and the preset events in the event sequence include events corresponding to the interaction actions between the test electronic device and the auxiliary device.

[0147] Execute the events in the event sequence in the order of the events in the event sequence, and sequentially send execution instructions corresponding to the events in the event sequence to the test system, including: when the event currently executed in the event sequence is an event corresponding to an interaction action between the test electronic device and the auxiliary device, parse the event, generate an execution instruction corresponding to the electronic device to be tested and / or an execution instruction corresponding to the auxiliary device according to the event execution method parsed out, and send the corresponding execution instructions to the electronic device to be tested and the auxiliary device.

[0148] If the event currently executed in the event sequence is an event corresponding to an interaction action between the test electronic device and the auxiliary device, the master computer needs to send an execution instruction to the test system so that the same interaction action is performed between the electronic device to be tested and the auxiliary device. The master computer can parse the event to obtain the event execution method corresponding to the event. If the event execution method is to control the test electronic device to operate on the auxiliary device, an execution instruction corresponding to the test electronic device is generated and the execution instruction is sent to the test electronic device. If the event execution method is to control the auxiliary device to operate on the test electronic device, an execution instruction corresponding to the auxiliary device is generated and the execution instruction is sent to the test electronic device. If the event execution method is to control the test electronic device to operate on the auxiliary device and control the auxiliary device to operate on the test electronic device, execution instructions corresponding to the test electronic device and the auxiliary device are respectively generated, and the corresponding execution instructions are sent to the test electronic device and the auxiliary device.

[0149] Exemplarily, if the event currently executed in the event sequence is an event corresponding to the interaction action of "inserting a wired headset into the electronic device to be tested", parse the event to obtain the event execution method of "controlling the wired headset automatic plugging and unplugging device to insert a wired headset into the electronic device to be tested", and correspondingly generate an execution instruction corresponding to the wired headset automatic plugging and unplugging device, and then send the execution instruction to the wired headset automatic plugging and unplugging device, so that the wired headset automatic plugging and unplugging device performs the interaction action of "inserting a wired headset into the electronic device to be tested". If the event currently executed in the event sequence is an event corresponding to the interaction action of "recording the audio played by the electronic device to be tested", parse the event to obtain the event execution method of "controlling the electronic device to be tested to play audio and controlling the recording device to record audio", and correspondingly generate execution instructions corresponding to the electronic device to be tested and the recording device respectively, and then send the execution instructions to the electronic device to be tested and the recording device respectively, so that the electronic device to be tested performs the action of "playing audio" and the recording device performs the action of "recording audio".

[0150] In this embodiment, when the event in the currently executed event sequence is an event corresponding to an interaction action between the test electronic device and the auxiliary device, by parsing the event and generating an execution instruction corresponding to the electronic device to be tested and an execution instruction corresponding to the auxiliary device according to the parsed event execution method, and then sending the corresponding execution instructions to the electronic device to be tested and the auxiliary device, the generation and sending of the execution instructions are realized, enabling the test system to execute the test actions corresponding to the interaction events, solving the problem that it is difficult for the auxiliary device to participate in the automated test in the related art, expanding the functions that can be detected, and improving the efficiency and applicability of the functional test of the electronic device to be tested.

[0151] In some embodiments, the preset test stop condition is that the last event in the event sequence is executed, or any event in the event sequence fails to execute. It can also be that the last event in the event sequence is executed or any event in the event sequence fails to execute.

[0152] In this embodiment, taking the execution of the last event in the event sequence and the failure of any event in the event sequence as the preset test stop condition can stop the execution of the test case when all events are executed or it is meaningless to continue executing the events, enabling the test case to not only be automatically generated but also automatically executed and stopped, realizing the automation of the complete test method, and ensuring that there is sufficient basis for determining the test result when the test case stops executing, improving the accuracy of the test result.

[0153] In an exemplary embodiment, a test method for an electronic device is provided. Refer to Figure 7 As shown, the test method for the electronic device includes:

[0154] S11. Read the event sequence in the test case. The event sequence includes at least one test event and at least one preset event;

[0155] S12. Execute the nth event in the event sequence in the time order of the event sequence;

[0156] S13. When the nth event in the currently executed event sequence is a click event among the test events, parse the test event, and generate a corresponding execution instruction according to the parsed event execution method in the order of decreasing priority of click purpose, click text, click control icon, and click coordinates, and send the execution instruction to the electronic device to be tested in the test system, so that the electronic device to be tested executes the click operation corresponding to the click event;

[0157] S14. If the nth event in the currently executed event sequence is an event corresponding to an interaction action between the test electronic device and the auxiliary device, parse the event, generate an execution instruction corresponding to the electronic device to be tested and an execution instruction corresponding to the auxiliary device according to the parsed event execution method, and send the corresponding execution instructions to the electronic device to be tested and the auxiliary device, so that the electronic device to be tested and the auxiliary device perform the interaction action corresponding to the event;

[0158] S15. If the nth event in the currently executed event sequence is other events, send an execution instruction corresponding to the nth event in the currently executed event sequence to the test system, so that the test system performs the action corresponding to the event;

[0159] S16. Determine whether a preset test stop condition is satisfied. If satisfied, execute S20; if not, execute S17;

[0160] S17. Determine whether the nth event in the currently executed event sequence is a non-confirmation event. If so, execute S18; if not, execute S19;

[0161] S18. Determine that the events in the currently executed event sequence are completed, return to S12 and continue to execute the (n + 1)th event in the event sequence;

[0162] S19. Determine that the nth event in the event sequence is completed and receive the execution result feedback by the test system. If the execution result is consistent with the event execution target result, return to S12 and continue to execute the (n + 1)th event in the event sequence;

[0163] S20. Determine the test result.

[0164] In this embodiment, by executing the test case, the test system is made to perform the test actions corresponding to the test events in the test case, and the test result is determined when the preset test stop condition is satisfied, realizing the automated test of the electronic device to be tested. The test case used describes the test action through the test event, making the test case easy to read and change, and ensuring the efficiency and applicability of the functional test of the electronic device to be tested.

[0165] In an exemplary embodiment, a test device for an electronic device is provided for generating a test case. Referring to Figure 8 As shown, the test device for the electronic device includes a monitoring module 10 and a generating module 20. The monitoring module 10 is used to monitor at least one test action performed by the user on the test electronic device and generate corresponding test events based on the test action. The test event is used to describe the corresponding test action. The generating module 20 is used to generate a test case based on each test event. The test case is used to perform a functional test on the electronic device to be tested.

[0166] In this embodiment, the monitoring module 10 monitors at least one test action performed by the user on the test electronic device, and generates corresponding test events according to the test actions. The generation module 20 can generate test cases according to the test events, realizing the automatic generation of test cases. In addition, by generating test cases in the way of describing test actions with test events, the test cases are convenient to read and modify, ensuring the efficiency and applicability of subsequent functional testing of the electronic device to be tested by executing the test cases.

[0167] In one embodiment, the monitoring module 10 is further configured to: when a click operation is monitored, determine first operation information corresponding to the click operation, where the first operation information includes any one or a combination of multiple ones of the click coordinates, click text, click control icon, and click purpose; and generate a test event corresponding to the click operation based on the first operation information.

[0168] In one embodiment, the monitoring module 10 is further configured to: analyze the log file to monitor the volume key operation and the lock screen key operation; when the volume key operation or the lock screen key operation is monitored, determine second operation information corresponding to the volume key operation or the lock screen key operation according to the log file, where the second operation information includes the key operation purpose; and generate a test event corresponding to the volume key operation or the lock screen key operation based on the second operation information.

[0169] In one embodiment, each test event includes multiple information items, and the multiple information items include the event action executor, the information required for event execution, the event execution method, and the event execution target result.

[0170] In one embodiment, the monitoring module 10 is further configured to: receive a preset event, and form an event sequence by arranging the generated test events and the preset event in chronological order.

[0171] In one embodiment, the generation module 20 is further configured to: generate a test case based on the event sequence.

[0172] In one embodiment, the preset event includes any one or a combination of multiple ones of the event corresponding to the judgment behavior action, the event corresponding to the waiting behavior action, and the event corresponding to the interaction action between the test electronic device and the auxiliary device.

[0173] In one embodiment, the test case is used to perform an audio function test on the electronic device to be tested, and the auxiliary device includes any one or a combination of multiple ones of a wired headphone automatic plugging and unplugging device, an audio playback device, a recording device, and an auxiliary answering device.

[0174] In one embodiment, the test device of the electronic device further includes an adjustment module, and the adjustment module is configured to adjust the test electronic device to an initial state, where the test electronic device displays the main interface and all applications are in a closed state in the initial state.

[0175] In an exemplary embodiment, a test device for an electronic device is provided for executing a test case. Refer to Figure 9 As shown, the test device for the electronic device includes an execution module 30 and a determination module 40. The execution module 30 is configured to execute the test case to send an execution instruction corresponding to each test event in the test case to the test system, so that the test system performs a test action corresponding to the test event. The test system includes the electronic device to be tested. The determination module 40 is configured to determine a test result in response to meeting a preset test stop condition.

[0176] In this embodiment, by executing the test case through the execution module 30, the test system performs a test action corresponding to the test event in the test case, and when the preset test stop condition is met, the determination module 40 determines the test result, realizing the automated test of the electronic device to be tested. The test case used describes the test action through the test event, making the test case easy to read and change, and ensuring the efficiency and applicability of the functional test of the electronic device to be tested.

[0177] In one embodiment, the execution module 30 is further configured to: read an event sequence in the test case, where the events in the event sequence include at least one test event; execute the events in the event sequence in chronological order of the event sequence, and sequentially send execution instructions corresponding to the events in the event sequence to the test system. Among them, if the nth event in the event sequence is a non-confirmation event, after the sending of the execution instruction is completed, it is determined that the nth event in the event sequence is executed, and the (n + 1)th event in the event sequence is continued to be executed. If the nth event in the event sequence is a confirmation-required event, after the sending of the execution instruction is completed, it is determined that the nth event in the event sequence is executed and the execution result feedback by the test system is received. When the execution result is consistent with the event execution target result, the (n + 1)th event in the event sequence is continued to be executed.

[0178] In one embodiment, the execution module 30 is further configured to: if the event in the currently executed event sequence is a click event in the test event, parse the test event, and generate a corresponding execution instruction according to the event execution method parsed in the order of decreasing priority of click purpose, click text, click control icon, and click coordinate, and send the execution instruction to the electronic device to be tested in the test system.

[0179] In one embodiment, the test system further includes an auxiliary device. The events in the event sequence further include at least one preset event. The preset event includes an event corresponding to an interaction action between the electronic device under test and the auxiliary device. The execution module 30 is further configured to: when the event in the currently executed event sequence is an event corresponding to an interaction action between the electronic device under test and the auxiliary device, parse the event, generate an execution instruction corresponding to the electronic device to be tested and / or an execution instruction corresponding to the auxiliary device according to the event execution method parsed out, and send the corresponding execution instructions to the electronic device to be tested and the auxiliary device.

[0180] In one embodiment, the preset test stop conditions include: the last event in the event sequence has been executed; and / or, any event in the event sequence fails to execute.

[0181] In an exemplary embodiment, an electronic device is provided. The electronic device may be the electronic device under test or the main control computer in the above test method and test device.

[0182] Refer to Figure 10 As shown, the electronic device may include one or more of the following components: a processing component 101, a memory 102, a power component 103, a multimedia component 104, an audio component 105, an input / output (I / O) interface 106, a sensor component 107, and a communication component 108.

[0183] The processing component 101 generally controls the overall operation of the electronic device, such as operations associated with display, telephone call, data communication, camera operation, and recording operation. The processing component 101 may include one or more processors 109 to execute instructions to complete all or part of the steps of the above method. In addition, the processing component 101 may include one or more modules to facilitate the interaction between the processing component 101 and other components. For example, the processing component 101 may include a multimedia module to facilitate the interaction between the multimedia component 104 and the processing component 101.

[0184] The memory 102 is configured to store various types of data to support the operation of the electronic device. Examples of these data include instructions for any application or method operating on the electronic device, contact data, phone book data, messages, pictures, audio, etc. The memory 102 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, a magnetic disk, or an optical disk.

[0185] The power component 103 provides power for various components of the electronic device. The power component 103 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the electronic device.

[0186] The multimedia component 104 includes a screen that provides an output interface between the electronic device and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen can be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors can sense not only the boundaries of the touch or swipe actions but also detect the duration and pressure associated with the touch or swipe operations. In some embodiments, the multimedia component 104 includes a front camera and / or a rear camera. When the electronic device is in an operating mode, such as a shooting mode or an audio mode, the front camera and / or the rear camera can receive external multimedia data. Each of the front camera and the rear camera can be a fixed optical lens system or have focal length and optical zoom capabilities.

[0187] The audio component 105 is configured to output and / or input audio signals. For example, the audio component 105 includes a microphone (MIC) that is configured to receive external audio signals when the electronic device is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals can be further stored in the memory 102 or transmitted via the communication component 108. In some embodiments, the audio component 105 further includes a speaker for outputting audio signals.

[0188] The I / O interface 106 provides an interface between the processing component 101 and a peripheral interface module, which can be a keyboard, a click wheel, buttons, etc. These buttons can include, but are not limited to: a home button, a volume button, a power button, and a lock button.

[0189] The sensor assembly 107 includes one or more sensors for providing a status assessment of various aspects of the electronic device. For example, the sensor assembly 107 can detect the on / off state of the electronic device, the relative positioning of components, such as the display and keypad of the electronic device. The sensor assembly 107 can also detect a change in the position of the electronic device or a component of the electronic device, the presence or absence of user contact with the electronic device, the orientation or acceleration / deceleration of the electronic device, and the temperature change of the electronic device. The sensor assembly 107 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 107 can also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 107 can further include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0190] The communication component 108 is configured to facilitate communication between the electronic device and other devices in a wired or wireless manner. The device can access a wireless network based on communication standards, such as WiFi, 2G, or 3G, or a combination thereof. In an exemplary embodiment, the communication component 108 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 108 further includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0191] In an exemplary embodiment, the electronic device can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the above-described test method applied to the electronic device.

[0192] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions, such as the memory 102 including instructions, is also provided. The above instructions can be executed by the processor 109 of the electronic device to complete the above-described test method applied to the electronic device. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc. When the instructions in the storage medium are executed by the processor 109 of the electronic device, the electronic device is enabled to execute the test method shown in the above embodiments.

[0193] Other embodiments of the present invention will be readily apparent to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following the general principles of the invention and including known common general knowledge or conventional technical means in the technical field not disclosed in this disclosure. The specification and examples are only considered exemplary, and the true scope and spirit of the invention are pointed out by the following claims.

[0194] It should be understood that the present invention is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present invention is only limited by the appended claims.

Claims

1. A testing method for an electronic device, characterized in that, The test method for the electronic device includes: Listening for at least one test action performed by a user on the test electronic device, and generating a corresponding test event based on the test action, where the test event is used to describe the corresponding test action; Generating a test case based on each of the test events, where the test case is used to perform a functional test on the electronic device to be tested.

2. The test method for the electronic device according to claim 1, characterized in that, The listening for at least one test action performed by a user on the test electronic device, and generating a corresponding test event based on the test action, includes: When a click operation is detected, determining first operation information corresponding to the click operation, where the first operation information includes any one or more combinations of a click coordinate, click text, click control icon, and click purpose; Generating the test event corresponding to the click operation based on the first operation information.

3. The test method for an electronic device according to claim 1, wherein The listening for at least one test action performed by a user on the test electronic device, and generating a corresponding test event based on the test action, includes: Analyzing a log file to listen for a volume key operation and a lock screen key operation; When the volume key operation or the lock screen key operation is detected, determining second operation information corresponding to the volume key operation or the lock screen key operation according to the log file, where the second operation information includes a key operation purpose; Generating the test event corresponding to the volume key operation or the lock screen key operation based on the second operation information.

4. The testing method for the electronic device according to any one of claims 1 to 3, characterized in that, Each of the test events includes a plurality of information items, and the plurality of information items include an event action executor, information required for event execution, an event execution method, and an event execution target result.

5. The test method of the electronic device according to any one of claims 1 to 3, characterized in that, The test method for the electronic device further includes: Receiving a preset event, and forming an event sequence by arranging each of the generated test events and the preset event in chronological order; The generating a test case based on each of the test events includes: Generating the test case based on the event sequence.

6. The test method of the electronic device according to claim 5, characterized in that, The preset event includes any one or more combinations of an event corresponding to a judgment behavior action, an event corresponding to a waiting behavior action, and an event corresponding to an interaction action between the test electronic device and an auxiliary device.

7. The test method for the electronic device according to claim 6, wherein The test case is used to perform an audio function test on the electronic device to be tested, and the auxiliary device includes any one or more combinations of a wired headphone automatic plugging and unplugging device, an audio playback device, a recording device, and an auxiliary answering device.

8. The testing method of the electronic device according to any one of claims 1-3, characterized in that, Before the listening for at least one test action performed by a user on the test electronic device, and generating a corresponding test event based on the test action, the test method for the electronic device further includes: Adjusting the test electronic device to an initial state, where the test electronic device displays a main interface and all applications are in a closed state in the initial state.

9. A testing method for an electronic device, characterized in that, For the test case generated by using the test method according to any one of claims 1 - 8, the test method for the electronic device includes: Executing the test case to send an execution instruction corresponding to each test event in the test case to a test system, so that the test system performs the test action corresponding to the test event, and the test system includes the electronic device to be tested; Determine the test result in response to meeting the preset test stop condition.

10. The test method of the electronic device according to claim 9, characterized in that, The execution of the test case includes: Read the event sequence in the test case, where the events in the event sequence include at least one of the test events; Execute the events in the event sequence in chronological order of the event sequence, and sequentially send execution instructions corresponding to the events in the event sequence to the test system; Wherein, if the nth event in the event sequence is a non-confirmation event, after sending the execution instruction is completed, it is determined that the nth event in the event sequence is executed, and the (n + 1)th event in the event sequence is continued to be executed; If the nth event in the event sequence is a confirmation-required event, after sending the execution instruction is completed, it is determined that the nth event in the event sequence is executed and the execution result feedback by the test system is received. When the execution result is consistent with the event execution target result, the (n + 1)th event in the event sequence is continued to be executed.

11. The test method for an electronic device according to claim 10, characterized in that, The execution of the events in the event sequence in the order of the events in the event sequence, and sequentially sending execution instructions corresponding to the events in the event sequence to the test system includes: If the event currently being executed in the event sequence is a click event among the test events, parse the test event, and generate a corresponding execution instruction according to the event execution method parsed out in the order of decreasing priority of click purpose, click text, click control icon, and click coordinates, and send the execution instruction to the electronic device under test in the test system.

12. The test method for an electronic device according to claim 10, wherein The test system further includes an auxiliary device, and the events in the event sequence further include at least one preset event, where the preset event includes an event corresponding to an interaction action between the test electronic device and the auxiliary device. The execution of the events in the event sequence in the order of the events in the event sequence, and sequentially sending execution instructions corresponding to the events in the event sequence to the test system includes: If the event currently being executed in the event sequence is an event corresponding to an interaction action between the test electronic device and the auxiliary device, parse the event, and generate an execution instruction corresponding to the electronic device under test and / or an execution instruction corresponding to the auxiliary device according to the event execution method parsed out, and send the corresponding execution instruction to the electronic device under test and the auxiliary device.

13. The test method for an electronic device according to claim 10, wherein The preset test stop condition includes: The last event in the event sequence is executed; and / or, Any event in the event sequence fails to execute.

14. A test device for an electronic device, characterized in that, The test device of the electronic device includes: A monitoring module, which is used to monitor at least one test action performed by the user on the test electronic device, and generate corresponding test events based on the test action, where the test events are used to describe the corresponding test actions; A generation module, which is used to generate a test case based on each of the test events, where the test case is used to perform a function test on the electronic device under test.

15. A test device for an electronic device, characterized in that, The test device of the electronic device includes: An execution module, which is configured to execute the test case to send execution instructions corresponding to each test event in the test case to a test system, so that the test system performs test actions corresponding to the test events, and the test system includes an electronic device to be tested; A determination module, which is configured to determine a test result in response to meeting a preset test stop condition.

16. An electronic device, characterized in that, The electronic device includes: A processor; A memory for storing instructions executable by the processor; Wherein, the processor is configured to execute the test method of the electronic device according to any one of claims 1-8 or claims 9-13.

17. A non-transitory computer-readable storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is enabled to execute the test method of the electronic device according to any one of claims 1-8 or claims 9-13.