Interface testing methods and apparatus, storage media and electronic devices
By receiving control commands and obtaining configuration files through the interface, the problems of virtual device instability and inability to control offline and online status are solved, and the stability and accuracy of device selection logic testing are achieved.
Patent Information
- Application Number
- CN202211058666.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-31
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2042-08-31
AI Technical Summary
During the testing of the device selection logic, the virtual devices are unstable and their online/offline status cannot be manually controlled, affecting the automated test results.
The system receives control commands through the target interface, obtains the configuration file of the simulated device, determines the target configuration file based on information such as device type and location, stabilizes the state of the simulated device, and simulates any number of devices using the configuration file method to ensure stable device state.
It achieves the stability of automated interface test results, and allows for manual control of device status to ensure the accuracy and consistency of test results.
Smart Images

Figure CN115469638B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of smart home technology, and more specifically, to an interface testing method and apparatus, a storage medium, and an electronic device. Background Technology
[0002] With the rapid development of science and technology, various smart home appliances have emerged, and those based on IoT technology have gained increasing acceptance among users. These smart home appliances typically require corresponding device selection logic to operate. In testing this logic, a common approach is to first create a physical baseboard for the appliance, then add a communication module to it. This module enables the IoT functionality of the appliance. For example, multiple devices can be bound for device selection testing: air conditioners can be bound to both the living room and bedroom, and saying "turn on the living room air conditioner" to a speaker will activate it. However, the device selection logic is very complex and requires binding numerous devices.
[0003] In related technologies, due to the insufficient number of real devices, virtual devices are usually chosen to be bound and used to replace real devices for batch automated testing of device selection logic. However, virtual devices are unstable. Devices that are online may sometimes go offline, affecting the automated test results. In addition, some logic requires testing when the device is offline. The online and offline status of virtual devices cannot be manually controlled.
[0004] In the testing process of device selection logic, there are still no effective solutions to the problems of virtual device instability and the inability to manually control the online and offline status of virtual devices during the testing process of related technologies. Summary of the Invention
[0005] This application provides an interface testing method and apparatus, storage medium and electronic device to at least solve the problems in the related art, such as the instability of virtual devices and the inability to manually control the online and offline status of virtual devices during the testing process of device selection logic.
[0006] According to one embodiment of this application, a method for testing an interface is provided, comprising: receiving a control command for controlling a first simulated device through a target interface; acquiring multiple configuration files corresponding to multiple simulated devices, wherein each configuration file is used to indicate device information of the simulated device corresponding to each configuration file; controlling the target interface to determine a first configuration file from the multiple configuration files according to the control command; and determining that the target interface passes the test when the first configuration file indicates the first device information of the first simulated device.
[0007] In one exemplary embodiment, controlling the target interface to determine a first configuration file from among multiple configuration files according to the control instruction includes: controlling the target interface to determine the device type of the first simulated device indicated by the control instruction, and determining whether the control instruction indicates a first device location of the first simulated device; if the control instruction indicates a first device location of the first simulated device, controlling the target interface to determine the first configuration file from among the multiple configuration files according to the device type and the first device location of the first simulated device, wherein the device type and location information indicated by the first configuration file are consistent with the device type and location information of the first simulated device, respectively.
[0008] In an exemplary embodiment, after controlling the target interface to determine whether the control instruction indicates the device location of the first simulated device, the method further includes: if the control instruction does not indicate the device location of the first simulated device, controlling the target interface to determine the device identifier of the transmitting device that sent the control instruction, and determining a second device location of the transmitting device; controlling the target interface to determine the first configuration file from among the plurality of configuration files based on the device type of the first simulated device and the second device location.
[0009] In an exemplary embodiment, after controlling the target interface to determine the device identifier of the transmitting device that sends the control command and to determine the second device location of the transmitting device, the method further includes: controlling the target interface to determine whether a third configuration file exists among the plurality of configuration files, wherein the device location indicated by the third configuration file is consistent with the second device location; if the third configuration file does not exist among the plurality of configuration files, determining the third device location of the transmitting device, wherein the area information of the third device location is greater than the area information of the second device location; and controlling the target interface to determine the first configuration file among the plurality of configuration files based on the device type of the first simulated device and the third device location.
[0010] In an exemplary embodiment, after controlling the target interface to determine the first configuration file from the plurality of configuration files based on the device type and the location of the first simulated device, the method further includes: if there are multiple first configuration files, determining the device status of the simulated devices corresponding to the plurality of configuration files, wherein the device status includes one of the following: online status and offline status; determining a second configuration file from the plurality of first configuration files based on the device type, the location of the first device, and the device status, wherein the second configuration file indicates the first device information of the first simulated device.
[0011] In one exemplary embodiment, if the first configuration file does not indicate the first device information of the first simulated device, it is determined that the target interface has failed the test; a test report corresponding to the target interface is generated, and the test report is sent to the display device corresponding to the target interface.
[0012] In an exemplary embodiment, after determining that the target interface has passed the test, the method further includes: controlling the first simulation device to perform a target operation according to the control instruction, and adjusting the working state in the first configuration file of the first simulation device according to the target operation; determining whether the adjusted working state is consistent with the preset working state; and determining that the first simulation device has successfully executed the control instruction if the adjusted working state is consistent with the preset working state.
[0013] According to another embodiment of the present application, an interface testing apparatus is also provided, comprising: a receiving module, configured to receive a control command for controlling a first simulated device through a target interface; an acquisition module, configured to acquire multiple configuration files corresponding to multiple simulated devices, wherein each configuration file is used to indicate device information of the simulated device corresponding to each configuration file; a first determining module, configured to control the target interface to determine a first configuration file from the multiple configuration files according to the control command; and a second determining module, configured to determine that the target interface passes the test when the first configuration file indicates the first device information of the first simulated device.
[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, and the computer program is configured to execute the test method of the above-described interface 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 test method of the interface described above through the computer program.
[0016] In this embodiment, a control command for controlling a first simulated device is received through a target interface; multiple configuration files corresponding to multiple simulated devices are obtained, wherein each configuration file indicates the device information of the simulated device corresponding to each configuration file; the target interface is controlled to determine a first configuration file from the multiple configuration files according to the control command; if the first configuration file indicates the first device information of the first simulated device, the target interface is determined to have passed the test. This technical solution solves the problems of instability of virtual devices and the inability to manually control the online / offline status of virtual devices during the testing process of device selection logic. According to this embodiment, when performing interface testing, the required devices are written using configuration files, comprehensively and stably simulating device information, such as device type, device name, device MAC address, room, floor, online / offline devices, etc. Using configuration files can simulate any number of devices, and the device status is stable and does not change. This makes the automated interface testing results stable. Attached Figure Description
[0017] 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.
[0018] 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.
[0019] Figure 1 This is a schematic diagram of the hardware environment for a testing method of an interface according to an embodiment of this application;
[0020] Figure 2 This is a flowchart of a testing method for an interface according to an embodiment of this application;
[0021] Figure 3 This is a flowchart of a testing method for an interface according to an optional embodiment of this application;
[0022] Figure 4 This is a structural block diagram (a) of an interface testing device according to an embodiment of this application;
[0023] Figure 5 This is a structural block diagram (II) of an interface testing device according to an embodiment of this application. Detailed Implementation
[0024] 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.
[0025] 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.
[0026] According to one aspect of the embodiments of this application, a method for testing an interface is provided. This interface 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 interface testing method can be applied to, for example... Figure 1 The hardware environment shown consists of terminal device 102 and server 104. For example... Figure 1 As shown, server 104 is connected to terminal device 102 via a network and can be used to provide services (such as application services) to the terminal or clients installed on the terminal. 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.
[0027] 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.
[0028] This embodiment provides a method for testing an interface, applied to a server. Figure 2 This is a flowchart of a testing method for an interface according to an embodiment of this application, the process including the following steps:
[0029] Step S202: Receive control commands for controlling the first analog device through the target interface;
[0030] It should be noted that the above control commands can be control commands such as "turn on the bedroom light" or "turn on the light". Furthermore, the control instructions are used to control the first analog device, but the control instructions may not contain the device identification information that uniquely indicates the first analog device.
[0031] Step S204: Obtain multiple configuration files corresponding to multiple simulation devices, wherein each configuration file is used to indicate the device information of the simulation device corresponding to each configuration file;
[0032] The device information includes, but is not limited to: device type, device name, device MAC address, room, floor, and device online status. This embodiment of the invention does not limit these aspects.
[0033] Step S206: Control the target interface to determine the first configuration file from the plurality of configuration files according to the control instruction;
[0034] Step S208: If the first configuration file indicates the first device information of the first simulated device, determine that the target interface has passed the test.
[0035] Through the above steps, control commands for controlling the first simulated device are received through the target interface; multiple configuration files corresponding to multiple simulated devices are obtained, wherein each configuration file indicates the device information of the simulated device corresponding to each configuration file; the target interface is controlled to determine the first configuration file from the multiple configuration files according to the control commands; when the first configuration file indicates the first device information of the first simulated device, the target interface is determined to have passed the test. This solves the problems in related technologies, such as the instability of virtual devices and the inability to manually control the online / offline status of virtual devices during the testing of device selection logic. When performing interface testing, the required devices are written using configuration files, comprehensively and stably simulating device information, such as device type, device name, device MAC address, room, floor, online / offline devices, etc. Using configuration files, any number of devices can be simulated, and the device status is stable and does not change. This makes the automated interface testing results stable.
[0036] In an exemplary embodiment, step S206 includes: controlling the target interface to determine the device type of the first simulated device indicated by the control instruction, and determining whether the control instruction indicates a first device location of the first simulated device; if the control instruction indicates a first device location of the first simulated device, controlling the target interface to determine the first configuration file from the plurality of configuration files according to the device type of the first simulated device and the first device location, wherein the device type and location information indicated by the first configuration file are consistent with the device type and location information of the first simulated device, respectively.
[0037] It should be noted that the device type contained in the control instruction is determined according to the control instruction, and whether the control instruction contains a first device location is determined; if the control instruction contains a device type and a first device location, the first configuration file is determined from the multiple configuration files according to the device type and the first device location.
[0038] For example, when the control command is "turn on the bedroom light", "bedroom" is determined as the first device location; "light" is the device type, and a first configuration file containing "bedroom" and "light" is selected from multiple configuration files based on "bedroom" and "light". Similarly, when the control command is "turn on the second-floor light", "second floor" is determined as the first device location; "light" is the device type, and a first configuration file containing "second floor" and "light" is selected from multiple configuration files based on "second floor" and "light".
[0039] Furthermore, if there are multiple first configuration files, the target interface is obtained to determine the second device location of the transmitting device that sends the control command; and a sixth configuration file is determined from the multiple first configuration files based on the device type and the second device location.
[0040] For example, when the control command is "turn on the bedroom light", "bedroom" is determined as the first device location; "light" is the device type. Based on "bedroom" and "light", multiple first configuration files containing "bedroom" and "light" are determined among multiple configuration files. The sending device is determined to be located in "bedroom 1". Therefore, based on "bedroom 1" and "light", a sixth configuration file containing "bedroom 1" and "light" is determined among multiple first configuration files.
[0041] In an exemplary embodiment, after controlling the target interface to determine the first configuration file from the plurality of configuration files based on the device type and the location of the first simulated device, the method further includes: if there are multiple first configuration files, determining the device status of the simulated devices corresponding to the plurality of configuration files, wherein the device status includes one of the following: online status and offline status; determining a second configuration file from the plurality of first configuration files based on the device type, the location of the first device, and the device status, wherein the second configuration file indicates the first device information of the first simulated device.
[0042] For example, when the control command is "turn on the light in bedroom 1", "bedroom 1" is determined as the first device location; "light" is the device type. Based on "bedroom 1" and "light", a configuration file containing "bedroom 1" and "light" is determined from multiple configuration files. If there are multiple configuration files, the online status of multiple "lights" in bedroom 1 is obtained, and a second configuration file is determined from multiple configuration files based on "bedroom 1", "light", and online status.
[0043] In one exemplary embodiment, after controlling the target interface to determine whether the control instruction indicates the device location of the first simulated device, the method further includes: if the control instruction does not indicate the device location of the first simulated device, controlling the target interface to determine the device identifier of the sending device that sent the control instruction, and determining the second device location of the sending device; controlling the target interface to determine the first configuration file from the plurality of configuration files based on the device type of the first simulated device and the second device location.
[0044] It should be noted that when the control command includes a device type but does not include the first device location, the second device location of the transmitting device is determined; the first configuration file is determined from the multiple configuration files based on the device type and the second device location.
[0045] For example, when the control command is "turn on the light", it is determined that "light" is a device type, but does not contain the first location information. The second location information of the sending device is determined, such as "secondary bedroom 1". Based on "secondary bedroom 1" and "light", multiple first configuration files containing "secondary bedroom 1" and "light" are determined in multiple configuration files.
[0046] In an exemplary embodiment, when the control command does not indicate the device location of the first simulated device, after controlling the target interface to determine the device identifier of the transmitting device that sent the control command and to determine the second device location of the transmitting device, the method further includes: controlling the target interface to determine whether a third configuration file exists among the plurality of configuration files, wherein the device location indicated by the third configuration file is consistent with the second device location; if the third configuration file does not exist among the plurality of configuration files, determining the third device location of the transmitting device, wherein the area information of the third device location is greater than the area information of the second device location; and controlling the target interface to determine the first configuration file among the plurality of configuration files based on the device type of the first simulated device and the third device location.
[0047] In other words, if the control command does not contain the first location information of the first analog device, and the second location information of the transmitting device does not contain the first analog device, the first configuration file is determined based on the third location information and device type of the transmitting device.
[0048] For example, when the control command is "turn on the air conditioner", it is determined that "air conditioner" is the device type, but it does not contain the first location information. The second location information of the device is determined and sent, such as "secondary bedroom 1". Based on "secondary bedroom 1" and "air conditioner", it is determined whether a third configuration file containing "secondary bedroom 1" and "air conditioner" is included in multiple configuration files. If the third configuration file containing "secondary bedroom 1" and "air conditioner" is not included in multiple configuration files, the third location information to be sent is determined, such as "first floor". The first configuration file is determined based on "first floor" and "air conditioner" first.
[0049] Furthermore, before controlling the target interface to determine the first configuration file from the plurality of configuration files based on the device type of the first simulated device and the location of the third device, the method further includes: controlling the target interface to determine whether a fifth configuration file exists among the plurality of configuration files, wherein the device location indicated by the fifth configuration file is consistent with the location of the third device; if the fifth configuration file does not exist among the plurality of configuration files, determining a fourth device location of the transmitting device, wherein the area information of the fourth device location is greater than the area information of the third device location; and controlling the target interface to determine the first configuration file from the plurality of configuration files based on the device type of the first simulated device and the location of the fourth device.
[0050] For example, when the control command is "turn on the air conditioner", the system determines that "air conditioner" is the device type, but does not contain the first location information. It then determines the second location information of the sending device, such as "secondary bedroom 1". Based on "secondary bedroom 1" and "air conditioner", it determines whether a third configuration file containing "secondary bedroom 1" and "air conditioner" is included in multiple configuration files. If the third configuration file does not contain "secondary bedroom 1" and "air conditioner", the system determines the third location information to be sent, such as "first floor". It also determines whether a fifth configuration file based on "first floor" and "air conditioner" is included in multiple configuration files. If the fifth configuration file does not contain the fifth configuration file based on "first floor" and "air conditioner", the system determines the fourth location information of the home area where the sending device is located. Finally, the system determines the first configuration file based on the device type of the first simulated device and the location of the fourth device in the multiple configuration files.
[0051] In one exemplary embodiment, after determining the second device information of the second simulated device corresponding to the first configuration file, the method further includes: if the first configuration file does not indicate the first device information of the first simulated device, determining that the target interface has failed the test; generating a test report corresponding to the target interface, and sending the test report to the display device corresponding to the target interface.
[0052] It should be noted that if an interface fails the test, a corresponding test report is generated and sent to the display device corresponding to the target interface, and the developers improve the target interface based on the test report.
[0053] Specifically, the fourth configuration file of the first simulation device is obtained, and the first device information of the first simulation device is determined according to the fourth configuration file; the second device information of the second simulation device corresponding to the first configuration file is determined; if the first device information and the second device information are consistent, the first device information of the first simulation device indicated by the first configuration file is determined.
[0054] That is, a fourth configuration file of a preset first simulation device is determined, and the first device information of the first simulation device is determined according to the fourth configuration file, and the second device information of the second simulation device is determined according to the first configuration file; and the first configuration file indicates the first device information of the first simulation device according to the first device information and the second device information.
[0055] In an exemplary embodiment, after determining that the target interface has passed the test, the method further includes: controlling the first simulation device to perform a target operation according to the control instruction, and adjusting the working state in the first configuration file of the first simulation device according to the target operation; determining whether the adjusted working state is consistent with the preset working state; and determining that the first simulation device has successfully executed the control instruction if the adjusted working state is consistent with the preset working state.
[0056] When the device information of the first simulated device is indicated by the first configuration file, the working state in the first configuration file is adjusted according to the control command, and the adjusted working state is compared with the preset working state to determine whether the interface can successfully send the control module to the first simulated device, and whether the first simulated device can successfully execute the control command.
[0057] To better understand the testing process of the above-mentioned interface, the implementation flow of the testing method of the above-mentioned interface will be described below in conjunction with optional embodiments, but this is not intended to limit the technical solution of the embodiments of this application.
[0058] This embodiment provides a method for testing an interface, taking the testing of air conditioning equipment selection as an example.
[0059] I. Define the air conditioning equipment selection logic test:
[0060] (1) If the speech data contains room information, the air conditioner of that room should be selected first;
[0061] (2) If the voice message contains room information and the room has both online and offline air conditioning, the online air conditioning should be selected first;
[0062] (3) If there is no room in the corpus, and the room where the speaker is located has air conditioning, the air conditioning in the room where the speaker is located should be selected first.
[0063] (4) There are no rooms in the corpus. The room where the speaker is located has air conditioning. There are online and offline options. Online air conditioning is preferred.
[0064] (5) If there are no rooms in the corpus and the room where the speaker is located does not have air conditioning, prioritize other rooms on the same floor with air conditioning.
[0065] (6) There are no rooms in the corpus, and the room and floor where the speaker is located do not have air conditioning. Select other floors with air conditioning.
[0066] II. Selection of testing air conditioning equipment Figure 3 This is a flowchart of a testing method for an interface according to an optional embodiment of this application, such as... Figure 3 As shown, the specific steps are as follows:
[0067] Step S301: Begin;
[0068] Step S302: Compile the device configuration file, as shown in Table 1;
[0069] Table 1
[0070]
[0071]
[0072] Step S303: Call the interface and send the device control request corpus "Turn on the kitchen air conditioner" (equivalent to the control command in the above embodiment);
[0073] Step S304: The interface obtains the device information corresponding to each of the configuration files;
[0074] Step S305: Determine the target configuration file and target device information based on the device information corresponding to each configuration file;
[0075] Step S306: Determine whether the selected device information returned by the interface is Air Conditioner 3. If yes, the test passes; otherwise, the test fails.
[0076] Through the above embodiments, an arbitrary number of devices can be simulated using configuration files. The device states of these simulated devices remain stable and unchanged. This ensures stable automated interface testing results and allows for manual control over whether devices are online or offline, facilitating testing scenarios where devices are offline.
[0077] 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.
[0078] Figure 4 This is a structural block diagram (a) of an interface testing device according to an embodiment of this application; as shown... Figure 4 As shown, it includes:
[0079] Receiver module 42 is used to receive control commands for controlling the first analog device through the target interface;
[0080] The acquisition module 44 is used to acquire multiple configuration files corresponding to multiple simulation devices, wherein each configuration file is used to indicate the device information of the simulation device corresponding to each configuration file;
[0081] The first determining module 46 is used to control the target interface to determine the first configuration file from the plurality of configuration files according to the control instruction;
[0082] The second determining module 48 is used to determine that the target interface passes the test when the first device information of the first simulated device is indicated in the first configuration file.
[0083] Through the aforementioned device, the receiving module 42 receives control commands for controlling the first simulated device via the target interface; the acquiring module 44 acquires multiple configuration files corresponding to multiple simulated devices, wherein each configuration file indicates the device information of the simulated device corresponding to each configuration file; the acquiring module 44 controls the target interface to determine the first configuration file from the multiple configuration files according to the control commands; the second determining module 48 determines that the target interface passes the test when the first configuration file indicates the first device information of the first simulated device. This solves the problems in related technologies, such as the instability of virtual devices and the inability to manually control the online / offline status of virtual devices during the testing of device selection logic. When performing interface testing, the required devices are written using configuration files, comprehensively and stably simulating device information, such as device type, device name, device MAC address, room, floor, online / offline devices, etc. Using configuration files, any number of devices can be simulated, and the device status is stable and does not change. This makes the automated interface testing results stable.
[0084] In an exemplary embodiment, a first determining module 46 is configured to control the target interface to determine the device type of the first simulated device indicated by the control instruction, and to determine whether the control instruction indicates a first device location of the first simulated device; if the control instruction indicates a first device location of the first simulated device, the target interface is controlled to determine a first configuration file from a plurality of configuration files based on the device type and the first device location of the first simulated device, wherein the device type and location information indicated by the first configuration file are consistent with the device type and location information of the first simulated device, respectively.
[0085] In an exemplary embodiment, the first determining module 46 is configured to control the target interface to determine the device identifier of the sending device that sent the control command and to determine the second device location of the sending device when the control command does not indicate the device location of the first simulated device; and to control the target interface to determine the first configuration file from the plurality of configuration files based on the device type of the first simulated device and the second device location.
[0086] In an exemplary embodiment, the first determining module 46 is configured to determine the device status of the simulated device corresponding to the plurality of first configuration files when there are multiple first configuration files, wherein the device status includes one of the following: online status, offline status; and determine a second configuration file from the plurality of first configuration files according to the device type, the location of the first device, and the device status, wherein the second configuration file indicates the first device information of the first simulated device.
[0087] In one exemplary embodiment, Figure 5 This is a structural block diagram (II) of an interface testing device according to an embodiment of this application; as shown Figure 5 As shown, it includes: a generation module 52, used to determine that the target interface has failed the test when the first configuration file does not indicate the first device information of the first simulated device; generate a test report corresponding to the target interface, and send the test report to the display device corresponding to the target interface.
[0088] In an exemplary embodiment, a first determining module 46 is configured to control the target interface to determine whether a third configuration file exists among the plurality of configuration files, wherein the device location indicated by the third configuration file is consistent with the second device location; if the third configuration file does not exist among the plurality of configuration files, to determine the third device location of the transmitting device, wherein the area information of the third device location is greater than the area information of the second device location; and to control the target interface to determine the first configuration file among the plurality of configuration files based on the device type of the first simulated device and the third device location.
[0089] In an exemplary embodiment, the second determining module is further configured to control the first simulation device to perform a target operation according to the control instruction, and adjust the working state in the first configuration file of the first simulation device according to the target operation; determine whether the adjusted working state is consistent with the preset working state; and determine that the first simulation device has successfully executed the control instruction if the adjusted working state is consistent with the preset working state.
[0090] Embodiments of this application also provide a storage medium including a stored program, wherein the program executes any of the methods described above when it is run.
[0091] Optionally, in this embodiment, the storage medium may be configured to store program code for performing the following steps:
[0092] S1 receives control commands for controlling the first analog device through the target interface;
[0093] S2, obtain multiple configuration files corresponding to multiple simulation devices respectively, wherein each configuration file is used to indicate the device information of the simulation device corresponding to each configuration file;
[0094] S3, control the target interface to determine the first configuration file from the plurality of configuration files according to the control instruction;
[0095] Given the first device information of the first simulated device indicated in the first configuration file, the target interface is determined to have passed the test.
[0096] 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.
[0097] Optionally, 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.
[0098] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0099] S1 receives control commands for controlling the first analog device through the target interface;
[0100] S2, obtain multiple configuration files corresponding to multiple simulation devices respectively, wherein each configuration file is used to indicate the device information of the simulation device corresponding to each configuration file;
[0101] S3, control the target interface to determine the first configuration file from the plurality of configuration files according to the control instruction;
[0102] Given the first device information of the first simulated device indicated in the first configuration file, the target interface is determined to have passed the test.
[0103] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0104] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0105] 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. Optionally, they can be implemented using computer-executable program code, thereby storing them 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.
[0106] 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 testing an interface, characterized in that, include: Receive control commands for controlling the first analog device through the target interface; Obtain multiple configuration files corresponding to multiple simulation devices, wherein each configuration file is used to indicate the device information of the simulation device corresponding to each configuration file; The target interface is controlled to determine a first configuration file from the plurality of configuration files according to the control instructions; If the first configuration file indicates the first device information of the first simulated device, it is determined that the target interface passes the test; The method further includes, after controlling the target interface to determine the first configuration file from the plurality of configuration files according to the control instructions: Obtain the fourth configuration file of the first simulation device, and determine the first device information of the first simulation device based on the fourth configuration file; Determine the second device information of the second simulation device corresponding to the first configuration file; If the first device information is consistent with the second device information, the first device information indicating the first simulated device in the first configuration file is determined.
2. The interface testing method according to claim 1, characterized in that, The target interface is controlled to determine a first configuration file from the plurality of configuration files according to the control instructions, including: The target interface is controlled to determine the device type of the first simulated device indicated by the control command, and to determine whether the control command indicates the first device location of the first simulated device; When the control command indicates the first device location of the first simulated device, the control target interface determines the first configuration file from the plurality of configuration files according to the device type of the first simulated device and the first device location, wherein the device type and location information indicated by the first configuration file are consistent with the device type and location information of the first simulated device, respectively.
3. The interface testing method according to claim 2, characterized in that, After the target interface determines whether the control command indicates the device location of the first simulated device, the method further includes: If the control command does not indicate the device location of the first simulated device, the target interface is controlled to determine the device identifier of the transmitting device that sent the control command, and to determine the second device location of the transmitting device; The target interface is controlled to determine the first configuration file from among the multiple configuration files based on the device type of the first simulated device and the location of the second device.
4. The interface testing method according to claim 3, characterized in that, After controlling the target interface to determine the device identifier of the transmitting device that sends the control command, and to determine the second device location of the transmitting device, the method further includes: The target interface is controlled to determine whether a third configuration file exists among the plurality of configuration files, wherein the device location indicated by the third configuration file is consistent with the device location of the second device; If the third configuration file is not present in any of the multiple configuration files, the third device location of the transmitting device is determined, wherein the area information of the third device location is greater than the area information of the second device location; The target interface is controlled to determine the first configuration file from among the multiple configuration files based on the device type of the first simulated device and the location of the third device.
5. The interface testing method according to claim 2, characterized in that, After controlling the target interface to determine the first configuration file from the plurality of configuration files based on the device type and location of the first simulated device, the method further includes: When there are multiple first configuration files, the device status of the simulated devices corresponding to the multiple configuration files is determined, wherein the device status includes one of the following: online status, offline status; Based on the device type, the location of the first device, and the device status, the target interface controls multiple first configuration files to determine whether a third configuration file exists in the multiple configuration files, and determines a second configuration file, the second configuration file indicating the first device information of the first simulated device.
6. The interface testing method according to claim 1, characterized in that, The method further includes: If the first configuration file does not indicate the first device information of the first simulated device, it is determined that the target interface has failed the test; Generate a test report corresponding to the target interface, and send the test report to the display device corresponding to the target interface.
7. The testing method for the interface according to any one of claims 1-5, characterized in that, After determining that the target interface passes the test, the method further includes: The control command controls the first simulation device to perform the target operation, and the working status in the first configuration file of the first simulation device is adjusted according to the target operation. Determine whether the adjusted working status is consistent with the preset working status; If the adjusted working state is consistent with the preset working state, it is determined that the first simulation device has successfully executed the control command.
8. An interface testing device, characterized in that, include: The receiving module is used to receive control commands for controlling the first analog device through the target interface; The acquisition module is used to acquire multiple configuration files corresponding to multiple simulation devices, wherein each configuration file is used to indicate the device information of the simulation device corresponding to each configuration file; The first determining module is used to control the target interface to determine the first configuration file from the plurality of configuration files according to the control instructions; The second determining module is used to determine that the target interface passes the test when the first configuration file indicates the first device information of the first simulated device; The first determining module is further configured to obtain a fourth configuration file of the first simulation device, and determine first device information of the first simulation device based on the fourth configuration file; determine second device information of the second simulation device corresponding to the first configuration file; and determine the first device information of the first simulation device indicated by the first configuration file when the first device information and the second device information are consistent.
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 described in 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 described in any one of claims 1 to 7 through the computer program.
Citation Information
Patent Citations
Method, apparatus and system for controlling intelligent device, device and storage medium
CN109379261A
Equipment control method, device and system based on position information
CN110989372A
Household appliance testing method and system
CN113468033A