Automatic testing method and device, storage medium and electronic device

By generating and executing test cases, the problem of relying on manual operation for smart home device binding and unbinding tests has been solved, and an automated testing process has been achieved.

CN121919097APending Publication Date: 2026-04-24HAIER YOUJIA INTELLIGENT TECH (BEIJING) CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HAIER YOUJIA INTELLIGENT TECH (BEIJING) CO LTD
Filing Date
2024-10-22
Publication Date
2026-04-24

AI Technical Summary

Technical Problem

In existing technologies, the binding and unbinding tests of smart home devices rely on manual operation and cannot be automated.

Method used

By generating test cases based on the test information input by the target object, including the test purpose and the identifier of the device under test, test cases are automatically generated and sent to the mobile terminal APP for execution. The execution results are then obtained to determine whether the design requirements are met.

Benefits of technology

It automates the binding and unbinding testing of smart home devices, reducing manual operations and improving testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121919097A_ABST
    Figure CN121919097A_ABST
Patent Text Reader

Abstract

The invention discloses an automatic testing method and device, a storage medium and an electronic device, and relates to the technical field of smart home, the automatic testing method comprises the steps that a test case is generated based on test information input by a target object, and the test information at least comprises a test purpose and an identifier of to-be-tested equipment; the test purpose comprises one of the following steps: binding the to-be-tested equipment with a mobile terminal, and unbinding the to-be-tested equipment with the mobile terminal; the test case is sent to a to-be-tested application APP in the mobile terminal, so that a back-end service of the mobile terminal is indicated to generate test data corresponding to the test case, the APP on the mobile terminal is indicated to execute the test case according to the test data, and the smart home device comprises the to-be-tested device; and obtaining an execution result fed back by the mobile terminal and obtained by executing the test case so as to judge whether the APP meets design requirements or not.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of smart home technology, and more specifically, to an automated testing method and apparatus, storage medium and electronic device. Background Technology

[0002] With the development of smart home technology, applications (APPs) for managing smart home devices are being increasingly widely used. The primary function of these APPs is to bind and unbind smart home devices. However, in current technology, the binding and unbinding testing of smart home devices still largely relies on manual processes, making automated testing impossible.

[0003] There is still no effective solution to the problem that the binding and unbinding of the device under test in related technologies relies on manual operation and cannot be automated.

[0004] Therefore, it is necessary to improve the relevant technology to overcome the aforementioned defects. Summary of the Invention

[0005] This application provides an automated testing method, apparatus, storage medium, and electronic device to at least solve the problem in related technologies where the binding and unbinding of the device under test relies on manual operation and cannot be automated.

[0006] According to one aspect of the embodiments of this application, an automated testing method is provided, comprising: generating test cases based on test information input by a target object, wherein the test information includes at least: a test purpose and an identifier of the device under test; the test purpose includes one of the following: binding the device under test to a mobile terminal, or unbinding the device under test from the mobile terminal; sending the test cases to an application program (APP) under test in the mobile terminal to instruct the backend service of the mobile terminal to generate test data corresponding to the test cases, and instructing the APP on the mobile terminal to execute the test cases according to the test data, wherein the APP is an APP for managing smart home devices, and the smart home devices include the device under test; obtaining the execution result of executing the test cases fed back by the mobile terminal to determine whether the APP meets the design requirements.

[0007] In an exemplary embodiment, generating test cases based on test information input from a target object includes: determining one or more test operations included in the test cases according to the test objective; and encapsulating the test name and the one or more test operations into the test cases.

[0008] In an exemplary embodiment, after generating test cases based on test information input from the target object, the method further includes: setting the number of executions and the start execution time of the test cases; if the number M of execution results received at the end execution time satisfies the number of executions, determining the execution success rate of the test cases through the M execution results, where M is a positive integer, the end execution time is determined by the number of executions and the start execution time, and the execution result includes one of the following: execution success or execution failure.

