A testing method and system for cloud and APP in smart home field

By building test programs and configuration files in the field of smart home, simulated testing of smart devices is realized, and the problems of APP and cloud regression testing in the field of smart home are solved, the testing process is simplified, the project cycle is shortened, and the maintenance is reduced.

CN114398274BActive Publication Date: 2024-12-20杭州觅恒科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210039093.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-13
Publication Date
2024-12-20
Estimated Expiration
2042-01-13

AI Technical Summary

Technical Problem

In the field of smart homes, the existing technology lacks effective solutions to conduct APP and cloud regression testing of a large number of devices, resulting in difficult, time-consuming and labor-intensive testing, and slow development of smart devices, resulting in project delays.

Method used

By setting up a test program in the terminal, configuring the configuration file of the simulated smart device, inputting the device model and version, the startup interface is bound to the cloud and APP, generating simulated data, using MQTT messages for data transmission, providing WiFi hotspots for connection, using yaml Store configuration files to simplify the testing process.

Benefits of technology

It realizes fast and realistic simulated equipment testing, reduces dependence on smart device development, intervenes in project testing in advance, shortens the project launch cycle, reduces the difficulty of use and maintenance of testers, and improves scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114398274B_ABST
    Figure CN114398274B_ABST
Patent Text Reader

Abstract

The present invention discloses a test method and system for the cloud and APP in the field of smart home, which belongs to the field of testing technology, including building a test program on a terminal, configuring a configuration file for each simulated smart device in the test program; inputting the model and version of the smart device to be simulated, matching the configuration file; starting the corresponding interface, binding the interface with the cloud and the APP; the APP sends a message of the corresponding type to the cloud, and the cloud forwards the message to the corresponding interface in the test program; according to the message, the interface corresponds to the configuration file to generate simulation data corresponding to the interface; and the simulation data is sent to the APP through the cloud. The present invention can quickly and realistically simulate a large number of devices through the test program, solves the pain points of regression testing of a large number of smart device models and versions in the APP and the cloud in the field of the Internet of Things, no longer relies on the development progress of smart devices, so that the test can intervene in the project test in advance, discover software defects in advance, and shorten the project launch cycle.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of testing technology, and in particular to a method and system for testing a cloud and an APP in the field of smart homes. Background Art

[0002] The smart home field is currently developing rapidly, with a wide variety of product types and versions. The existing technology does not have a solution for regression testing of a large number of device apps and cloud-based tests in the smart home field. Based on this environment, it is difficult for testers to conduct regression testing of all devices, which consumes a lot of manpower and material resources.

[0003] Testers first need to find the corresponding smart product. After finding the smart device, they also need to confirm the product version. It takes a certain amount of time to find the corresponding product. After finding the smart device, they also need to confirm that the device is in AP mode. Then use the mobile phone to connect to the AP of the smart device to form a local area network. The mobile phone sends the SSID and password of the router to the smart device. In the meantime, network instability and other problems may occur. Network configuration failure consumes a lot of time. If an abnormality occurs during the test device, the test device needs to be damaged to access the serial port to view the log, which consumes time and test costs, but the actual test content may have nothing to do with the smart device.

[0004] From a project perspective, the development of smart devices is slower than that of apps and the cloud. It is common for apps and the cloud to wait for the development of smart devices, making it impossible for testers to intervene in testing in a timely manner, ultimately leading to project delays. Summary of the invention

[0005] In view of the shortcomings of the above problems, the present invention provides a method and system for testing the cloud and APP in the field of smart home, the method comprising:

[0006] Building a test program on the terminal, wherein the test program is configured with a configuration file for each simulated smart device;

[0007] Enter the model and version of the smart device to be simulated in the test program, and match the corresponding configuration file;

[0008] Start the interface corresponding to the configuration file, and bind the interface to the cloud and the APP;

[0009] After the binding is successful, the APP sends the corresponding type of mqtt message to the cloud mqtt server, and the cloud mqtt server forwards the mqtt message to the corresponding interface in the test program;

