CN115469638A - Interface test method and device, storage medium and electronic device - Google Patents

Interface test method and device, storage medium and electronic device Download PDF

Info

Publication number
CN115469638A
CN115469638A CN202211058666.3A CN202211058666A CN115469638A CN 115469638 A CN115469638 A CN 115469638A CN 202211058666 A CN202211058666 A CN 202211058666A CN 115469638 A CN115469638 A CN 115469638A
Authority
CN
China
Prior art keywords
configuration file
simulation
target interface
controlling
interface
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211058666.3A
Other languages
Chinese (zh)
Inventor
李红燕
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Haier Uplus Intelligent Technology Beijing Co Ltd
Original Assignee
Qingdao Haier Technology Co Ltd
Haier Smart Home Co Ltd
Haier Uplus Intelligent Technology Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Qingdao Haier Technology Co Ltd, Haier Smart Home Co Ltd, Haier Uplus Intelligent Technology Beijing Co Ltd filed Critical Qingdao Haier Technology Co Ltd
Priority to CN202211058666.3A priority Critical patent/CN115469638A/en
Publication of CN115469638A publication Critical patent/CN115469638A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B23/00Testing or monitoring of control systems or parts thereof
    • G05B23/02Electric testing or monitoring
    • G05B23/0205Electric testing or monitoring by means of a monitoring system capable of detecting and responding to faults
    • G05B23/0208Electric testing or monitoring by means of a monitoring system capable of detecting and responding to faults characterized by the configuration of the monitoring system
    • G05B23/0213Modular or universal configuration of the monitoring system, e.g. monitoring system having modules that may be combined to build monitoring program; monitoring system that can be applied to legacy systems; adaptable monitoring system; using different communication protocols
    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B2219/00Program-control systems
    • G05B2219/20Pc systems
    • G05B2219/24Pc safety
    • G05B2219/24065Real time diagnostics

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Automation & Control Theory (AREA)
  • Testing And Monitoring For Control Systems (AREA)

Abstract

The application discloses a test method and a test device for an interface, a storage medium and an electronic device, and relates to the technical field of smart homes, wherein the test method for the interface comprises the following steps: receiving a control instruction for controlling the first simulation equipment through the target interface; acquiring a plurality of configuration files corresponding to a plurality of simulation devices respectively, wherein each configuration file is used for indicating device information of the simulation device corresponding to each configuration file; controlling the target interface to determine a first configuration file in the plurality of configuration files according to the control instruction; and determining that the target interface passes the test under the condition that the first configuration file indicates the first device information of the first simulation device.

Description