[0009] In an exemplary embodiment, after setting the number of executions and the start execution time of the test case, the method further includes: if the number M of execution results received at the execution end time does not meet the number of executions, an alarm event is executed, wherein the alarm event is used to indicate to the target object that the execution result of the test case is missing.

[0010] In an exemplary embodiment, instructing the APP on the mobile terminal to execute the test cases based on the test data includes: instructing the mobile terminal to send the test data generated by the backend service to the APP; instructing the APP to schedule N second interfaces in the software tool package of the APP based on the received test data to obtain N return data, wherein the test cases include: N first interfaces; the N first interfaces correspond one-to-one with the N second interfaces, and the test data is generated through the N first interfaces, where N is a positive integer.

[0011] In an exemplary embodiment, after instructing the APP to schedule N second interfaces in the software tool package of the APP according to the received test data, the method further includes: instructing the APP to feed back the N returned data to the backend service; and instructing the backend service to determine the execution result of the test case according to the N returned data.

[0012] In an exemplary embodiment, instructing the backend service to determine the execution result of the test case based on the N returned data includes: instructing the backend service to determine W test operations corresponding to the N returned data, wherein the test case includes W test operations; the W test operations include the N first interfaces; instructing the backend service to determine the target returned data corresponding to each test operation in the N returned data, and to determine whether the code value included in the target returned data is a preset value; instructing the backend service to determine that each test operation is executed successfully if the code value is determined to be a preset value; and instructing the backend service to determine that the execution result of the test case is successful if all W test operations are determined to be successful.

[0013] According to another aspect of the embodiments of this application, an automated testing apparatus is also provided, comprising: a generation module, configured to generate test cases based on test information input by a target object, wherein the test information includes at least: a test objective and an identifier of the device under test; the test objective includes one of the following: binding the device under test to a mobile terminal, or unbinding the device under test from the mobile terminal; a sending module, configured to send the test cases to an application program (APP) under test on the mobile terminal, to instruct the backend service of the mobile terminal to generate test data corresponding to the test cases, and to instruct the APP on the mobile terminal to execute the test cases according to the test data, wherein the APP is an APP for managing smart home devices, and the smart home devices include the device under test; and an acquisition module, configured to acquire the execution results obtained by executing the test cases fed back by the mobile terminal, to determine whether the APP meets the design requirements.

[0014] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, which is configured to execute the above-described automated testing method at runtime.

[0015] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the automated testing method described above through the computer program.

[0016] According to another aspect of the embodiments of this application, a computer program product is also provided, including a computer program that, when executed by a processor, implements the above-described method for automated testing.

[0017] This application generates test cases based on test information input by the target object. The test information includes at least: a test objective and an identifier of the device under test (DUT). The test objective includes one of the following: binding the DUT to a mobile terminal, or unbinding the DUT from the mobile terminal. The test cases are sent to the application program (APP) under test on the mobile terminal to instruct the backend service of the mobile terminal to generate test data corresponding to the test cases, and to instruct the APP on the mobile terminal to execute the test cases according to the test data. The APP is used to manage smart home devices, including the DUT. The execution result obtained from executing the test cases is received from the mobile terminal to determine whether the APP meets the design requirements. In other words, after generating test cases based on the test information input by the target object, the test cases are sent to the mobile terminal for execution, and finally, the execution result is received from the mobile terminal. This allows for automated generation, execution, and result acquisition simply by receiving the test information input by the target object. Therefore, by adopting the above technical solution, the problem that the binding and unbinding tests of the device under test in related technologies rely on manual operation and cannot be automated is solved; the goal of automating the binding and unbinding tests of the device under test is achieved. Attached Figure Description

[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0019] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 This is a schematic diagram of the hardware environment for an optional automated testing method according to an embodiment of this application;

[0021] Figure 2 This is a flowchart of an optional automated testing method according to an embodiment of this application;

[0022] Figure 3 This is a schematic diagram illustrating the editing of test cases according to embodiments of this application;