[0010] According to the mqtt message, the interface generates simulation data corresponding to the interface corresponding to the configuration file;

[0011] Send the simulation data to the APP through the cloud mqtt server;

[0012] The step of binding the interface with the cloud and the APP includes:

[0013] The terminal provides a WiFi hotspot, the APP connects to the WiFi hotspot and sends corresponding parameters through the interface, and the parameters are written into the corresponding configuration file;

[0014] The test program sends corresponding parameters based on the APP and connects to the corresponding cloud mqtt server;

[0015] After the connection is successful, the test program sends a binding success message to the cloud MQTT server, and the cloud MQTT server forwards it to the APP;

[0016] The APP shows that the binding is successful.

[0017] Preferably, the configuration file is stored via yaml, and the configuration file includes the mac, uuid, model and version of the simulated smart device.

[0018] Preferably, the APP connects to the WiFi hotspot including:

[0019] The APP's request is forwarded to the terminal via an http packet capture proxy tool.

[0020] Preferably, the APP connects to the WiFi hotspot and sends corresponding parameters through the interface, and the parameters are written into the corresponding configuration file including:

[0021] The APP sends a

[0022] request.json['header']['namespace']=='Appliance.System.All'andrequest.json['header']['method']=='GET'request to obtain all constant configurations of the simulated smart device;

[0023] The simulated smart device judges the request, and if the namespace and method of the request are correct, returns the constant parameters configured in the simulated smart device to the APP;

[0024] After the APP receives the corresponding parameters, it sends

[0025] request.json['header']['namespace']=='Appliance.Config.Key'andrequest.json['header']['method']=='SET'Request to obtain the user ID, key and cloud address information of the simulated smart device to be connected;

[0026] The simulated smart device judges the request. If the namespace and method of the request are correct, the simulated smart device writes the request sent by the APP into the configuration file. After the writing is successful, the simulated smart device sends a success message to the APP.

[0027] Preferably, the test program sends corresponding parameters based on the APP, and the connection to the corresponding cloud mqtt server includes:

[0028] When the APP sends

[0029] namespace=Appliance.Config.WifiX and request.json['header']['method']=='SET' request, the simulated smart device connects to the cloud mqtt server through the user id, key and cloud address information to be connected.

[0030] The present invention also provides a cloud and APP testing system in the field of smart home, comprising:

[0031] A building module is used to build a test program on the terminal, wherein the test program is configured with a configuration file for each simulated smart device;

[0032] An input module, used to input the model and version of the intelligent device to be simulated in the test program, and match the corresponding configuration file;

[0033] A binding module is used to start the interface corresponding to the configuration file and bind the interface to the cloud and the APP;

[0034] The test module is used for sending the corresponding type of mqtt message to the cloud mqtt server after the binding is successful, and the cloud mqtt server forwards the mqtt message to the corresponding interface in the test program;

[0035] A simulation module, used for generating simulation data corresponding to the interface according to the mqtt message and the configuration file corresponding to the interface;

[0036] A transmission module, used for sending the simulation data to the APP through the cloud MQTT server;

[0037] The step of binding the interface with the cloud and the APP includes:

[0038] The terminal provides a WiFi hotspot, the APP connects to the WiFi hotspot and sends corresponding parameters through the interface, and the parameters are written into the corresponding configuration file;

[0039] The test program sends corresponding parameters based on the APP and connects to the corresponding cloud mqtt server;

[0040] After the connection is successful, the test program sends a binding success message to the cloud MQTT server, and the cloud MQTT server forwards it to the APP;

[0041] The APP shows that the binding is successful.

[0042] Preferably, the configuration file is stored via yaml, and the configuration file includes the mac, uuid, model and version of the simulated smart device.

[0043] Preferably, the APP connects to the WiFi hotspot including:

[0044] The APP's request is forwarded to the terminal via an http packet capture proxy tool.

[0045] Preferably, the APP connects to the WiFi hotspot and sends corresponding parameters through the interface, and the parameters are written into the corresponding configuration file including:

[0046] The APP sends a