Interface test method and device, storage medium and electronic device
Technical Field
The application relates to the technical field of smart homes, in particular to a method and a device for testing an interface, a storage medium and an electronic device.
Background
With the rapid development of scientific technology, various intelligent household appliances are produced, and the intelligent household appliances based on the internet of things technology are recognized by more and more users. Such intelligent network appliances generally need to operate in conjunction with corresponding device selection logic. In the testing process of the device selection logic, a general scheme is that a physical bottom plate of the household appliance is manufactured firstly, then a communication module is added on the physical bottom plate, the home appliance internet of things function is realized through the communication module, for example, a plurality of devices are bound to perform the device selection test: for example, air conditioners are respectively bound in a living room and a bedroom, and the sound box is called to turn on the air conditioner in the living room, so that the air conditioner in the living room is turned on. But the devices that need to be bound are numerous because the device selection logic is very complex.
In the related art, because the number of real devices is not enough, a virtual device is usually selected to be bound, the real devices are replaced by the virtual devices, and the logic of device selection is tested in batch in an automated manner, but the virtual devices are unstable, the devices which are originally on-line are sometimes off-line, so that the automated test result is influenced, and the conditions that some logics need to test the devices off-line are caused, and the off-line on-line condition of the virtual devices cannot be controlled manually.
In the related art, no effective solution is provided for the problems that the virtual device is unstable and the offline and online conditions of the virtual device cannot be controlled manually in the test process of the device selection logic.
Disclosure of Invention
The embodiment of the application provides a method and a device for testing an interface, a storage medium and an electronic device, which are used for at least solving the problems that in the related art, in the test process of equipment selection logic, virtual equipment is unstable, the offline online condition of the virtual equipment cannot be manually controlled and the like.
According to an embodiment of the present application, there is provided a method for testing an interface, including: receiving a control instruction for controlling the first simulation equipment through the target interface; acquiring a plurality of configuration files corresponding to a plurality of simulation devices respectively, wherein each configuration file is used for indicating device information of the simulation device corresponding to each configuration file; controlling the target interface to determine a first configuration file in the plurality of configuration files according to the control instruction; determining that the target interface passes the test if the first configuration file indicates first device information of the first simulation device.
In an exemplary embodiment, controlling the target interface to determine a first profile from the plurality of profiles according to the control instruction includes: controlling the target interface to determine a device type of the first simulated device indicated by the control instruction and determine whether the control instruction indicates a first device location of the first simulated device; and under the condition that the control instruction indicates a first device position of the first simulation device, controlling the target interface to determine the first configuration file in the plurality of configuration files according to the device type and the first device position of the first simulation device, wherein the device type and the position information indicated by the first configuration file are respectively consistent with the device type and the position information of the first simulation device.
In one exemplary embodiment, after controlling the target interface to determine whether the control instruction indicates a device location of the first simulated device, the method further comprises: under the condition that the control instruction does not indicate the equipment position of the first simulation equipment, controlling the target interface to determine the equipment identifier of the sending equipment sending the control instruction and determine a second equipment position of the sending equipment; and controlling the target interface to determine the first configuration file in the plurality of configuration files according to the equipment type of the first simulation equipment and the position of the second equipment.
In an exemplary embodiment, after controlling the target interface to determine a device identifier of a sending device sending the control instruction, and to determine a second device location of the sending device, the method further includes: controlling the target interface to determine whether a third profile exists in the plurality of profiles, wherein the device location indicated by the third profile is consistent with the second device location; determining a third device location of the sending device in the absence of the third profile in the plurality of profiles, wherein area information of the third device location is greater than area information of the second device location; and controlling the target interface to determine the first configuration file in the plurality of configuration files according to the device type of the first simulation device and the position of the third device.
In an exemplary embodiment, after controlling the target interface to determine the first profile from the plurality of profiles according to the device type of the first simulated device and the first device location, the method further comprises: determining the device state of the simulation device corresponding to the plurality of configuration files under the condition that the first configuration file is a plurality of configuration files, wherein the device state comprises one of the following: an online state and an offline state; determining a second configuration file in the plurality of first configuration files according to the device type, the first device position and the device state, wherein the second configuration file indicates first device information of the first simulation device.
In one exemplary embodiment, in the event that the first configuration file does not indicate first device information for the first simulated device, determining that the target interface failed the test; and generating a test report corresponding to the target interface, and sending the test report to display equipment corresponding to the target interface.
In an exemplary embodiment, after determining that the target interface passes the test, the method further comprises: controlling the first simulation equipment to execute target operation according to the control instruction, and adjusting the working state in a first configuration file of the first simulation equipment according to the target operation; determining whether the adjusted working state is consistent with a preset working state; and under the condition that the adjusted working state is consistent with the preset working state, determining that the first simulation equipment successfully executes the control command.
According to another embodiment of the present application, there is also provided an interface testing apparatus, including: the receiving module is used for receiving a control instruction for controlling the first simulation equipment through the target interface; the simulation system comprises an acquisition module, a processing module and a control module, wherein the acquisition module is used for acquiring a plurality of configuration files corresponding to a plurality of simulation devices respectively, and each configuration file is used for indicating the device information of the simulation device corresponding to each configuration file; the first determining module is used for controlling the target interface to determine a first configuration file in the plurality of configuration files according to the control instruction; a second determining module, configured to determine that the target interface passes the test if the first configuration file indicates first device information of the first simulation device.
According to another aspect of the embodiments of the present application, there is also provided a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the method for testing the interface when running.
According to another aspect of the embodiments of the present application, there is also provided an electronic apparatus, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the method for testing the interface through the computer program.
In the embodiment of the application, a control instruction for controlling the first simulation equipment is received through a target interface; acquiring a plurality of configuration files corresponding to a plurality of simulation devices respectively, wherein each configuration file is used for indicating device information of the simulation device corresponding to each configuration file; controlling the target interface to determine a first configuration file in the plurality of configuration files according to the control instruction; determining that the target interface passes the test if the first configuration file indicates first device information of the first simulation device; by adopting the technical scheme, the problems that the virtual equipment is unstable and the offline online condition of the virtual equipment cannot be manually controlled in the test process of equipment selection logic are solved, when interface test is carried out according to the embodiment of the application, the required equipment is written by using a configuration file, and equipment information is comprehensively and stably simulated, for example: the device type, device name, device mac, room, floor, offline online device, etc. any number of devices can be simulated by using the configuration file, and the device state is stable and does not change. The test result of the automatic interface is stable.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.
FIG. 1 is a schematic diagram of a hardware environment of a testing method of an interface according to an embodiment of the present application;
FIG. 2 is a flow chart of a method of testing an interface according to an embodiment of the present application;
FIG. 3 is a flow chart of a method of testing an interface according to an alternative embodiment of the present application;
FIG. 4 is a block diagram (I) of a testing apparatus of an interface according to an embodiment of the present application;
fig. 5 is a block diagram (ii) of a testing apparatus of an interface according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It should be understood that the data so used may be interchanged under appropriate circumstances such that embodiments of the application described herein may be implemented in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to one aspect of the embodiment of the application, a method for testing an interface is provided. The testing method of the interface is widely applied to full-house intelligent digital control application scenes such as Smart Home, intelligent Home equipment ecology, intelligent house (intelligence house) ecology and the like. Alternatively, in this embodiment, the interface testing method may be applied to a hardware environment formed by the terminal device 102 and the server 104 as shown in fig. 1. As shown in fig. 1, the server 104 is connected to the terminal device 102 through a network, and may be configured to provide a service (e.g., an application service) for the terminal or a client installed on the terminal, provide a database on or independent of the server for providing a data storage service for the server 104, and configure a cloud computing and/or edge computing service on or independent of the server for providing a data operation service for the server 104.
The network may include, but is not limited to, at least one of: wired networks, wireless networks. The wired network may include, but is not limited to, at least one of: wide area networks, metropolitan area networks, local area networks, which may include, but are not limited to, at least one of the following: WIFI (Wireless Fidelity ), bluetooth. Terminal equipment 102 can be and not be limited to PC, the cell-phone, the panel computer, intelligent air conditioner, intelligent cigarette machine, intelligent refrigerator, intelligent oven, intelligent kitchen range, intelligent washing machine, intelligent water heater, intelligent washing equipment, intelligent dish washer, intelligent projection equipment, the intelligent TV, intelligent clothes hanger, intelligent (window) curtain, intelligence audio-visual, smart jack, intelligent stereo set, intelligent audio amplifier, intelligent new trend equipment, intelligent kitchen guarding's equipment, intelligent bathroom equipment, the intelligence robot of sweeping the floor, the intelligence robot of wiping the window, intelligence robot of mopping the floor, intelligent air purification equipment, intelligent steam ager, intelligent microwave oven, intelligent kitchen guarding, intelligent clarifier, intelligent water dispenser, intelligent lock etc..
In this embodiment, a method for testing an interface is provided, which is applied to a server, and fig. 2 is a flowchart of a method for testing an interface according to an embodiment of the present application, where the flowchart includes the following steps:
step S202, receiving a control instruction for controlling first simulation equipment through a target interface;
it should be noted that the control command may be a control command such as "turn on a light in a bedroom" or "turn on a light", and further, the control command is used to control the first simulation device, but the control command may not include device identification information uniquely indicating the first simulation device.
Step S204, acquiring a plurality of configuration files corresponding to a plurality of simulation devices respectively, wherein each configuration file is used for indicating the device information of the simulation device corresponding to each configuration file;
wherein the device information includes but is not limited to: the device type, the device name, the device mac, the room, the floor, and the online status of the device, which are not limited in the embodiments of the present invention.
Step S206, controlling the target interface to determine a first configuration file in the plurality of configuration files according to the control instruction;
step S208, determining that the target interface passes the test when the first configuration file indicates the first device information of the first simulation device.
Through the steps, receiving a control instruction for controlling the first simulation equipment through the target interface; acquiring a plurality of configuration files corresponding to a plurality of simulation devices respectively, wherein each configuration file is used for indicating device information of the simulation device corresponding to each configuration file; controlling the target interface to determine a first configuration file in the plurality of configuration files according to the control instruction; when the first configuration file indicates first device information of the first simulation device, it is determined that the target interface passes the test, and thus problems in the related art that, in a test process of device selection logic, virtual devices are unstable, and offline online conditions of the virtual devices cannot be controlled manually are solved, and when the interface test is performed, required devices are written in a configuration file manner, so that the device information is simulated comprehensively and stably, for example: the device type, device name, device mac, room, floor, offline online device, etc. any number of devices can be simulated by using the configuration file, and the device state is stable and does not change. The test result of the automatic interface is stable.
In an exemplary embodiment, the step S206 includes: controlling the target interface to determine a device type of the first simulated device indicated by the control instruction and determine whether the control instruction indicates a first device location of the first simulated device; and under the condition that the control instruction indicates a first device position of the first simulation device, controlling the target interface to determine the first configuration file in the plurality of configuration files according to the device type and the first device position of the first simulation device, wherein the device type and the position information indicated by the first configuration file are respectively consistent with the device type and the position information of the first simulation device.
It should be noted that, the device type included in the control instruction is determined according to the control instruction, and whether the control instruction includes the first device location is determined; and under the condition that the control instruction comprises the equipment type and the first equipment position, determining the first configuration file in the plurality of configuration files according to the equipment type and the first equipment position.
For example, in the case where the control instruction is "turn on the light in the bedroom", determining "the bedroom" as the first device location; the "light" is the device type, and the first profile containing the "bedroom" and the "light" is determined among a plurality of profiles according to the "bedroom" and the "light". Determining the second floor as the first equipment position under the condition that the control instruction is 'turning on the lamp of the second floor'; the "light" is a device type, and a first profile containing "second floor" and "light" is determined among a plurality of profiles according to "second floor" and "light".
Further, under the condition that the number of the first configuration files is multiple, acquiring a second device position of a target interface for determining a sending device sending the control instruction; and determining a sixth configuration file in the plurality of first configuration files according to the device type and the position of the second device.
For example, in the case that the control instruction is "turn on a lamp in a bedroom", determining "the bedroom" as the first device position; the "lamp" is a device type, a plurality of first profiles including "bedroom" and "lamp" are determined in a plurality of profiles according to "bedroom" and "lamp", and it is determined that the transmitting device is located in "bedroom 1", and therefore, a sixth profile including "bedroom 1" and "lamp" is determined in a plurality of first profiles according to "bedroom 1" and "lamp".
In an exemplary embodiment, after controlling the target interface to determine the first configuration file in the plurality of configuration files according to the device type of the first simulated device and the first device location, the method further includes: determining the device state of the simulation device corresponding to the plurality of configuration files under the condition that the first configuration file is a plurality of configuration files, wherein the device state comprises one of the following: online status, offline status; determining a second configuration file in the plurality of first configuration files according to the device type, the first device position and the device state, wherein the second configuration file indicates first device information of the first simulation device.
For example, in the case that the control instruction is "turn on the light of the bedroom 1", determining "the bedroom 1" as the first device position; the "lamp" is the device type, and when the configuration file is multiple, the online status of the multiple "lamps" in the bedroom 1 is obtained, and the second configuration file is determined in the multiple configuration files according to the "bedroom 1", the "lamp", and the online status.
In an exemplary embodiment, after controlling the target interface to determine whether the control instruction indicates a device location of the first simulated device, further comprises: under the condition that the control instruction does not indicate the equipment position of the first simulation equipment, controlling the target interface to determine the equipment identifier of the sending equipment sending the control instruction and determine a second equipment position of the sending equipment; and controlling the target interface to determine the first configuration file in the plurality of configuration files according to the equipment type of the first simulation equipment and the position of the second equipment.
It should be noted that, when the control instruction includes a device type that is large but does not include the first device location, the second device location of the sending device is determined; determining the first profile from the plurality of profiles based on a device type and a second device location.
For example, in the case where the control instruction is "turn on a light", it is determined that the "light" is the device type, but does not contain the first location information, and the second location information of the transmitting device, for example, "second lying 1"; a plurality of first profiles containing "lying sub 1" and "light" are determined among the plurality of profiles according to "lying sub 1" and "light".
In an exemplary embodiment, in a case that a control instruction does not indicate a device location of the first analog device, after controlling the target interface to determine a device identifier of a sending device that sends the control instruction and determine a second device location of the sending device, the method further includes: controlling the target interface to determine whether a third profile exists in the plurality of profiles, wherein the device location indicated by the third profile is consistent with the second device location; determining a third device location of the sending device in the absence of the third profile in the plurality of profiles, wherein area information of the third device location is greater than area information of the second device location; and controlling the target interface to determine the first configuration file in the plurality of configuration files according to the equipment type of the first simulation equipment and the position of the third equipment.
That is to say, when the control instruction does not include the first location information of the first analog device and the second location information where the sending device is located does not include the first analog device, the first configuration file is preferentially determined according to the third location information of the sending device and the device type.
For example, in the case where the control instruction is "turn on the air conditioner", it is determined that "air conditioner" is the device type but does not include the first location information, and the second location information of the transmitting device, for example, "next 1"; determining whether a third profile of "sub-bedroom 1" and "air conditioner" is included in the plurality of profiles according to "sub-bedroom 1" and "air conditioner"; in a case where a third profile of "second bedroom 1" and "air conditioner" is not included in the plurality of profiles, the transmitted third location information, for example, "first floor" is determined; the first profile is preferably determined from "first floor" and "air conditioner".
Further, before controlling the target interface to determine the first configuration file from the plurality of configuration files according to the device type of the first simulation device and the third device location, the method further includes: controlling the target interface to determine whether a fifth profile exists in the plurality of profiles, wherein the device location indicated by the fifth profile is consistent with the third device location; determining a fourth device location of the sending device in the absence of the fifth profile from the plurality of profiles, wherein area information of the fourth device location is greater than area information of the third device location; and controlling the target interface to determine the first configuration file in the plurality of configuration files according to the device type of the first simulation device and the position of the fourth device.
For example, in a case where the control instruction is "turn on the air conditioner", it is determined that "the air conditioner" is the device type, but does not include the first location information, and the second location information of the sending device, for example, "second lying 1"; determining whether a third profile of "second lying 1" and "air conditioner" is included in the plurality of profiles according to "second lying 1" and "air conditioner"; in a case where the third profile of "second lying 1" and "air conditioner" is not included in the plurality of profiles, the transmitted third location information, for example, "first floor" is determined; and determining whether a fifth profile according to "first floor" and "air conditioner" is included in the plurality of profiles; determining fourth location information of a home zone in which the transmitting device is located, in a case where the fifth profile determined from "first floor" and "air conditioner" is not included in the plurality of profiles; and determining the first configuration file in the plurality of configuration files according to the device type of the first simulation device and the position of the fourth device.
In an exemplary embodiment, after determining the second device information of the second simulation device corresponding to the first configuration file, the method further includes: determining that the target interface fails testing if the first configuration file does not indicate first device information for the first simulated device; and generating a test report corresponding to the target interface, and sending the test report to display equipment corresponding to the target interface.
It should be noted that, when an interface fails to pass a test, a corresponding test report is generated and sent to the display device corresponding to the target interface, and a developer improves the target interface according to the test report.
Specifically, a fourth configuration file of the first simulation device is obtained, and first device information of the first simulation device is determined according to the fourth configuration file; determining second equipment information of second simulation equipment corresponding to the first configuration file; determining that the first profile indicates first device information of the first simulated device if the first device information is consistent with the second device information.
That is to say, a preset fourth configuration file of the first simulation device is determined, first device information of the first simulation device is determined according to the fourth configuration file, and second device information of the second simulation device is determined according to the first configuration file; determining whether the first configuration file indicates first device information of the first simulated device according to the first device information and the second device information.
In an exemplary embodiment, after determining that the target interface passes the test, the method further comprises: controlling the first simulation equipment to execute target operation according to the control instruction, and adjusting the working state in a first configuration file of the first simulation equipment according to the target operation; determining whether the adjusted working state is consistent with a preset working state; and under the condition that the adjusted working state is consistent with the preset working state, determining that the first simulation equipment successfully executes the control command.
And under the condition that the first configuration file indicates the equipment information of the first simulation equipment, adjusting the working state in the first configuration file according to the control instruction, and comparing the adjusted working state with a preset working state to determine whether the interface can successfully send the control module to the first simulation equipment or not and whether the first simulation equipment can successfully execute the control instruction or not.
In order to better understand the process of the testing method of the interface, the following describes the flow of the implementation method of the testing of the interface with reference to an optional embodiment, but is not limited to the technical solution of the embodiment of the present application.
In the embodiment, a method for testing an interface is provided, taking the selection of air-conditioning equipment as an example,
1. defining an air conditioning equipment selection logic test:
(1) The speech corpus comprises room information, and the air conditioner of the room is preferentially selected;
(2) The speech corpus comprises room information, online air conditioners and offline air conditioners are arranged in the rooms, and the online air conditioners are preferably selected;
(3) The language material has no room, the room where the speaking sound box is located has an air conditioner, and the air conditioner of the room where the speaking sound box is located is preferentially selected;
(4) If there is no room in the corpus, there is an air conditioner in the room where the voice box is located, and there is an off-line on-line, the on-line air conditioner is preferably selected;
(5) The language material has no room, the room where the speaking sound box is located has no air conditioner, and other rooms on the same floor are preferentially selected to be air-conditioned;
(6) And no room is in the corpus, the room where the speaking sound box is located and the floor where the speaking sound box is located are not provided with air conditioners, and other floors are selected to be provided with air conditioners.
2. Testing air conditioning equipment selection, fig. 3 is a flowchart of a method for testing an interface according to an alternative embodiment of the present application, and as shown in fig. 3, the following steps are specifically performed:
step S301: starting;
step S302: writing a device configuration file, as described in table 1;
TABLE 1
Figure BDA0003825998060000111
Figure BDA0003825998060000121
Step S303: calling an interface, sending a request corpus for device control "turn on kitchen air conditioner" (corresponding to the control command in the above-described embodiment);
step S304: the interface acquires the equipment information respectively corresponding to all the configuration files;
step S305: determining a target configuration file and target equipment information according to the equipment information respectively corresponding to the configuration files;
step S306: judging whether the selected equipment information returned by the interface is the air conditioner 3, if so, passing the test; if not, the test fails.
With the above embodiments, any number of devices are simulated using the configuration file, wherein the device state of the device simulated by the configuration file is stable and does not change. The automatic interface test result is stable, the online state or the offline state of the equipment can be manually controlled, and the scene of the test equipment during offline is facilitated.
Through the description of the foregoing embodiments, it is clear to those skilled in the art that the method according to the foregoing embodiments may be implemented by software plus a necessary general hardware platform, and certainly may also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present application or portions thereof that contribute to the prior art may be embodied in the form of a software product, where the computer software product is stored in a storage medium (such as a ROM/RAM, a magnetic disk, and an optical disk), and includes several instructions for enabling a terminal device (which may be a mobile phone, a computer, a server, or a network device) to execute the method of the embodiments of the present application.
FIG. 4 is a block diagram (I) of a testing apparatus of an interface according to an embodiment of the present application; as shown in fig. 4, includes:
a receiving module 42, configured to receive a control instruction for controlling the first simulation device through the target interface;
an obtaining module 44, configured to obtain a plurality of configuration files corresponding to a plurality of simulation devices, respectively, where each configuration file is used to indicate device information of a simulation device corresponding to each configuration file;
a first determining module 46, configured to control the target interface to determine a first configuration file in the plurality of configuration files according to the control instruction;
a second determining module 48, configured to determine that the target interface passes the test if the first configuration file indicates first device information of the first simulation device.
By the above means, the receiving module 42 receives a control instruction for controlling the first simulation device through the target interface; the obtaining module 44 obtains a plurality of configuration files corresponding to a plurality of simulation devices, wherein each configuration file is used for indicating device information of the simulation device corresponding to each configuration file; the obtaining module 44 is configured to control the target interface to determine a first configuration file in the plurality of configuration files according to the control instruction; 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 simulation device, so as to solve the problems in the related art that, in the test process of the device selection logic, the virtual device is unstable, and the offline online condition of the virtual device cannot be manually controlled, and when the interface test is performed, the required device is written in a configuration file manner, so that the device information is comprehensively and stably simulated, for example: the device type, the device name, the device mac, the room, the floor, the offline online device and the like, any number of devices can be simulated by using the configuration file, and the state of the devices is stable and does not change. The test result of the automatic interface is stable.
In an exemplary embodiment, the first determining module 46 is configured to control the target interface to determine a device type of the first simulation device indicated by the control instruction, and to determine whether the control instruction indicates a first device location of the first simulation device; and under the condition that the control instruction indicates a first device position of the first simulation device, controlling the target interface to determine the first configuration file in the plurality of configuration files according to the device type and the first device position of the first simulation device, wherein the device type and the position information indicated by the first configuration file are respectively consistent with the device type and the position information of the first simulation device.
In an exemplary embodiment, the first determining module 46 is configured to, in a case that the control instruction does not indicate the device location of the first analog device, control the target interface to determine a device identifier of a sending device sending the control instruction, and determine a second device location of the sending device; and controlling the target interface to determine the first configuration file in the plurality of configuration files according to the device type of the first simulation device and the position of the second device.
In an exemplary embodiment, the first determining module 46 is configured to determine, if the first configuration file is multiple, device states of simulated devices corresponding to the multiple configuration files, where the device states include one of: an online state and an offline state; determining a second configuration file in the plurality of first configuration files according to the device type, the first device position and the device state, wherein the second configuration file indicates first device information of the first simulation device.
In an exemplary embodiment, fig. 5 is a block diagram (ii) of a testing apparatus of an interface according to an embodiment of the present application; as shown in fig. 5, includes: a generating module 52, configured to determine that the target interface fails the test if the first configuration file does not indicate first device information of the first simulation device; and generating a test report corresponding to the target interface, and sending the test report to display equipment corresponding to the target interface.
In an exemplary embodiment, the first determining module 46 is configured to control the target interface to determine whether a third configuration file exists in the plurality of configuration files, wherein the device location indicated by the third configuration file is consistent with the second device location; determining a third device location of the sending device in a case that the third profile does not exist in the plurality of profiles, wherein area information of the third device location is larger than area information of the second device location; and controlling the target interface to determine the first configuration file in the plurality of configuration files according to the equipment type of the first simulation equipment and the position of the third equipment.
In an exemplary embodiment, the second determining module is further configured to control the first simulation device to execute a target operation according to the control instruction, and adjust a working state in a first configuration file of the first simulation device according to the target operation; determining whether the adjusted working state is consistent with a preset working state; and under the condition that the adjusted working state is consistent with the preset working state, determining that the first simulation equipment successfully executes the control command.
Embodiments of the present application also provide a storage medium including a stored program, where the program performs any one of the methods described above when executed.
Alternatively, in this embodiment, the storage medium may be configured to store program codes for performing the following steps:
s1, receiving a control instruction for controlling first simulation equipment through a target interface;
s2, acquiring a plurality of configuration files corresponding to a plurality of simulation devices respectively, wherein each configuration file is used for indicating the device information of the simulation device corresponding to each configuration file;
s3, controlling the target interface to determine a first configuration file in the plurality of configuration files according to the control instruction;
determining that the target interface passes the test if the first configuration file indicates first device information of the first simulated device.
Embodiments of the present application further provide an electronic device comprising a memory having a computer program stored therein and a processor configured to execute the computer program to perform the steps of any of the above method embodiments.
Optionally, the electronic apparatus 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.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, receiving a control instruction for controlling first simulation equipment through a target interface;
s2, acquiring a plurality of configuration files corresponding to a plurality of simulation devices respectively, wherein each configuration file is used for indicating the device information of the simulation device corresponding to each configuration file;
s3, controlling the target interface to determine a first configuration file in the plurality of configuration files according to the control instruction;
determining that the target interface passes the test if the first configuration file indicates first device information of the first simulation device.
Optionally, in this embodiment, the storage medium may include but is not limited to: various media capable of storing program codes, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and this embodiment is not described herein again.
It will be apparent to those skilled in the art that the modules or steps of the present application described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a memory device and executed by a computing device, and in some cases, the steps shown or described may be executed out of order, or separately as integrated circuit modules, or multiple modules or steps thereof may be implemented as a single integrated circuit module. Thus, the present application is not limited to any specific combination of hardware and software.
The foregoing is only a preferred embodiment of the present application and it should be noted that, as will be apparent to those skilled in the art, numerous modifications and adaptations can be made without departing from the principles of the present application and such modifications and adaptations are intended to be considered within the scope of the present application.