[0023] Figure 4 This is a schematic diagram of the AW interface according to an embodiment of this application;

[0024] Figure 5This is a schematic diagram of the editing AW according to an embodiment of this application (I);

[0025] Figure 6 This is a schematic diagram illustrating the editing of test case information according to an embodiment of this application;

[0026] Figure 7 This is a schematic diagram (II) of the editing AW according to an embodiment of this application;

[0027] Figure 8 This is a schematic diagram of the editing interface data according to an embodiment of this application;

[0028] Figure 9 This is a schematic diagram of a post-operation according to an embodiment of this application;

[0029] Figure 10 This is a schematic diagram of the returned data according to an embodiment of this application;

[0030] Figure 11 This is a schematic diagram comparing assertions according to embodiments of this application;

[0031] Figure 12 This is a structural block diagram of an optional automated testing apparatus according to an embodiment of this application. Detailed Implementation

[0032] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0033] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0034] According to one aspect of the embodiments of this application, an automated testing method is provided. This automated testing method is widely applicable to whole-house intelligent digital control application scenarios such as smart homes, smart home ecosystems, and intelligencehouse ecosystems. Optionally, in this embodiment, the above-mentioned automated testing method can be applied to, for example... Figure 1 The hardware environment shown consists of multiple terminal devices 102 and a server 104. For example... Figure 1 As shown, server 104 is connected to multiple terminal devices 102 via a network and can be used to provide services (such as application services) to terminals or clients installed on terminals. A database can be set up on the server or independently of the server to provide data storage services for server 104. Cloud computing and / or edge computing services can be configured on the server or independently of the server to provide data processing services for server 104.

[0035] The aforementioned network may include, but is not limited to, at least one of the following: wired network, wireless network. The aforementioned wired network may include, but is not limited to, at least one of the following: wide area network, metropolitan area network, local area network. The aforementioned wireless network may include, but is not limited to, at least one of the following: Wi-Fi (Wireless Fidelity), Bluetooth. The terminal device 102 may not be limited to PC, mobile phone, tablet computer, smart air conditioner, smart range hood, smart refrigerator, smart oven, smart stove, smart washing machine, smart water heater, smart washing equipment, smart dishwasher, smart projector, smart TV, smart clothes rack, smart curtains, smart audio-visual equipment, smart socket, smart speaker, smart speaker box, smart fresh air equipment, smart kitchen and bathroom equipment, smart bathroom equipment, smart robot vacuum cleaner, smart window cleaning robot, smart mopping robot, smart air purifier, smart steam oven, smart microwave oven, smart water heater, smart air purifier, smart water dispenser, smart door lock, etc.

[0036] This embodiment provides a method for automated testing, including but not limited to those applied to deployments such as... Figure 1 The automated testing platform in the hardware environment shown. Figure 2 This is a flowchart of an automated testing method according to an embodiment of this application, the process including the following steps:

[0037] Step S202: Generate test cases based on the test information input by the target object, wherein the test information includes at least: test purpose and identifier of the device under test; the test purpose includes one of the following: binding the device under test to the mobile terminal, or unbinding the device under test from the mobile terminal;

[0038] Step S204: Send the test case to the application APP to be tested in the mobile terminal, so as to instruct the backend service of the mobile terminal to generate test data corresponding to the test case, and instruct the APP on the mobile terminal to execute the test case according to the test data, wherein the APP is an APP for managing smart home devices, and the smart home devices include the device under test;

[0039] Optionally, the device under test can be a physical device or a virtual device. If the device under test is a virtual device, the automated testing platform is also connected to a virtual device platform, which is used to simulate the virtual device.

[0040] Step S206: Obtain the execution result of the test case from the mobile terminal to determine whether the APP meets the design requirements.

[0041] Optionally, if the execution result indicates that the APP passes the test, it is determined that the APP meets the design requirements; if the execution result indicates that the APP fails the test, it is determined that the APP does not meet the design requirements.

[0042] Through the above steps, test cases are generated based on the test information input by the target object. The test information includes at least: the test objective and the identifier of the device under test (DUT). The test objective includes one of the following: binding the DUT to a mobile terminal, or unbinding the DUT from the mobile terminal. The test cases are sent to the application program (APP) under test on the mobile terminal to instruct the backend service of the mobile terminal to generate test data corresponding to the test cases, and to instruct the APP on the mobile terminal to execute the test cases according to the test data. The APP is used to manage smart home devices, including the DUT. The execution result obtained from executing the test cases is obtained from the mobile terminal to determine whether the APP meets the design requirements. In other words, after generating test cases based on the test information input by the target object, the test cases are sent to the mobile terminal for execution, and finally, the execution result is received from the mobile terminal. This allows for automated generation, execution, and result acquisition simply by receiving the test information input by the target object. Therefore, by adopting the above technical solution, the problem that the binding and unbinding tests of the device under test in related technologies rely on manual operation and cannot be automated is solved; the goal of automating the binding and unbinding tests of the device under test is achieved.

[0043] In an exemplary embodiment, generating test cases based on test information input from a target object includes: determining one or more test operations included in the test cases according to the test objective; and encapsulating the test name and the one or more test operations into the test cases.

[0044] More specifically, the test name of the test case is determined based on the identifier and the test purpose; one or more test operations included in the test case are determined based on the test purpose; and the test name and the one or more test operations are encapsulated into the test case.

[0045] The solution provided in this application allows for coverage of the entire testing process for binding or unbinding smart home devices. In the initial testing phase, test cases can be automatically generated based solely on the test information input by the target device. Specifically, the test case name can be generated based on the identifier of the device under test and the testing objective. For example, if the identifier indicates that the device under test is a speaker, and the testing objective is to bind the smart speaker to a mobile device with an installed app, then a test case name of "Successfully configured and bound speaker device via Bluetooth" can be generated by combining a preset binding method, such as Bluetooth binding.

[0046] Understandably, test cases for binding or unbinding smart home devices typically include multiple similar Action Words (AWs). In this case, the automated testing platform can choose to call a pre-edited test case template and fill in the personalized data for binding the speaker device. Alternatively, the multiple specific actions included in the test cases can be re-edited. Each specific action includes multiple fixed first interfaces.

[0047] In an exemplary embodiment, after generating test cases based on test information input from the target object, the method further includes: setting the number of executions and the start execution time of the test cases; if the number M of execution results received at the end execution time satisfies the number of executions, determining the execution success rate of the test cases through the M execution results, where M is a positive integer, the end execution time is determined by the number of executions and the start execution time, and the execution result includes one of the following: execution success or execution failure.

[0048] In an exemplary embodiment, after setting the number of executions and the start execution time of the test case, the method further includes: if the number M of execution results received at the execution end time does not meet the number of executions, an alarm event is executed, wherein the alarm event is used to indicate to the target object that the execution result of the test case is missing.

[0049] Optionally, after the test cases are successfully generated but before being sent to the mobile terminal for execution, the number of executions and the start execution time of the test cases can be set. If the time required to execute each test case is within a fixed range, the execution end time of the test cases can be determined based on the number of executions and the start execution time. Optionally, to avoid false positives, the execution end time can be calculated as follows: determine the product of the maximum value within the fixed range and the number of executions, add this product to the start execution time, and the result is the execution end time.

[0050] Then, after the execution end time, if the number of received execution results meets the execution count, the execution success rate is calculated; otherwise, an alarm is triggered. Optionally, before triggering an alarm event, a query message can be sent to the terminal device to determine whether the terminal device has already reported the execution count and execution results.