[0047] request.json['header']['namespace']=='Appliance.System.All'andrequest.json['header']['method']=='GET'request to obtain all constant configurations of the simulated smart device;

[0048] The simulated smart device judges the request, and if the namespace and method of the request are correct, returns the constant parameters configured in the simulated smart device to the APP;

[0049] After the APP receives the corresponding parameters, it sends

[0050] request.json['header']['namespace']=='Appliance.Config.Key'and

[0051] request.json['header']['method'] == 'SET' request to obtain the user ID, key and cloud address information to be connected of the simulated smart device;

[0052] The simulated smart device judges the request. If the namespace and method of the request are correct, the simulated smart device writes the request sent by the APP into the configuration file. After the writing is successful, the simulated smart device sends a success message to the APP.

[0053] Preferably, the test program sends corresponding parameters based on the APP, and the connection to the corresponding cloud mqtt server includes:

[0054] When the APP sends

[0055] namespace=Appliance.Config.WifiX and request.json['header']['method']=='SET' request, the simulated smart device connects to the cloud mqtt server through the user id, key and cloud address information to be connected.

[0056] Compared with the prior art, the present invention has the following beneficial effects:

[0057] The present invention can simulate a large number of devices quickly and realistically through the test program, solves the pain points of regression testing of a large number of smart device models and versions in the APP field and the cloud, and no longer relies on the development progress of smart devices, so that testing can intervene in project testing in advance, discover software defects in advance, and shorten the project launch cycle; the test program is easy to deploy and maintain, and only one yaml configuration file needs to be maintained to generate smart devices of different versions and types. Therefore, it is easy for testers to use and maintain it, and it has strong scalability. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 The figure is a flow chart of the testing method of the cloud and APP in the field of smart home of the present invention. DETAILED DESCRIPTION

[0059] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0060] The following is combined with Figure 1 The present invention is described in further detail:

[0061] like Figure 1 As shown, the present invention provides a method for testing the cloud and APP in the field of smart home, comprising:

[0062] A test program is built on the terminal, and a configuration file is configured for each simulated smart device in the test program;

[0063] Specifically, the configuration file is stored in yaml, and includes the mac, uuid, model and version of the simulated smart device. The configuration file also includes automated test scripts and interface data structures. The constant data and variable data are shown in the following table.

[0064]

[0065]

[0066]

[0067] In this embodiment, the programming language used is Python, and the terminal is a computer, a tablet computer, a wearable device, or the like.

[0068] Enter the model and version of the smart device to be simulated in the test program and match the corresponding configuration file;

[0069] Specifically, a user interface is provided for the user in the test program. By inputting or directly selecting the device model to be simulated in the interface, a corresponding configuration file can be matched to simulate and generate a smart device.

[0070] Start the interface corresponding to the configuration file and bind the interface to the cloud and APP;

[0071] Among them, binding the interface with the cloud and the APP includes:

[0072] The terminal provides a WiFi hotspot, the APP connects to the WiFi hotspot and sends corresponding parameters through the interface, and the parameters are written into the corresponding configuration file;

[0073] Specifically, the APP sends a

[0074] request.json['header']['namespace']=='Appliance.System.All'andrequest.json['header']['method']=='GET'request to obtain all constant configurations of simulated smart devices;

[0075] The simulated smart device judges the request. If the namespace and method of the request are correct, the constant parameters configured in the simulated smart device are returned to the APP.

[0076] After receiving the corresponding parameters, the APP sends

[0077] request.json['header']['namespace']=='Appliance.Config.Key'andrequest.json['header']['method']=='SET'Request to obtain the user ID, key and cloud address information of the simulated smart device;

[0078] The simulated smart device judges the request. If the namespace and method of the request are correct, the simulated smart device writes the request sent by the APP into the configuration file. After the writing is successful, the successful message is sent to the APP.

[0079] The test program sends corresponding parameters based on the APP and connects to the corresponding cloud mqtt server;

[0080] Specifically,

[0081] After the connection is successful, the test program sends a binding success message to the cloud MQTT server, and the cloud MQTT server forwards it to the APP;

[0082] The APP shows that the binding is successful.

[0083] When the APP receives the response request, it will make the third request:

[0084] namespace=Appliance.Config.Trace and request.json['header']['method']=='GET', to obtain the trace information of the simulated smart device. Here, the simulated smart device returns the pre-configured trace information to the app. Then, for the fourth interaction, when namespcae=Appliance.Config.WifiList and method=GET are sent, a response is required. For the fifth interaction, when namespcae=Appliance.System.Position and method=SET are sent, the longitude and latitude information in the corresponding yaml file needs to be set, and then a response is required. For the sixth interaction, when namespcae=Appliance.System.Time and method=SET are sent, the time zone information in the corresponding yaml file needs to be set, and then a response is required... until the last interaction when the APP sends

[0085] namespace=Appliance.Config.WifiX and request.json['header']['method']=='SET' request, the simulated smart device connects to the cloud mqtt server through the user id, key and cloud address information to be connected. When the interaction between the simulated smart device and the APP ends and the MQTT thread connection is opened, after the connection is successful, the simulated smart device subscribes to / appliance / +uuid+ / subscribe / MQTT TOPIC, and then immediately pushes the binding message to the cloud MQTT server / appliance / +uuid+ / publish / MQTT TOPIC. The binding message includes user information and simulated smart device information, which are stored in the corresponding yaml configuration file in the form of constants and variables. After receiving the message from the simulated smart device, the cloud MQTT server will bind the simulated smart device of the APP user. After the binding is successful, the MQTT PUSH message will be forwarded to the APP. When the APP receives this response, it will prompt the user that the device is successfully bound. At this point, a simulated smart device is successfully bound to the corresponding user, and a simulated device is successfully generated.

[0086] In this embodiment, the request method is: POST; the path is: / config; the request must: the header must be transmitted, and the header needs to contain namespce and method.

[0087] After successful binding, the APP sends the corresponding type of MQTT message to the cloud MQTT server, and the cloud MQTT server forwards the MQTT message to the corresponding interface in the test program;

[0088] According to the mqtt message, the interface corresponding configuration file generates the simulation data corresponding to the interface;

[0089] Send the simulated data to the APP through the cloud mqtt server;

[0090] Specifically, the APP controls the switch of the simulated smart device, sets scheduled tasks for the simulated smart device, etc. The communication logic here is: the APP sends the corresponding control request to the MQTT server, which is forwarded to the simulated smart device by the MQTT service. The simulated smart device parses the request message, performs corresponding actions, and then responds to the cloud, which is forwarded to the APP.

[0091] In this embodiment, the APP connects to the WiFi hotspot including:

[0092] The APP request is forwarded to the terminal through the http packet capture proxy tool.

[0093] Specifically, the terminal starts the packet capture tool Charles, and the mobile phone proxies the WiFi hotspot provided by the terminal to the gateway of the hotspot WiFi. The proxy port is the Charles default port: 8888. This method is used to solve the problem that the APP request gateway is inconsistent with the hotspot gateway. Even if the gateway is inconsistent, the http message of the APP fixed gateway address can be sent to the gateway of the terminal WiFi hotspot.

[0094] The present invention also provides a cloud and APP testing system in the field of smart home, comprising:

[0095] A building module is used to build a test program on the terminal, and a configuration file is configured for each simulated smart device in the test program;

[0096] The input module is used to input the model and version of the smart device to be simulated in the test program and match the corresponding configuration file;

[0097] The binding module is used to start the interface corresponding to the configuration file and bind the interface to the cloud and the APP;

[0098] The test module is used to send the corresponding type of mqtt message to the cloud mqtt server after the binding is successful, and the cloud mqtt server forwards the mqtt message to the corresponding interface in the test program;

[0099] The simulation module is used to generate simulation data corresponding to the interface according to the MQTT message and the configuration file corresponding to the interface;

[0100] The transmission module is used to send the simulation data to the APP through the cloud mqtt server;

[0101] Among them, binding the interface with the cloud and the APP includes:

[0102] The terminal provides a WiFi hotspot, the APP connects to the WiFi hotspot and sends corresponding parameters through the interface, and the parameters are written into the corresponding configuration file;

[0103] The test program sends corresponding parameters based on the APP and connects to the corresponding cloud mqtt server;

[0104] After the connection is successful, the test program sends a binding success message to the cloud MQTT server, and the cloud MQTT server forwards it to the APP;

[0105] The APP shows that the binding is successful.

[0106] Furthermore, the configuration file is stored via yaml, and the configuration file includes the mac, uuid, model and version of the simulated smart device.

[0107] Furthermore, the APP connects to the WiFi hotspot including:

[0108] The request from the APP reaches Charles, which forwards it to the terminal.

[0109] Specifically, the terminal starts the packet capture tool Charles, and the mobile phone proxies the WiFi hotspot provided by the terminal to the gateway of the hotspot WiFi. The proxy port is the Charles default port: 8888. This method is used to solve the problem that the APP request gateway is inconsistent with the hotspot gateway. Even if the gateway is inconsistent, the http message of the APP fixed gateway address can be sent to the gateway of the terminal WiFi hotspot.

[0110] In this embodiment, the APP connects to the WiFi hotspot and sends corresponding parameters through the interface. The parameters written into the corresponding configuration file include:

[0111] APP sends to the connected WiFi hotspot

[0112] request.json['header']['namespace']=='Appliance.System.All'andrequest.json['header']['method']=='GET'request to obtain all constant configurations of simulated smart devices;

[0113] The simulated smart device judges the request. If the namespace and method of the request are correct, the constant parameters configured in the simulated smart device are returned to the APP.

[0114] After receiving the corresponding parameters, the APP sends

[0115] request.json['header']['namespace']=='Appliance.Config.Key'andrequest.json['header']['method']=='SET'Request to obtain the user ID, key and cloud address information of the simulated smart device;

[0116] The simulated smart device judges the request. If the namespace and method of the request are correct, the simulated smart device writes the request sent by the APP into the configuration file. After the writing is successful, it sends a success message to the APP.

[0117] Furthermore, the test program sends corresponding parameters based on the APP, and connects to the corresponding cloud mqtt server including:

[0118] When the APP sends

[0119] namespace=Appliance.Config.WifiX and request.json['header']['method']=='SET' request, simulating the smart device connecting to the cloud mqtt server through the user id, key and the cloud address information to be connected.

[0120] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A testing method for cloud and APP in the field of smart home, It is characterized in that include: Building a test program on the terminal, wherein the test program is configured with a configuration file for each simulated smart device; Enter the model and version of the smart device to be simulated in the test program, and match the corresponding configuration file; Start the interface corresponding to the configuration file, and bind the interface to the cloud and the APP; After the binding is successful, the APP sends the corresponding type of mqtt message to the cloud mqtt server, and the cloud mqtt server forwards the mqtt message to the corresponding interface in the test program; According to the mqtt message, the interface generates simulation data corresponding to the interface corresponding to the configuration file; Send the simulation data to the APP through the cloud mqtt server; The step of binding the interface with the cloud and the APP includes: The terminal provides a WiFi hotspot, the APP connects to the WiFi hotspot and sends corresponding parameters through the interface, and the parameters are written into the corresponding configuration file; The test program sends corresponding parameters based on the APP and connects to the corresponding cloud mqtt server; After the connection is successful, the test program sends a binding success message to the cloud MQTT server, and the cloud MQTT server forwards it to the APP; The APP shows that the binding is successful.

2. The method for testing the cloud and APP in the field of smart home as claimed in claim 1, It is characterized in that The configuration file is stored via yaml, and includes the mac, uuid, model and version of the simulated smart device.

3. The method for testing the cloud and APP in the field of smart home as claimed in claim 1, It is characterized in that The APP connecting to the WiFi hotspot includes: The APP's request is forwarded to the terminal via an http packet capture proxy tool.

4. The method for testing the cloud and APP in the field of smart home as claimed in claim 1, It is characterized in that The APP connects to the WiFi hotspot and sends corresponding parameters through the interface, and the parameters are written into the corresponding configuration file including: The APP sends a request.json['header']['namespace']=='Appliance.System.All'andrequest.json['header']['method']=='GET'request to obtain all constant configurations of the simulated smart device; The simulated smart device judges the request, and if the namespace and method of the request are correct, returns the constant parameters configured in the simulated smart device to the APP; After the APP receives the corresponding parameters, it sends request.json['header']['namespace']=='Appliance.Config.Key'and request.json['header']['method'] == 'SET' request to obtain the user ID, key and cloud address information to be connected of the simulated smart device; The simulated smart device judges the request. If the namespace and method of the request are correct, the simulated smart device writes the request sent by the APP into the configuration file. After the writing is successful, the simulated smart device sends a success message to the APP.

5. The method for testing the cloud and APP in the field of smart home as claimed in claim 4, It is characterized in that The test program sends corresponding parameters based on the APP, and connects to the corresponding cloud mqtt server including: When the APP sends namespace=Appliance.Config.WifiX and request.json['header']['method']=='SET' request, the simulated smart device connects to the cloud mqtt server through the user id, key and cloud address information to be connected.

6. A cloud and APP testing system in the field of smart home, It is characterized in that include: A building module is used to build a test program on the terminal, wherein the test program is configured with a configuration file for each simulated smart device; An input module, used to input the model and version of the intelligent device to be simulated in the test program, and match the corresponding configuration file; A binding module is used to start the interface corresponding to the configuration file and bind the interface to the cloud and the APP; The test module is used for sending the corresponding type of mqtt message to the cloud mqtt server after the binding is successful, and the cloud mqtt server forwards the mqtt message to the corresponding interface in the test program; A simulation module, used for generating simulation data corresponding to the interface according to the mqtt message and the configuration file corresponding to the interface; A transmission module, used for sending the simulation data to the APP through the cloud MQTT server; The step of binding the interface with the cloud and the APP includes: The terminal provides a WiFi hotspot, the APP connects to the WiFi hotspot and sends corresponding parameters through the interface, and the parameters are written into the corresponding configuration file; The test program sends corresponding parameters based on the APP and connects to the corresponding cloud mqtt server; After the connection is successful, the test program sends a binding success message to the cloud MQTT server, and the cloud MQTT server forwards it to the APP; The APP shows that the binding is successful.

7. The cloud and APP testing system in the field of smart home as claimed in claim 6, It is characterized in that The configuration file is stored via yaml, and includes the mac, uuid, model and version of the simulated smart device.

8. The cloud and APP testing system in the field of smart home as claimed in claim 7, It is characterized in that The APP connecting to the WiFi hotspot includes: The APP's request is forwarded to the terminal via an http packet capture proxy tool.

9. The cloud and APP testing system in the field of smart home as claimed in claim 8, It is characterized in that The APP connects to the WiFi hotspot and sends corresponding parameters through the interface, and the parameters are written into the corresponding configuration file including: The APP sends a request.json['header']['namespace']=='Appliance.System.All'andrequest.json['header']['method']=='GET'request to obtain all constant configurations of the simulated smart device; The simulated smart device judges the request, and if the namespace and method of the request are correct, returns the constant parameters configured in the simulated smart device to the APP; After the APP receives the corresponding parameters, it sends request.json['header']['namespace']=='Appliance.Config.Key'and request.json['header']['method'] == 'SET' request to obtain the user ID, key and cloud address information to be connected of the simulated smart device; The simulated smart device judges the request. If the namespace and method of the request are correct, the simulated smart device writes the request sent by the APP into the configuration file. After the writing is successful, the simulated smart device sends a success message to the APP.

10. The cloud and APP testing system in the field of smart home as claimed in claim 9, It is characterized in that The test program sends corresponding parameters based on the APP, and connects to the corresponding cloud mqtt server including: When the APP sends namespace=Appliance.Config.WifiX and request.json['header']['method']=='SET' request, the simulated smart device connects to the cloud mqtt server through the user id, key and cloud address information to be connected.