Test method and device of smart home equipment, program and electronic equipment
By dynamically adjusting the execution order of smart home device test cases, the problem of inflexible sorting of test cases is solved, and the testing efficiency and success rate are improved.
Patent Information
- Application Number
- CN202411628759.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-02-18
AI Technical Summary
The test cases of smart home devices are inflexible, which affects the testing efficiency.
Ensure that the test case matches the device status by obtaining the current device status of the smart home device and dynamically adjusting the execution order of the test case according to the priority weight of the test case and the current device status.
This improves the execution success rate of test cases, reduces manual intervention, and enables rapid completion of the test process and improves testing efficiency.
Smart Images

Figure CN119472608A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of automated testing, and in particular to a testing method, a testing device, a computer program product, and an electronic device for smart home devices. Background Art
[0002] During the automated testing of smart home devices, the testing process may involve multiple state transitions such as powering on, powering off, connecting to the Internet, and disconnecting from the Internet, as the initial functional states of the devices are often complex and diverse. These state transitions not only affect the operating effect of the device, but are also directly related to the accuracy and reliability of automated testing. Traditional test case sorting methods usually rely on the sequential execution of code settings, that is, executing test cases one by one in a preset fixed order. This method has obvious deficiencies in practical applications and lacks sufficient flexibility. Once the function and state of the device are updated, the sequence settings in the code need to be manually adjusted, which increases the complexity and maintenance cost of the test work as well as the accuracy and reliability of the test. Summary of the invention
[0003] The main purpose of the present application is to provide a testing method, a testing device, a computer program product and an electronic device for smart home devices, so as to at least solve the problem in the prior art that the test case sorting of smart home devices is inflexible and affects the test efficiency.
[0004] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a testing method for a smart home device is provided, comprising: obtaining a current device status of the smart home device; determining an execution order of multiple test cases in a test case library according to the current device status and a priority weight, so that the smart home device executes the multiple test cases, wherein each test case in the test case library has a preset priority weight.
[0005] Optionally, according to the current device state and the priority weight, determining the execution order of multiple test cases in the test case library so that the smart home device executes the multiple test cases, including: an adjustment step, adjusting the priority weights of the multiple test cases based on the current device state according to a weight adjustment rule to obtain an adjusted weight of each test case, wherein the weight adjustment rule includes at least one of the following: increasing the priority weight of the test case that can be executed by the smart home device in the current device state, and reducing the priority weight of the test case that cannot be executed by the smart home device in the current device state; determining A step of determining, according to a plurality of the adjusted weights, the test case corresponding to the largest adjusted weight as the target test case, and controlling the smart home device to execute the target test case; an acquisition step of at least acquiring the device state of the smart home device after executing the target test case to obtain the new current device state; a loop step of determining whether there are any unexecuted test cases in the test case library, and if there are any unexecuted test cases in the test case library, looping the acquisition step, the adjustment step and the determination step at least once until there are no unexecuted test cases in the test case library.
[0006] Optionally, the acquisition step includes: acquiring the execution result of the smart home device executing the target test case and the new current device state; performing a snapshot storage on the new current device state to generate snapshot data; and associating the snapshot data, the execution result and the ID information of the target test case and storing them in a snapshot mapping library.
[0007] Optionally, the adjustment step includes: determining whether there is a test case that is executable with the current device state among the multiple test cases based on the current device state; in the case that there is a test case that is executable with the current device state among the multiple test cases, determining that the test case that is executable with the current device state is a preliminary test case; increasing the priority weight corresponding to the preliminary test case by a predetermined step value to obtain the adjusted weight of the preliminary test case; and determining the adjusted weights of the other test cases except the preliminary test case as the corresponding priority weights.
[0008] Optionally, based on multiple adjusted weights, determining the test case corresponding to the largest adjusted weight as the target test case includes: sorting the multiple test cases in descending order of the adjusted weights to obtain a test case sequence; and determining the test case that is first in the test case sequence as the target test case.
[0009] Optionally, after the determination step and before the loop step, the method further includes: marking the target test case in the test case library as an executed case; determining whether there are any unexecuted test cases in the test case library, including: determining whether there are any test cases that are not marked as the executed cases in the test case library, and if there are any test cases that are not marked as the executed cases in the test case library, determining that there are any unexecuted test cases in the test case library.
[0010] Optionally, after determining the execution order of multiple test cases in the test case library according to the current device state so that the smart home device completes execution of the multiple test cases, the method further includes: generating a test report according to the execution results of each test case executed by the smart home device.
[0011] According to another aspect of the present application, a testing device for a smart home device is provided, comprising: an acquisition unit, used to acquire the current device status of the smart home device; a determination unit, used to determine the execution order of multiple test cases in a test case library according to the current device status, so that the smart home device executes the multiple test cases, wherein the test case library includes the multiple test cases, and each test case has a preset priority weight.
[0012] According to another aspect of the present application, a computer program product is provided, comprising computer instructions, wherein when the computer instructions are executed by a processor, any one of the methods described above is implemented.
[0013] According to another aspect of the present application, an electronic device is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include methods for executing any one of the described methods.
[0014] By applying the technical solution of the present application, the current device state of the smart home device is first obtained, and then the execution order of the multiple test cases is determined according to the priority weights of the multiple test cases and the current device state, so as to complete the testing of the multiple test cases of the smart home device. The solution of the present application sorts the order in which the smart home device executes multiple test cases according to the current device state of the smart home device and the priority weights of the test cases, achieving the effect of dynamically determining the execution order of the test cases according to the current device state of the smart home device, and realizing flexible sorting of multiple test cases, so that the test cases executed by the smart home device are more matched with the current device state of the smart home device, ensuring a high success rate of the test case execution, avoiding manual intervention in the test cases that failed to execute, and allowing the smart home device to complete the entire test process relatively quickly, thereby ensuring high test efficiency, and solving the problem of inflexible test case sorting of smart home devices in the prior art, which affects the test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The drawings constituting part of the present application are used to provide a further understanding of the present application. The exemplary embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0016] Figure 1 A hardware structure block diagram of a mobile terminal for executing a method for testing a smart home device provided in an embodiment of the present application is shown;
[0017] Figure 2 A schematic diagram of a testing method for a smart home device according to an embodiment of the present application is shown;
[0018] Figure 3 A test flow chart of a smart home device provided by an embodiment of the present application is shown;
[0019] Figure 4 A schematic diagram of a testing device for a smart home device provided in an embodiment of the present application is shown.
[0020] The above drawings include the following reference numerals:
[0021] 102, processor; 104, memory; 106, transmission device; 108, input and output devices. DETAILED DESCRIPTION
[0022] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0023] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the accompanying drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0025] As introduced in the background technology, the test case sorting of smart home devices in the prior art is inflexible, which affects the test efficiency. To solve the above technical problems, the embodiments of the present application provide a test method, a test device, a computer program product and an electronic device for smart home devices.
[0026] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0027] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal of a method for testing a smart home device according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is for illustration only and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.
[0028] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the test method of the smart home device in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the method described is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof. The transmission device 106 is used to receive or send data via a network. The specific example of the network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0029] In this embodiment, a testing method for smart home devices running on a mobile terminal, a computer terminal or a similar computing device is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0030] Figure 2 1 is a flow chart of a method for testing a smart home device according to an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:
[0031] Step S201, obtaining the current device status of the smart home device;
[0032] Specifically, the current device state may be the current working state of the smart home device, including but not limited to a power-on state, a power-off state, and a networking state, etc. The smart home devices include but are not limited to smart air conditioners, smart lamps, and smart refrigerators, etc.
[0033] Step S202, determining the execution order of multiple test cases in the test case library according to the current device state and the priority weight, so that the smart home device executes the multiple test cases, wherein each test case in the test case library has the preset priority weight.
[0034] Specifically, the priority weight may be pre-set according to the importance or urgency of the plurality of test cases.
[0035] Through the embodiment, the current device state of the smart home device is first obtained, and then the execution order of the multiple test cases is determined according to the priority weights of the multiple test cases and the current device state, so as to complete the testing of the multiple test cases of the smart home device. The present application sorts the order in which the smart home device executes multiple test cases according to the current device state of the smart home device and the priority weights of the test cases, achieving the effect of dynamically determining the execution order of the test cases according to the current device state of the smart home device, and realizing flexible sorting of multiple test cases, so that the test cases executed by the smart home device are more matched with the current device state of the smart home device, ensuring a high success rate of the test case execution, avoiding manual intervention in the test cases that failed to execute, and allowing the smart home device to complete the entire test process relatively quickly, thereby ensuring a high test efficiency, and solving the problem of inflexible sorting of test cases for smart home devices in the prior art, which affects the test efficiency.
[0036] In an optional solution, according to the current device state and the priority weight, determining the execution order of multiple test cases in the test case library so that the smart home device executes the multiple test cases includes:
[0037] an adjusting step, adjusting the priority weights of the plurality of test cases based on the current device state according to a weight adjustment rule to obtain an adjusted weight of each test case, wherein the weight adjustment rule comprises at least one of the following: increasing the priority weight of the test case executable by the smart home device in the current device state, and decreasing the priority weight of the test case not executable by the smart home device in the current device state;
[0038] Specifically, according to the current device state of the smart home device, the priority weights of the test cases in the test case library are automatically adjusted, and the weight adjustment rules include three situations. In the first situation, for the test cases that can be executed in the current device state, their priority weights will be increased, and for the test cases that cannot be executed in the current device state, their priority weights remain unchanged; in the second situation, for the test cases that cannot be executed in the current device state, their priority weights will be reduced, and for the test cases that can be executed in the current device state, their priority weights remain unchanged; in the third situation, for the test cases that can be executed in the current device state, their priority weights will be increased, and for the test cases that cannot be executed in the current device state, their priority weights will be reduced. Based on the weight adjustment rules, the adjusted weights of some of the test cases can be the same as the priority weights before the adjustment.
[0039] A determination step, determining, based on the plurality of adjusted weights, the test case corresponding to the largest adjusted weight as a target test case, and controlling the smart home device to execute the target test case;
[0040] Specifically, by comparing the adjusted weights of multiple test cases, a test case with the largest adjusted weight is found, and the test case is used as the test case that best matches the current device state, that is, as the test case that is most suitable for the smart home device to execute under the current device state, and the smart home device is controlled to execute the target test case. The target test case is the test case with the highest execution priority under the current device state.
[0041] An acquisition step of at least acquiring the device state of the smart home device after executing the target test case to obtain a new current device state;
[0042] Specifically, the device state of the smart home device after executing the target test case is obtained and updated as the current device state of the smart home device.
[0043] A loop step is used to determine whether there are any unexecuted test cases in the test case library. If there are any unexecuted test cases in the test case library, the obtaining step, the adjusting step and the determining step are looped at least once until there are no unexecuted test cases in the test case library.
[0044] Specifically, when there are unexecuted test cases in the test case library, it means that the test process of the smart home device has not been completed. At this time, the process of "obtaining the updated current device state, adjusting the priority weights of multiple test cases based on the updated current device state according to the weight adjustment rule, obtaining the adjusted weight of each test case, and determining the test case corresponding to the largest adjusted weight as the target test case based on the multiple adjusted weights, and controlling the smart home device to execute the target test case" is executed in a loop.
[0045] In the embodiment, by cyclically executing the acquisition step, the adjustment step and the determination step, it can be ensured that each test case is executed under a reasonable device state of the smart home device, and that all test cases can be executed, further ensuring that the test efficiency of the entire automated testing process is high.
[0046] It should be noted that the adjustment step in each cycle is to adjust the preset priority weights of the test cases, not to adjust the adjusted weights of the previous cycle.
[0047] In another optional solution, the obtaining step includes:
[0048] Obtaining the execution result of the target test case executed by the smart home device and the new current device state;
[0049] Specifically, during the execution process, the execution result after the smart home device executes the target test case is obtained, and the current device state of the smart home device after executing the test case is captured. The execution result includes: an execution success result and an execution failure result.
[0050] Performing snapshot storage on the new current device state to generate snapshot data;
[0051] Specifically, during the testing process of the smart home device, a new current device state after the smart home device executes the test case is snapshot stored, the snapshot storage technology is used to save the current device state, and corresponding snapshot data is generated.
[0052] The snapshot data, the execution result and the ID information of the target test case are associated and stored in a snapshot mapping library.
[0053] Specifically, the snapshot data of the smart home device, the execution result of the test case and the unique ID information of the target test case are associated, and the associated data combination is stored in the snapshot mapping library.
[0054] In the described embodiment, by acquiring the current device status of the smart home device in real time, it is ensured that the execution of the test cases is based on the current device status, further solving the problem of inflexible test case sorting and affecting test efficiency; by taking a snapshot of the current device status and generating snapshot data, it is possible to prevent the data of the current device status from being lost or damaged during the test, making subsequent historical data analysis and troubleshooting more convenient; the snapshot data, execution results and ID information of the target test case are associated and stored in a snapshot mapping library, making it more convenient to track the execution history of the test case, facilitating subsequent in-depth analysis and optimization of the control of the smart home device and the script of the test case, such as performance evaluation, fault location, etc., and also providing a reliable data basis for subsequent test automation and device status monitoring.
[0055] In some other exemplary embodiments, the adjusting step includes:
[0056] According to the current device state, determine whether there is a test case executable by the current device state among the multiple test cases; in the case that there is a test case executable by the current device state among the multiple test cases, determine that the test case executable by the current device state is a preliminary test case; increase the priority weight corresponding to the preliminary test case by a predetermined step value to obtain the adjusted weight of the preliminary test case; determine the adjusted weights of the other test cases except the preliminary test case as the corresponding priority weights.
[0057] Specifically, the number of the prepared test cases may be one or more, or may be none.
[0058] In the described embodiment, only the priority weights of the test cases executable under the current device state are adjusted, and the adjusted weights of other test cases remain their priority weights, which can further ensure that the adjusted weights of multiple test cases are obtained more quickly and efficiently, further improving the test efficiency of the entire test process.
[0059] According to some further optional solutions of the present application, determining, based on the plurality of adjusted weights, the test case corresponding to the largest adjusted weight as the target test case includes:
[0060] Sorting the plurality of test cases in descending order of the adjusted weights to obtain a test case sequence;
[0061] The test case at the first position in the test case sequence is determined as the target test case.
[0062] In the embodiment, the test cases are sorted in descending order according to the adjusted weights, so as to obtain the test case with the largest adjusted weight, thereby ensuring high search efficiency for the target test case.
[0063] In another optional scheme, after the determination step and before the loop step, the method also includes: marking the target test case in the test case library as an executed case; determining whether there are any unexecuted test cases in the test case library, including: determining whether there are any test cases that are not marked as the executed cases in the test case library, and if there are any test cases that are not marked as the executed cases in the test case library, determining that there are any unexecuted test cases in the test case library.
[0064] In the embodiment, by marking the executed test cases as "executed", the execution status of each test case can be clearly tracked and recorded. When determining whether there are unexecuted test cases in the test case library later, the system only needs to check whether there are test cases that are not marked as "executed", further ensuring that the test process of the smart home device covers all test cases, further ensuring the integrity of the test process.
[0065] In some other exemplary schemes of the present application, after determining the execution order of multiple test cases in the test case library based on the current device state so that the smart home device completes the execution of the multiple test cases, the method also includes: generating a test report based on the execution results of each test case executed by the smart home device.
[0066] Specifically, the test report can clearly display the execution status (success or failure) of each test case, the device status after execution, and possible errors or abnormal situations, which is convenient for subsequent testers to analyze the reasons for test failure, understand the test progress and test results, and provide strong data support for subsequent development, debugging and optimization work.
[0067] In the embodiment, a test report is automatically generated after the test is completed, and there is no need to manually summarize the test results of each test case, which further ensures a high level of test automation for smart home devices and further liberates manpower.
[0068] In order to enable those skilled in the art to more clearly understand the technical solution of the present application, the implementation process of the testing method for smart home devices of the present application will be described in detail below in conjunction with specific embodiments.
[0069] This embodiment relates to a specific testing method for smart home devices, such as Figure 3 As shown, the following steps are included:
[0070] Step S1, obtaining the current device status of the smart home device;
[0071] Step S2, taking a snapshot of the current device status and generating snapshot data;
[0072] Step S3, matching the test cases according to the current device status and the priority weight of each test case to obtain the target test case;
[0073] Step S4, controlling the smart home device to execute the target test case;
[0074] Step S5: If the execution is successful, it is mapped as a successful snapshot; if the execution fails, it is mapped as a failed snapshot. The current device status after the test result is successful or failed is derived as new snapshot data for storage;
[0075] Step S6, determining whether all test cases have been executed. If not all test cases have been executed, looping through steps S1, S2, S3, S4, and S5 at least once until there are no unexecuted test cases in the test case library.
[0076] Step S7, obtaining snapshots of all possible test results;
[0077] Step S8: Generate a test report based on the execution results of each test case executed by the smart home device.
[0078] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0079] The embodiment of the present application also provides a testing device for smart home devices. It should be noted that the testing device for smart home devices in the embodiment of the present application can be used to execute the testing method for smart home devices provided in the embodiment of the present application. The device is used to implement the embodiments and preferred implementations, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0080] The following is an introduction to the testing device for smart home devices provided in an embodiment of the present application.
[0081] Figure 4 Schematic diagram of a testing device for smart home devices according to an embodiment of the present application. Figure 4 As shown, the device comprises:
[0082] An acquisition unit 10 is used to acquire the current device status of the smart home device;
[0083] Specifically, the current device state may be the current working state of the smart home device, including but not limited to a power-on state, a power-off state, and a networking state, etc. The smart home devices include but are not limited to smart air conditioners, smart lamps, and smart refrigerators, etc.
[0084] The determination unit 20 is used to determine the execution order of multiple test cases in the test case library according to the current device state and the priority weight, so that the smart home device executes the multiple test cases, wherein each test case in the test case library has a preset priority weight.
[0085] Specifically, the priority weight may be pre-set according to the importance or urgency of the plurality of test cases.
[0086] Through the embodiment, the current device state of the smart home device is obtained by the acquisition unit, and the execution order of the multiple test cases is determined by the determination unit according to the priority weights of the multiple test cases and the current device state, so as to complete the testing of the multiple test cases of the smart home device. The present application sorts the order in which the smart home device executes multiple test cases according to the current device state of the smart home device and the priority weights of the test cases, and achieves the effect of dynamically determining the execution order of the test cases according to the current device state of the smart home device, and realizes the flexible sorting of multiple test cases, so that the test cases executed by the smart home device are more matched with the current device state of the smart home device, and the execution success rate of the test cases is ensured to be high, and manual intervention of the test cases that failed to execute is avoided, so that the smart home device can complete the entire test process relatively quickly, thereby ensuring high test efficiency, and solving the problem of inflexible sorting of test cases for smart home devices in the prior art, which affects the test efficiency.
[0087] In an optional solution, the determining unit includes:
[0088] an adjustment module, configured to adjust the priority weights of the plurality of test cases based on the current device state according to a weight adjustment rule to obtain an adjusted weight of each test case, wherein the weight adjustment rule comprises at least one of the following: increasing the priority weight of the test case executable by the smart home device in the current device state, and decreasing the priority weight of the test case not executable by the smart home device in the current device state;
[0089] Specifically, according to the current device state of the smart home device, the priority weights of the test cases in the test case library are automatically adjusted, and the weight adjustment rules include three situations. In the first situation, for the test cases that can be executed in the current device state, their priority weights will be increased, and for the test cases that cannot be executed in the current device state, their priority weights remain unchanged; in the second situation, for the test cases that cannot be executed in the current device state, their priority weights will be reduced, and for the test cases that can be executed in the current device state, their priority weights remain unchanged; in the third situation, for the test cases that can be executed in the current device state, their priority weights will be increased, and for the test cases that cannot be executed in the current device state, their priority weights will be reduced. Based on the weight adjustment rules, the adjusted weights of some of the test cases can be the same as the priority weights before the adjustment.
[0090] A determination module, used for the determination step, determining the test case corresponding to the largest adjusted weight as the target test case according to the plurality of adjusted weights, and controlling the smart home device to execute the target test case;
[0091] Specifically, by comparing the adjusted weights of multiple test cases, a test case with the largest adjusted weight is found, and the test case is used as the test case that best matches the current device state, that is, as the test case that is most suitable for the smart home device to execute under the current device state, and the smart home device is controlled to execute the target test case. The target test case is the test case with the highest execution priority under the current device state.
[0092] An acquisition module is used for the acquisition step, at least acquiring the device state of the smart home device after executing the target test case to obtain the new current device state;
[0093] Specifically, the device state of the smart home device after executing the target test case is obtained and updated as the current device state of the smart home device.
[0094] A loop module is used for looping steps to determine whether there are any unexecuted test cases in the test case library. If there are any unexecuted test cases in the test case library, looping the obtaining step, the adjusting step and the determining step at least once until there are no unexecuted test cases in the test case library.
[0095] Specifically, when there are unexecuted test cases in the test case library, it means that the test process of the smart home device has not been completed. At this time, the process of "obtaining the updated current device state, adjusting the priority weights of multiple test cases based on the updated current device state according to the weight adjustment rule, obtaining the adjusted weight of each test case, and determining the test case corresponding to the largest adjusted weight as the target test case based on the multiple adjusted weights, and controlling the smart home device to execute the target test case" is executed in a loop.
[0096] In the embodiment, by cyclically executing the acquisition step, the adjustment step and the determination step, it can be ensured that each test case is executed under a reasonable device state of the smart home device, and that all test cases can be executed, further ensuring that the test efficiency of the entire automated testing process is high.
[0097] It should be noted that the adjustment step in each cycle is to adjust the preset priority weights of the test cases, not to adjust the adjusted weights of the previous cycle.
[0098] In another optional solution, the acquisition module includes:
[0099] An acquisition submodule, used to acquire the execution result of the target test case executed by the smart home device and the new current device state;
[0100] Specifically, during the execution process, the execution result after the smart home device executes the target test case is obtained, and the current device state of the smart home device after executing the test case is captured. The execution result includes: an execution success result and an execution failure result.
[0101] A snapshot submodule, used to store a snapshot of the new current device state and generate snapshot data;
[0102] Specifically, during the testing process of the smart home device, a new current device state after the smart home device executes the test case is snapshot stored, the snapshot storage technology is used to save the current device state, and corresponding snapshot data is generated.
[0103] The associating submodule is used to associate the snapshot data, the execution result and the ID information of the target test case and store them in a snapshot mapping library.
[0104] Specifically, the snapshot data of the smart home device, the execution result of the test case and the unique ID information of the target test case are associated, and the associated data combination is stored in the snapshot mapping library.
[0105] In the described embodiment, by acquiring the current device status of the smart home device in real time, it is ensured that the execution of the test cases is based on the current device status, further solving the problem of inflexible test case sorting and affecting test efficiency; by taking a snapshot of the current device status and generating snapshot data, it is possible to prevent the data of the current device status from being lost or damaged during the test, making subsequent historical data analysis and troubleshooting more convenient; the snapshot data, execution results and ID information of the target test case are associated and stored in a snapshot mapping library, making it more convenient to track the execution history of the test case, facilitating subsequent in-depth analysis and optimization of the control of the smart home device and the script of the test case, such as performance evaluation, fault location, etc., and also providing a reliable data basis for subsequent test automation and device status monitoring.
[0106] In some other exemplary embodiments, the adjustment module includes:
[0107] The first determination submodule is used to determine whether there is a test case executable by the current device state among the multiple test cases according to the current device state; the second determination submodule is used to determine that the test case executable by the current device state is a preliminary test case when there is a test case executable by the current device state among the multiple test cases; the adding submodule is used to increase the priority weight corresponding to the preliminary test case by a predetermined step value to obtain the adjusted weight of the preliminary test case; the third determination submodule is used to determine the adjusted weights of the other test cases except the preliminary test case as the corresponding priority weights.
[0108] Specifically, the number of the prepared test cases may be one or more, or may be none.
[0109] In the described embodiment, only the priority weights of the test cases executable under the current device state are adjusted, and the adjusted weights of other test cases remain their priority weights, which can further ensure that the adjusted weights of multiple test cases are obtained more quickly and efficiently, further improving the test efficiency of the entire test process.
[0110] According to some further optional solutions of the present application, the determining module includes:
[0111] A sorting submodule, used for sorting the plurality of test cases in descending order of the adjusted weights to obtain a test case sequence;
[0112] The fourth determining submodule is used to determine that the test case at the first position in the test case sequence is the target test case.
[0113] In the embodiment, the test cases are sorted in descending order according to the adjusted weights, so as to obtain the test case with the largest adjusted weight, thereby ensuring high search efficiency for the target test case.
[0114] In another optional scheme, the device also includes: a marking unit, which is used to mark the target test case in the test case library as an executed case after the determination step and before the loop step; the loop module includes: a fifth determination submodule, which is used to determine whether there are test cases in the test case library that are not marked as the executed case, and if there are test cases in the test case library that are not marked as the executed case, determine that there are unexecuted test cases in the test case library.
[0115] In the embodiment, by marking the executed test cases as "executed", the execution status of each test case can be clearly tracked and recorded. When determining whether there are unexecuted test cases in the test case library later, the system only needs to check whether there are test cases that are not marked as "executed", further ensuring that the test process of the smart home device covers all test cases, further ensuring the integrity of the test process.
[0116] In some further exemplary schemes of the present application, the apparatus further includes: a generating unit, configured to determine the execution order of a plurality of test cases in a test case library according to the current device state, so that after the smart home device completes execution of the plurality of test cases, a test report is generated according to the execution results of each of the test cases executed by the smart home device.
[0117] Specifically, the test report can clearly display the execution status (success or failure) of each test case, the device status after execution, and possible errors or abnormal situations, which is convenient for subsequent testers to analyze the reasons for test failure, understand the test progress and test results, and provide strong data support for subsequent development, debugging and optimization work.
[0118] In the embodiment, a test report is automatically generated after the test is completed, and there is no need to manually summarize the test results of each test case, which further ensures a high level of test automation for smart home devices and further liberates manpower.
[0119] The testing device for the smart home device includes a processor and a memory, the acquisition unit and the determination unit are stored in the memory as program units, and the processor executes the program units stored in the memory to implement corresponding functions. The modules are all located in the same processor; or, the modules are located in different processors in any combination.
[0120] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the kernel parameters can be adjusted to at least solve the problem of inflexible sorting of test cases for smart home devices in the prior art, which affects the test efficiency.
[0121] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0122] An embodiment of the present invention provides a computer-readable storage medium, which includes a stored program. When the program is executed, the device where the computer-readable storage medium is located is controlled to execute the testing method for the smart home device.
[0123] Specifically, the testing methods for smart home devices include:
[0124] Step S201, obtaining the current device status of the smart home device;
[0125] Specifically, the current device state may be the current working state of the smart home device, including but not limited to a power-on state, a power-off state, and a networking state, etc. The smart home devices include but are not limited to smart air conditioners, smart lamps, and smart refrigerators, etc.
[0126] Step S202, determining the execution order of multiple test cases in the test case library according to the current device state and the priority weight, so that the smart home device executes the multiple test cases, wherein each test case in the test case library has the preset priority weight.
[0127] Specifically, the priority weight may be pre-set according to the importance or urgency of the plurality of test cases.
[0128] Optionally, according to the current device state and the priority weight, determining the execution order of multiple test cases in the test case library so that the smart home device executes the multiple test cases, including: an adjustment step, adjusting the priority weights of the multiple test cases based on the current device state according to a weight adjustment rule to obtain an adjusted weight of each test case, wherein the weight adjustment rule includes at least one of the following: increasing the priority weight of the test case that can be executed by the smart home device in the current device state, and reducing the priority weight of the test case that cannot be executed by the smart home device in the current device state; determining A step of determining, according to a plurality of the adjusted weights, the test case corresponding to the largest adjusted weight as the target test case, and controlling the smart home device to execute the target test case; an acquisition step of at least acquiring the device state of the smart home device after executing the target test case to obtain the new current device state; a loop step of determining whether there are any unexecuted test cases in the test case library, and if there are any unexecuted test cases in the test case library, looping the acquisition step, the adjustment step and the determination step at least once until there are no unexecuted test cases in the test case library.
[0129] Optionally, the acquisition step includes: acquiring the execution result of the smart home device executing the target test case and the new current device state; performing a snapshot storage on the new current device state to generate snapshot data; and associating the snapshot data, the execution result and the ID information of the target test case and storing them in a snapshot mapping library.
[0130] Optionally, the adjustment step includes: determining whether there is a test case that is executable with the current device state among the multiple test cases based on the current device state; in the case that there is a test case that is executable with the current device state among the multiple test cases, determining that the test case that is executable with the current device state is a preliminary test case; increasing the priority weight corresponding to the preliminary test case by a predetermined step value to obtain the adjusted weight of the preliminary test case; and determining the adjusted weights of the other test cases except the preliminary test case as the corresponding priority weights.
[0131] Optionally, based on multiple adjusted weights, determining the test case corresponding to the largest adjusted weight as the target test case includes: sorting the multiple test cases in descending order of the adjusted weights to obtain a test case sequence; and determining the test case that is first in the test case sequence as the target test case.
[0132] Optionally, after the determination step and before the loop step, the method further includes: marking the target test case in the test case library as an executed case; determining whether there are any unexecuted test cases in the test case library, including: determining whether there are any test cases that are not marked as the executed cases in the test case library, and if there are any test cases that are not marked as the executed cases in the test case library, determining that there are any unexecuted test cases in the test case library.
[0133] Optionally, after determining the execution order of multiple test cases in the test case library according to the current device state so that the smart home device completes execution of the multiple test cases, the method further includes: generating a test report according to the execution results of each test case executed by the smart home device.
[0134] An embodiment of the present invention provides a processor, which is used to run a program, wherein the program executes the testing method of the smart home device when it is running.
[0135] Specifically, the testing methods for smart home devices include:
[0136] Step S201, obtaining the current device status of the smart home device;
[0137] Specifically, the current device state may be the current working state of the smart home device, including but not limited to a power-on state, a power-off state, and a networking state, etc. The smart home devices include but are not limited to smart air conditioners, smart lamps, and smart refrigerators, etc.
[0138] Step S202, determining the execution order of multiple test cases in the test case library according to the current device state and the priority weight, so that the smart home device executes the multiple test cases, wherein each test case in the test case library has the preset priority weight.
[0139] Specifically, the priority weight may be pre-set according to the importance or urgency of the plurality of test cases.
[0140] Optionally, according to the current device state and the priority weight, determining the execution order of multiple test cases in the test case library so that the smart home device executes the multiple test cases, including: an adjustment step, adjusting the priority weights of the multiple test cases based on the current device state according to a weight adjustment rule to obtain an adjusted weight of each test case, wherein the weight adjustment rule includes at least one of the following: increasing the priority weight of the test case that can be executed by the smart home device in the current device state, and reducing the priority weight of the test case that cannot be executed by the smart home device in the current device state; determining A step of determining, according to a plurality of the adjusted weights, the test case corresponding to the largest adjusted weight as the target test case, and controlling the smart home device to execute the target test case; an acquisition step of at least acquiring the device state of the smart home device after executing the target test case to obtain the new current device state; a loop step of determining whether there are any unexecuted test cases in the test case library, and if there are any unexecuted test cases in the test case library, looping the acquisition step, the adjustment step and the determination step at least once until there are no unexecuted test cases in the test case library.
[0141] Optionally, the acquisition step includes: acquiring the execution result of the smart home device executing the target test case and the new current device state; performing a snapshot storage on the new current device state to generate snapshot data; and associating the snapshot data, the execution result and the ID information of the target test case and storing them in a snapshot mapping library.
[0142] Optionally, the adjustment step includes: determining whether there is a test case that is executable with the current device state among the multiple test cases based on the current device state; in the case that there is a test case that is executable with the current device state among the multiple test cases, determining that the test case that is executable with the current device state is a preliminary test case; increasing the priority weight corresponding to the preliminary test case by a predetermined step value to obtain the adjusted weight of the preliminary test case; and determining the adjusted weights of the other test cases except the preliminary test case as the corresponding priority weights.
[0143] Optionally, based on multiple adjusted weights, determining the test case corresponding to the largest adjusted weight as the target test case includes: sorting the multiple test cases in descending order of the adjusted weights to obtain a test case sequence; and determining the test case that is first in the test case sequence as the target test case.
[0144] Optionally, after the determination step and before the loop step, the method further includes: marking the target test case in the test case library as an executed case; determining whether there are any unexecuted test cases in the test case library, including: determining whether there are any test cases that are not marked as the executed cases in the test case library, and if there are any test cases that are not marked as the executed cases in the test case library, determining that there are any unexecuted test cases in the test case library.
[0145] Optionally, after determining the execution order of multiple test cases in the test case library according to the current device state so that the smart home device completes execution of the multiple test cases, the method further includes: generating a test report according to the execution results of each test case executed by the smart home device.
[0146] The present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement at least the following method steps:
[0147] Step S201, obtaining the current device status of the smart home device;
[0148] Specifically, the current device state may be the current working state of the smart home device, including but not limited to a power-on state, a power-off state, and a networking state, etc. The smart home devices include but are not limited to smart air conditioners, smart lamps, and smart refrigerators, etc.
[0149] Step S202, determining the execution order of multiple test cases in the test case library according to the current device state and the priority weight, so that the smart home device executes the multiple test cases, wherein each test case in the test case library has the preset priority weight.
[0150] Specifically, the priority weight may be pre-set according to the importance or urgency of the plurality of test cases.
[0151] Optionally, according to the current device state and the priority weight, determining the execution order of multiple test cases in the test case library so that the smart home device executes the multiple test cases, including: an adjustment step, adjusting the priority weights of the multiple test cases based on the current device state according to a weight adjustment rule to obtain an adjusted weight of each test case, wherein the weight adjustment rule includes at least one of the following: increasing the priority weight of the test case that can be executed by the smart home device in the current device state, and reducing the priority weight of the test case that cannot be executed by the smart home device in the current device state; determining A step of determining, according to a plurality of the adjusted weights, the test case corresponding to the largest adjusted weight as the target test case, and controlling the smart home device to execute the target test case; an acquisition step of at least acquiring the device state of the smart home device after executing the target test case to obtain the new current device state; a loop step of determining whether there are any unexecuted test cases in the test case library, and if there are any unexecuted test cases in the test case library, looping the acquisition step, the adjustment step and the determination step at least once until there are no unexecuted test cases in the test case library.
[0152] Optionally, the acquisition step includes: acquiring the execution result of the smart home device executing the target test case and the new current device state; performing a snapshot storage on the new current device state to generate snapshot data; and associating the snapshot data, the execution result and the ID information of the target test case and storing them in a snapshot mapping library.
[0153] Optionally, the adjustment step includes: determining whether there is a test case that is executable with the current device state among the multiple test cases based on the current device state; in the case that there is a test case that is executable with the current device state among the multiple test cases, determining that the test case that is executable with the current device state is a preliminary test case; increasing the priority weight corresponding to the preliminary test case by a predetermined step value to obtain the adjusted weight of the preliminary test case; and determining the adjusted weights of the other test cases except the preliminary test case as the corresponding priority weights.
[0154] Optionally, based on multiple adjusted weights, determining the test case corresponding to the largest adjusted weight as the target test case includes: sorting the multiple test cases in descending order of the adjusted weights to obtain a test case sequence; and determining the test case that is first in the test case sequence as the target test case.
[0155] Optionally, after the determination step and before the loop step, the method further includes: marking the target test case in the test case library as an executed case; determining whether there are any unexecuted test cases in the test case library, including: determining whether there are any test cases that are not marked as the executed cases in the test case library, and if there are any test cases that are not marked as the executed cases in the test case library, determining that there are any unexecuted test cases in the test case library.
[0156] Optionally, after determining the execution order of multiple test cases in the test case library according to the current device state so that the smart home device completes execution of the multiple test cases, the method further includes: generating a test report according to the execution results of each test case executed by the smart home device.
[0157] The embodiment of the present application also provides an electronic device, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include a method for executing any one of the methods. When the processor executes the program, at least the following steps are implemented:
[0158] Step S201, obtaining the current device status of the smart home device;
[0159] Specifically, the current device state may be the current working state of the smart home device, including but not limited to a power-on state, a power-off state, and a networking state, etc. The smart home devices include but are not limited to smart air conditioners, smart lamps, and smart refrigerators, etc.
[0160] Step S202, determining the execution order of multiple test cases in the test case library according to the current device state and the priority weight, so that the smart home device executes the multiple test cases, wherein each test case in the test case library has the preset priority weight.
[0161] Specifically, the priority weight may be pre-set according to the importance or urgency of the plurality of test cases.
[0162] Optionally, according to the current device state and the priority weight, determining the execution order of multiple test cases in the test case library so that the smart home device executes the multiple test cases, including: an adjustment step, adjusting the priority weights of the multiple test cases based on the current device state according to a weight adjustment rule to obtain an adjusted weight of each test case, wherein the weight adjustment rule includes at least one of the following: increasing the priority weight of the test case that can be executed by the smart home device in the current device state, and reducing the priority weight of the test case that cannot be executed by the smart home device in the current device state; determining A step of determining, according to a plurality of the adjusted weights, the test case corresponding to the largest adjusted weight as the target test case, and controlling the smart home device to execute the target test case; an acquisition step of at least acquiring the device state of the smart home device after executing the target test case to obtain the new current device state; a loop step of determining whether there are any unexecuted test cases in the test case library, and if there are any unexecuted test cases in the test case library, looping the acquisition step, the adjustment step and the determination step at least once until there are no unexecuted test cases in the test case library.
[0163] Optionally, the acquisition step includes: acquiring the execution result of the smart home device executing the target test case and the new current device state; performing a snapshot storage on the new current device state to generate snapshot data; and associating the snapshot data, the execution result and the ID information of the target test case and storing them in a snapshot mapping library.
[0164] Optionally, the adjustment step includes: determining whether there is a test case that is executable with the current device state among the multiple test cases based on the current device state; in the case that there is a test case that is executable with the current device state among the multiple test cases, determining that the test case that is executable with the current device state is a preliminary test case; increasing the priority weight corresponding to the preliminary test case by a predetermined step value to obtain the adjusted weight of the preliminary test case; and determining the adjusted weights of the other test cases except the preliminary test case as the corresponding priority weights.
[0165] Optionally, based on multiple adjusted weights, determining the test case corresponding to the largest adjusted weight as the target test case includes: sorting the multiple test cases in descending order of the adjusted weights to obtain a test case sequence; and determining the test case that is first in the test case sequence as the target test case.
[0166] Optionally, after the determination step and before the loop step, the method further includes: marking the target test case in the test case library as an executed case; determining whether there are any unexecuted test cases in the test case library, including: determining whether there are any test cases that are not marked as the executed cases in the test case library, and if there are any test cases that are not marked as the executed cases in the test case library, determining that there are any unexecuted test cases in the test case library.
[0167] Optionally, after determining the execution order of multiple test cases in the test case library according to the current device state so that the smart home device completes execution of the multiple test cases, the method further includes: generating a test report according to the execution results of each test case executed by the smart home device.
[0168] The devices in this article can be servers, PCs, PADs, mobile phones, etc.
[0169] Obviously, those skilled in the art should understand that the modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0170] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0171] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0172] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0173] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0174] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0175] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0176] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0177] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0178] From the above description, it can be seen that the embodiments described in this application achieve the following technical effects:
[0179] 1) The testing method of the smart home device of the present application first obtains the current device state of the smart home device, and then determines the execution order of the multiple test cases according to the priority weights of the multiple test cases and the current device state, so as to complete the testing of the multiple test cases of the smart home device. The present application sorts the order in which the smart home device executes multiple test cases according to the current device state of the smart home device and the priority weights of the test cases, so as to achieve the effect of dynamically determining the execution order of the test cases according to the current device state of the smart home device, and realizes the flexible sorting of multiple test cases, so that the test cases executed by the smart home device are more matched with the current device state of the smart home device, and the execution success rate of the test cases is ensured to be high, and manual intervention of the test cases that failed to execute is avoided, so that the smart home device can complete the entire test process relatively quickly, thereby ensuring high test efficiency, and solving the problem of inflexible sorting of test cases for smart home devices in the prior art, which affects the test efficiency.
[0180] 2) The testing device for smart home devices of the present application obtains the current device state of the smart home device through an acquisition unit, and determines the execution order of multiple test cases according to the priority weights of multiple test cases and the current device state through a determination unit, so as to complete the testing of multiple test cases of the smart home device. The present application sorts the order in which the smart home device executes multiple test cases according to the current device state of the smart home device and the priority weights of the test cases, achieving the effect of dynamically determining the execution order of the test cases according to the current device state of the smart home device, and realizing flexible sorting of multiple test cases, so that the test cases executed by the smart home device are more matched with the current device state of the smart home device, ensuring a high success rate of the test case execution, avoiding manual intervention in the test cases that failed to execute, and allowing the smart home device to complete the entire test process relatively quickly, thereby ensuring high test efficiency, and solving the problem of inflexible sorting of test cases for smart home devices in the prior art, which affects the test efficiency.
[0181] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A testing method for smart home devices, characterized in that: include: Obtaining the current device status of the smart home device; According to the current device state and the priority weight, the execution order of multiple test cases in the test case library is determined so that the smart home device executes the multiple test cases, wherein each test case in the test case library has the preset priority weight.
2. The method according to claim 1, characterized in that: According to the current device state and the priority weight, determining the execution order of multiple test cases in the test case library so that the smart home device executes the multiple test cases, including: an adjusting step, adjusting the priority weights of the plurality of test cases based on the current device state according to a weight adjustment rule to obtain an adjusted weight of each test case, wherein the weight adjustment rule comprises at least one of the following: increasing the priority weight of the test case executable by the smart home device in the current device state, and decreasing the priority weight of the test case not executable by the smart home device in the current device state; A determination step, determining, based on the plurality of adjusted weights, the test case corresponding to the largest adjusted weight as a target test case, and controlling the smart home device to execute the target test case; An acquisition step, at least acquiring the device state of the smart home device after executing the target test case, to obtain the new current device state; A loop step is used to determine whether there are any unexecuted test cases in the test case library. If there are any unexecuted test cases in the test case library, the obtaining step, the adjusting step and the determining step are looped at least once until there are no unexecuted test cases in the test case library.
3. The method according to claim 2, characterized in that The obtaining step comprises: Obtaining the execution result of the target test case executed by the smart home device and the new current device state; Performing snapshot storage on the new current device state to generate snapshot data; The snapshot data, the execution result and the ID information of the target test case are associated and stored in a snapshot mapping library.
4. The method according to claim 2, characterized in that: The adjustment step comprises: According to the current device state, determining whether there is a test case executable by the current device state among the multiple test cases; In the case that there is a test case executable in the current device state among the multiple test cases, determining the test case executable in the current device state as a preliminary test case; Increasing the priority weight corresponding to the preliminary test case by a predetermined step value to obtain the adjusted weight of the preliminary test case; The adjusted weights of the other test cases except the preliminary test case are determined as the corresponding priority weights.
5. The method according to claim 2, characterized in that: Determining, according to the plurality of adjusted weights, the test case corresponding to the largest adjusted weight as the target test case comprises: Sorting the plurality of test cases in descending order of the adjusted weights to obtain a test case sequence; The test case at the first position in the test case sequence is determined as the target test case.
6. The method according to claim 2, characterized in that: After the determining step and before the looping step, the method further includes: marking the target test case in the test case library as an executed test case; Determining whether there are any unexecuted test cases in the test case library includes: determining whether there are any test cases in the test case library that are not marked as the executed cases, and if there are any test cases in the test case library that are not marked as the executed cases, determining that there are any unexecuted test cases in the test case library.
7. The method according to any one of claims 1 to 6, characterized in that After determining the execution order of multiple test cases in the test case library according to the current device state so that the smart home device completes executing the multiple test cases, the method further includes: Generate a test report based on the execution results of each test case executed by the smart home device.
8. A testing device for smart home equipment, characterized in that: include: An acquiring unit, configured to acquire a current device status of the smart home device; A determination unit is used to determine the execution order of multiple test cases in a test case library according to the current device state, so that the smart home device executes the multiple test cases, wherein the test case library includes multiple test cases, and each test case has a preset priority weight.
9. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include methods for executing any one of claims 1 to 7.
Citation Information
Cited By
Software testing method, system and device
CN120295929A