[0051] In an exemplary embodiment, instructing the APP on the mobile terminal to execute the test cases based on the test data includes: instructing the mobile terminal to send the test data generated by the backend service to the APP; instructing the APP to schedule N second interfaces in the software tool package of the APP based on the received test data to obtain N return data, wherein the test cases include: N first interfaces; the N first interfaces correspond one-to-one with the N second interfaces, and the test data is generated through the N first interfaces, where N is a positive integer.

[0052] After the automated testing platform sends test cases to the mobile terminal, the mobile terminal's backend service generates test data corresponding to the test cases based on the N first interfaces included in the test cases. The test data is used to schedule the second interfaces corresponding to the N first interfaces, resulting in N return data. In this embodiment, the Software Development Kit (SDK) exists alongside the APP, providing interfaces for APP development. Furthermore, the APP exposes external interfaces; the backend service calls these external interfaces and then uses Java's reflection mechanism to call the second interfaces, which can be understood as a kind of intermediary service.

[0053] In an exemplary embodiment, after instructing the APP to schedule N second interfaces in the software tool package of the APP according to the received test data, the method further includes: instructing the APP to feed back the N returned data to the backend service; and instructing the backend service to determine the execution result of the test case according to the N returned data.

[0054] The method of instructing the backend service to determine the execution result of the test case based on the N returned data includes: instructing the backend service to determine the W test operations corresponding to the N returned data, wherein the test case includes: W test operations; the W test operations include: the N first interfaces; instructing the backend service to determine the target returned data corresponding to each test operation in the N returned data, and to determine whether the code value included in the target returned data is a preset value; instructing the backend service to determine that each test operation is executed successfully if the code value is determined to be a preset value; and instructing the backend service to determine that the execution result of the test case is successful if all W test operations are determined to be successful.

[0055] Understandably, a test case includes W test operations (W), and each test operation includes multiple first interfaces, but the number of first interfaces included in each test operation may not be consistent. Therefore, for each test operation, the target return data corresponding to each test operation is determined from N return data. If the code value is determined to be a preset value, then each test operation is considered to have executed successfully. Optionally, the preset value can be set to 0.

[0056] Obviously, the embodiments described above are only some embodiments of this application, and not all embodiments. To better understand the above-described automated testing method, the process is explained below with reference to embodiments, but this is not intended to limit the technical solutions of the embodiments of this application. Specifically:

[0057] This application provides an automated testing platform for unified management of mobile devices. Relying on the core SDK in an app used to manage smart home devices, it enables online pairing and unpairing tests of smart home devices. Furthermore, the automated testing platform connects to a virtual device platform (used to generate virtual devices), allowing for testing of pairing and unpairing operations between mobile devices and virtual devices, thereby saving testing resources.

[0058] Specifically, in this embodiment, the SDK relies on the APP, providing a usable interface for APP development. The APP also exposes external interfaces, serving as an intermediary service (an automated testing platform as the medium) for specific API calls within the SDK. Testers (i.e., the target audience) can freely combine interfaces to create necessary test cases through the web-based automated testing platform and execute them in the background. Specifically, the interface data to be tested is passed to the backend service. The backend service then transforms the data to call the interfaces provided by the APP, and then uses Java reflection to call the SDK interfaces. Different combinations of SDK interfaces are used to implement the binding (i.e., pairing) and unbinding test processes for mobile devices and smart devices.

[0059] Specifically, the process for automating the binding or unbinding of smart home devices is as follows:

[0060] Step 1: Edit the test cases you need to use in the automated testing platform.

[0061] The test cases consist of multiple Action Analyses (AWs), which can be freely combined to achieve the desired testing effects. Each AW comprises multiple interfaces (i.e., the first interface), which are actually the interfaces provided by the SDK (second interfaces). Testers can freely combine these interfaces according to the SDK documentation provided by the developers to achieve the required test steps, such as... Figure 3 As shown. Among them, as Figure 4 As shown, the automated testing platform in this application embodiment includes a large number of Auditions (AWs), which are pre-edited by testers and stored in the automated testing platform, specifically as follows: Figure 5 As shown.

[0062] Optionally, step 1 above can be implemented through the following steps:

[0063] Step 11: Edit the use case information, such as... Figure 6 As shown. That is, each step in the execution of the edit test case is called an AW (Executable Action).

[0064] Step 12: Edit AW, such as Figure 7 As shown, each AW consists of multiple interfaces. Optionally, the AW can be pre-edited or edited in real time during use.

[0065] Step 13: Edit the data required for the interface, populating the data needed for each interface, such as... Figure 8 As shown.

[0066] Step 14: Set the number of times AW is executed and add assertion rules for test cases, such as... Figure 9 As shown.

[0067] Step 4: After the test cases are created on the web client (i.e., the automated testing platform), the task distribution platform in the automated testing platform will execute the task (i.e., the test cases) and set the number of times the task will be executed and the start time.

[0068] Step 5: After receiving the task, the task execution platform in the automated testing platform sends the task to the backend service.

[0069] Step 6: The backend service generates the test data required for scheduling the APP interface based on the test cases issued by the task center (task execution platform).

[0070] Step 7: The APP uses the received test data to schedule the SDK interface (i.e., the second interface).

[0071] Step 8: The APP returns the data from the SDK interface to the backend service.

[0072] Step 9: The backend service determines whether the received data is returned from the SDK interface and saves it to the database.

[0073] Step 10: Determine whether the test case was executed successfully or failed based on the data returned by the SDK interface, and then return the result to the task center.

[0074] Specifically, the returned result is as follows: Figure 10 As shown. After obtaining the return result of each AW, an assertion is performed. If the returned code is 0, it indicates that the AW executed successfully; otherwise, it indicates that the AW failed. Based on the execution result of the AW, the return result of the test case is determined. The return result of the test case is compared with the assertion rules of the test case, as shown. Figure 11 As shown, if the assertion result passes, it means that the entire test case has passed; otherwise, it means that the test case has failed.

[0075] Step 11: The task center returns the test case execution results to the front end for display.

[0076] Step 12: The entire SDK interface testing process is now complete.

[0077] Therefore, with the aforementioned automated testing platform, a test environment can be set up with only a mobile terminal and a Wi-Fi module. It enables intelligent setup of the test environment, intelligent management of mobile devices, and automated testing of the entire pairing process.

[0078] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.

[0079] This embodiment also provides an automated testing apparatus for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0080] Figure 12 This is a structural block diagram of an optional automated testing apparatus according to an embodiment of this application, the apparatus comprising:

[0081] The generation module 1202 is used to generate test cases based on the test information input by the target object, wherein the test information includes at least: test purpose and identifier of the device under test; the test purpose includes one of the following: binding the device under test to the mobile terminal, or unbinding the device under test from the mobile terminal;

[0082] The sending module 1204 is used to send the test cases to the application APP to be tested in the mobile terminal, so as to instruct the backend service of the mobile terminal to generate test data corresponding to the test cases, and to instruct the APP on the mobile terminal to execute the test cases according to the test data, wherein the APP is an APP for managing smart home devices, and the smart home devices include the device to be tested;

[0083] The acquisition module 1206 is used to acquire the execution results of the test cases fed back by the mobile terminal, so as to determine whether the APP meets the design requirements.

[0084] Using the aforementioned device, test cases are generated based on test information input by the target object. The test information includes at least: a test objective and an identifier of the device under test (DUT). The test objective includes one of the following: binding the DUT to a mobile terminal, or unbinding the DUT from the mobile terminal. The test cases are sent to the application program (APP) under test on the mobile terminal to instruct the backend service of the mobile terminal to generate test data corresponding to the test cases, and to instruct the APP on the mobile terminal to execute the test cases based on the test data. The APP is used to manage smart home devices, including the DUT. The execution result obtained from executing the test cases is received from the mobile terminal to determine whether the APP meets the design requirements. In other words, after generating test cases based on the test information input by the target object, the test cases are sent to the mobile terminal for execution, and finally, the execution result is received from the mobile terminal. This allows for automated generation, execution, and result acquisition simply by receiving the test information input by the target object. Therefore, by adopting the above technical solution, the problem that the binding and unbinding tests of the device under test in related technologies rely on manual operation and cannot be automated is solved; the goal of automating the binding and unbinding tests of the device under test is achieved.