Claims (10)

1. A method for testing an interface, comprising:
receiving a control instruction for controlling the first simulation equipment through the target interface;
acquiring a plurality of configuration files corresponding to a plurality of simulation devices respectively, wherein each configuration file is used for indicating device information of the simulation device corresponding to each configuration file;
controlling the target interface to determine a first configuration file in the plurality of configuration files according to the control instruction;
determining that the target interface passes the test if the first configuration file indicates first device information of the first simulated device.
2. The method for testing the interface of claim 1, wherein controlling the target interface to determine a first configuration file in the plurality of configuration files according to the control instruction comprises:
controlling the target interface to determine a device type of the first simulation device indicated by the control instruction and determine whether the control instruction indicates a first device location of the first simulation device;
and under the condition that the control instruction indicates a first device position of the first simulation device, controlling the target interface to determine the first configuration file in the plurality of configuration files according to the device type and the first device position of the first simulation device, wherein the device type and the position information indicated by the first configuration file are respectively consistent with the device type and the position information of the first simulation device.
3. The method of testing an interface of claim 2, wherein after controlling the target interface to determine whether the control instruction indicates a device location of the first simulated device, the method further comprises:
under the condition that the control instruction does not indicate the equipment position of the first simulation equipment, controlling the target interface to determine the equipment identifier of the sending equipment sending the control instruction and determine a second equipment position of the sending equipment;
and controlling the target interface to determine the first configuration file in the plurality of configuration files according to the device type of the first simulation device and the position of the second device.
4. The method for testing the interface of claim 3, wherein after controlling the target interface to determine the device identifier of the sending device sending the control instruction and determine the second device location of the sending device, the method further comprises:
controlling the target interface to determine whether a third profile exists in the plurality of profiles, wherein the device location indicated by the third profile is consistent with the second device location;
determining a third device location of the sending device in the absence of the third profile in the plurality of profiles, wherein area information of the third device location is greater than area information of the second device location;
and controlling the target interface to determine the first configuration file in the plurality of configuration files according to the device type of the first simulation device and the position of the third device.
5. The method for testing the interface of claim 2, wherein after 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, the method further comprises:
determining the device state of the simulation device corresponding to the plurality of configuration files under the condition that the first configuration file is a plurality of configuration files, wherein the device state comprises one of the following: an online state and an offline state;
determining a second configuration file in a plurality of first configuration files according to the device type, the first device position and the device state, wherein the second configuration file indicates first device information of the first simulation device.
6. The method for testing an interface of claim 1, further comprising:
determining that the target interface fails the test if the first configuration file does not indicate first device information for the first simulation device;
and generating a test report corresponding to the target interface, and sending the test report to display equipment corresponding to the target interface.
7. The method for testing an interface of any of claims 1-5, wherein after determining that the target interface passes the test, the method further comprises:
controlling the first simulation equipment to execute target operation according to the control instruction, and adjusting the working state in a first configuration file of the first simulation equipment according to the target operation;
determining whether the adjusted working state is consistent with a preset working state;
and under the condition that the adjusted working state is consistent with the preset working state, determining that the first simulation equipment successfully executes the control command.
8. An apparatus for testing an interface, comprising:
the receiving module is used for receiving a control instruction for controlling the first simulation equipment through the target interface;
the simulation system comprises an acquisition module, a processing module and a control module, wherein the acquisition module is used for acquiring a plurality of configuration files corresponding to a plurality of simulation devices respectively, and each configuration file is used for indicating the device information of the simulation device corresponding to each configuration file;
the first determining module is used for controlling the target interface to determine a first configuration file in the plurality of configuration files according to the control instruction;
a second determining module, configured to determine that the target interface passes the test if the first configuration file indicates first device information of the first simulation device.
9. A computer-readable storage medium, comprising a stored program, wherein the program is operable to perform 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 has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 7 by means of the computer program.
CN202211058666.3A 2022-08-31 2022-08-31 Interface test method and device, storage medium and electronic device Pending CN115469638A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211058666.3A CN115469638A (en) 2022-08-31 2022-08-31 Interface test method and device, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211058666.3A CN115469638A (en) 2022-08-31 2022-08-31 Interface test method and device, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN115469638A true CN115469638A (en) 2022-12-13