[0085] In an exemplary embodiment, the generation module 1202 is further configured to: determine one or more test operations included in the test case according to the test objective; and encapsulate the test name and the one or more test operations into the test case.

[0086] In an exemplary embodiment, the device further includes a setting module, configured to: set the number of executions and the start execution time of the test case; and determine the execution success rate of the test case based on the number M of execution results received at the execution end time, provided that the number of executions is satisfied; wherein M is a positive integer; the execution end time is determined by the number of executions and the start execution time; and the execution result includes one of the following: execution success or execution failure.

[0087] In an exemplary embodiment, the apparatus further includes an alarm module, configured to: execute an alarm event if the number M of execution results received at the execution end time does not meet the execution count, wherein the alarm event is used to indicate to the target object that the execution result of the test case is missing.

[0088] In an exemplary embodiment, the sending module 1204 is further configured to: instruct the mobile terminal to send the test data generated by the backend service to the APP; instruct the APP to schedule N second interfaces in the software tool package of the APP according to the received test data to obtain N return data, wherein the test case includes: N first interfaces; the N first interfaces correspond one-to-one with the N second interfaces, and the test data is generated through the N first interfaces, where N is a positive integer.

[0089] In an exemplary embodiment, the sending module 1204 is further configured to: instruct the APP to send the N returned data back to the backend service; and instruct the backend service to determine the execution result of the test case based on the N returned data.

[0090] In an exemplary embodiment, the sending module 1204 is further configured to: instruct the backend service to determine W test operations corresponding to the N returned data, wherein the test cases include: W test operations; the W test operations include: the N first interfaces; instruct the backend service to determine the target returned data corresponding to each test operation in the N returned data, and determine whether the code value included in the target returned data is a preset value; instruct the backend service to determine that each test operation is executed successfully if the code value is determined to be a preset value; and instruct the backend service to determine that the execution result of the test cases is successful if all W test operations are executed successfully.

[0091] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when run.

[0092] Optionally, in this embodiment, the storage medium may be configured to store a computer program for performing the following steps:

[0093] S1, Generate test cases based on the test information input by the target object, wherein the test information includes at least: test purpose and identifier of the device under test; the test purpose includes one of the following: binding the device under test to the mobile terminal, or unbinding the device under test from the mobile terminal;

[0094] S2, the test cases are sent to the application under test (APP) on the mobile terminal to instruct the backend service of the mobile terminal to generate test data corresponding to the test cases, and to instruct the APP on the mobile terminal to execute the test cases according to the test data, wherein the APP is an APP for managing smart home devices, and the smart home devices include the device under test;

[0095] S3, obtain the execution result of the test case from the mobile terminal to determine whether the APP meets the design requirements.

[0096] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.

[0097] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0098] Embodiments of this application also provide an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.

[0099] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:

[0100] S1, Generate test cases based on the test information input by the target object, wherein the test information includes at least: test purpose and identifier of the device under test; the test purpose includes one of the following: binding the device under test to the mobile terminal, or unbinding the device under test from the mobile terminal;

[0101] S2, the test cases are sent to the application under test (APP) on the mobile terminal to instruct the backend service of the mobile terminal to generate test data corresponding to the test cases, and to instruct the APP on the mobile terminal to execute the test cases according to the test data, wherein the APP is an APP for managing smart home devices, and the smart home devices include the device under test;

[0102] S3, obtain the execution result of the test case from the mobile terminal to determine whether the APP meets the design requirements.

[0103] In one exemplary embodiment, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.

[0104] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above method embodiments.

[0105] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps in any of the above method embodiments.

[0106] Embodiments of this application also provide a computer program that includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps in any of the above method embodiments.

[0107] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.

[0108] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. They can be implemented using computer-executable program code, and thus can be stored in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.

[0109] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.

Claims

1. A method for automated testing, characterized in that, include: Test cases are generated based on test information input from the target object, wherein the test information includes at least: test purpose and identifier of the device under test; the test purpose includes one of the following: binding the device under test to the mobile terminal, or unbinding the device under test from the mobile terminal; The test cases are sent to the application under test (APP) on the mobile terminal to instruct the backend service of the mobile terminal to generate test data corresponding to the test cases, and to instruct the APP on the mobile terminal to execute the test cases according to the test data. The APP is an APP for managing smart home devices, and the smart home devices include the device under test. The execution results of the test cases are obtained from the mobile terminal to determine whether the APP meets the design requirements.

2. The automated testing method according to claim 1, characterized in that, Test cases are generated based on the test information input from the target object, including: Determine one or more test operations included in the test cases based on the test objective; The one or more test operations are encapsulated into the test cases.

3. The automated testing method according to claim 1, characterized in that, After generating test cases based on the test information input from the target object, the method further includes: Set the number of times the test case can be executed and the start time of execution; If the number M of execution results received at the execution end time meets the execution count, the execution success rate of the test case is determined by the M execution results, where M is a positive integer, the execution end time is determined by the execution count and the execution start time, and the execution result includes one of the following: execution success or execution failure.

4. The automated testing method according to claim 3, characterized in that, After setting the number of executions and the start time of the test case, the method further includes: If the number M of execution results received at the end of execution does not meet the required number of executions, an alarm event is triggered, wherein the alarm event is used to indicate that the execution result of the test case is missing for the target object.

5. The automated testing method according to claim 1, characterized in that, Instructing the APP on the mobile terminal to execute the test cases based on the test data includes: The mobile terminal is instructed to send the test data generated by the backend service to the APP. The APP is instructed to schedule N second interfaces in the software tool package of the APP according to the received test data to obtain N return data. The test case includes N first interfaces; the N first interfaces correspond one-to-one with the N second interfaces, and the test data is generated through the N first interfaces, where N is a positive integer.

6. The automated testing method according to claim 5, characterized in that, After instructing the APP to schedule N second interfaces in the software tool unpacking package within the APP based on the received test data, the method further includes: The app is instructed to send the N returned data back to the backend service; The backend service is instructed to determine the execution result of the test case based on the N returned data.

7. The automated testing method according to claim 6, characterized in that, Instructing the backend service to determine the execution result of the test case based on the N returned data includes: The backend service is instructed to determine W test operations corresponding to the N returned data, wherein the test cases include: W test operations; the W test operations include: the N first interfaces; The backend service is instructed to determine the target return data corresponding to each test operation in the N return data, and to determine whether the code value included in the target return data is a preset value; The backend service is instructed to determine that each test operation was successfully executed if the code value is a preset value. The backend service is instructed to determine the execution result of the test case as successful if all W test operations are executed successfully.

8. An automated testing apparatus, characterized in that, include: The generation module is used to generate test cases based on the test information input by the target object, wherein the test information includes at least: test purpose and identifier of the device under test; the test purpose includes one of the following: binding the device under test to the mobile terminal, or unbinding the device under test from the mobile terminal; The sending module is used to send the test cases to the application under test (APP) in the mobile terminal, so as to instruct the backend service of the mobile terminal to generate test data corresponding to the test cases, and to instruct the APP on the mobile terminal to execute the test cases according to the test data, wherein the APP is an APP for managing smart home devices, and the smart home devices include the device under test; The acquisition module is used to acquire the execution results of the test cases fed back by the mobile terminal, so as to determine whether the APP meets the design requirements.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method of any one of claims 1 to 7.

10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method of any one of claims 1 to 7 through the computer program.