Family

ID=84368373

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211058666.3A Pending CN115469638A (en) 2022-08-31 2022-08-31 Interface test method and device, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN115469638A (en)

Similar Documents

Publication Publication Date Title
CN111475413B (en) Test method and device
CN114755931A (en) Control instruction prediction method and device, storage medium and electronic device
CN115167164A (en) Method and device for determining equipment scene, storage medium and electronic device
CN115343962A (en) Intelligent household appliance control method and system, intelligent screen and storage medium
CN113111199A (en) Method and device for continuing playing of multimedia resource, storage medium and electronic device
CN114697150B (en) Command issuing method and device, storage medium and electronic device
CN116107975A (en) Control method and device of equipment, storage medium and electronic device
CN115469638A (en) Interface test method and device, storage medium and electronic device
CN116027937A (en) Rendering method and device of component to be edited, storage medium and electronic device
CN115309062A (en) Device control method, device, storage medium, and electronic apparatus
CN115499333A (en) Method, system, storage medium and electronic device for determining association relationship
CN115345225A (en) Method and device for determining recommended scene, storage medium and electronic device
CN112968860B (en) Method and device for managing electronic device
CN115134218A (en) Device replacement method, device, storage medium and server
CN114900826A (en) Equipment binding method and device, storage medium and electronic device
CN115174297A (en) Attribute information updating method and device, storage medium and electronic device
CN115174383B (en) Equipment updating method, storage medium and electronic device
CN115174382B (en) Equipment upgrading method, storage medium and electronic device
CN117877474A (en) Response method and device for controlling voice, storage medium and electronic device
CN115314332A (en) Method and device for setting equipment theme, storage medium and electronic device
CN117376042A (en) Functional platform configuration method and device of intelligent equipment and electronic device
CN116301767A (en) Interface file generation method and device, storage medium and electronic device
CN115616930A (en) Control instruction sending method and device, storage medium and electronic device
CN115357446A (en) Device testing method and device, storage medium and electronic device
CN115484163A (en) System switching method and device, storage medium and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination