CN112491645B - Automatic test method and automatic test equipment - Google Patents

Automatic test method and automatic test equipment Download PDF

Info

Publication number
CN112491645B
CN112491645B CN202011254864.8A CN202011254864A CN112491645B CN 112491645 B CN112491645 B CN 112491645B CN 202011254864 A CN202011254864 A CN 202011254864A CN 112491645 B CN112491645 B CN 112491645B
Authority
CN
China
Prior art keywords
data
protocol
length
data packet
test
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.)
Active
Application number
CN202011254864.8A
Other languages
Chinese (zh)
Other versions
CN112491645A (en
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.)
Shenzhen Shuliantianxia Intelligent Technology Co Ltd
Original Assignee
Shenzhen Shuliantianxia Intelligent Technology 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 Shenzhen Shuliantianxia Intelligent Technology Co Ltd filed Critical Shenzhen Shuliantianxia Intelligent Technology Co Ltd
Priority to CN202011254864.8A priority Critical patent/CN112491645B/en
Publication of CN112491645A publication Critical patent/CN112491645A/en
Application granted granted Critical
Publication of CN112491645B publication Critical patent/CN112491645B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Communication Control (AREA)

Abstract

The invention relates to the field of testing, and discloses an automatic testing method which is applied to automatic testing equipment. The method comprises the following steps: acquiring a preset protocol format, a data protocol and a test configuration parameter; calculating protocol format length, data protocol length and data packet length according to the protocol format and the data protocol; performing data packet packing according to the protocol format length, the data protocol length and the data packet length to obtain a data packet; sending a data packet to the WIFI module through the serial port according to the test configuration parameters; acquiring a response data packet sent by the WIFI module; according to the method, a user can freely combine the protocol formats according to the requirement and self-define the data protocol, the whole test process is full-automatic, and the method not only has strong universality, but also can quickly test the communication stability and reliability.

Description

Automatic test method and automatic test equipment
Technical Field
The invention relates to the field of testing, in particular to an automatic testing method and automatic testing equipment.
Background
The serial port is a data transmission channel between a commonly used computer and external serial equipment, and the serial communication is convenient and easy, so that the serial port is widely applied. In the artificial intelligence thing networking trade, local function control MCU singlechip also adopts serial communication with the wiFi module to carry out output transmission.
Traditional serial port test is through using the operation of common serial ports host computer on the PC to carry out single or customization's serial communication test through the data of the actual MCU singlechip of manual simulation, but because the data volume is increaseed suddenly, the improvement of communication rate just needs to pass through various circumstances of manual simulation, leads to the serial communication stability of wiFi module, and the reliability problem is salient day by day. In addition, the traditional test mode can only be used for specific products and has no universality because the data format of communication is limited in advance.
Disclosure of Invention
In view of the above, it is necessary to provide an automatic testing method and an automatic testing apparatus, which have versatility and can quickly test communication stability and reliability.
In a first aspect, an embodiment of the present invention provides an automatic test method, which is applied to an automatic test device, and the method includes:
acquiring a preset protocol format, a data protocol and a test configuration parameter;
calculating protocol format length, data protocol length and data packet length according to the protocol format and the data protocol;
performing data packet packing according to the protocol format length, the data protocol length and the data packet length to obtain a data packet;
sending the data packet to a WIF I module through a serial port according to the test configuration parameters;
acquiring a response data packet sent by the WIF I module;
and determining a test result according to the sending data packet and the response data packet.
In some embodiments, the method further comprises:
and presetting a protocol format template and a data protocol template.
In some embodiments, the obtaining preset protocol format, data protocol and test configuration parameters includes:
importing the protocol format template and the data protocol template;
displaying the protocol format template and the parameters of the data protocol template on a setting interface;
and acquiring the preset protocol format, the data protocol and the test configuration parameters according to the modification of the setting interface by the user.
In some embodiments, after calculating a protocol format length, a data protocol length, and a packet length according to the protocol format and the data protocol, the method comprises:
judging whether a printing window is opened or not;
if the printing window is opened, judging whether a test mode is started;
and if the test mode is started, performing data packet packing according to the protocol format length, the data protocol length and the data packet length to obtain a data packet.
In some embodiments, said performing data packet packing according to the protocol format length, the data protocol length, and the data packet length to obtain a data packet includes:
automatically generating a packet sequence number and a check code according to the protocol format length, the data protocol length and the data packet length;
acquiring a package sequence;
and generating data packets according to the group packet sequence.
In some embodiments, the test configuration parameters include a packet transmission step interval,
the sending the data packet to the WI F I module through a serial port according to the test configuration parameters comprises:
starting a serial port;
and sending the data packet to a WIF I module through a serial port based on the data packet sending stepping interval.
In some embodiments, after determining the test result according to the transmission data packet and the response data packet, the method further comprises:
and saving the test result.
In some embodiments, after saving the test result, the method further comprises:
judging whether the test mode is closed or not;
if the test mode is closed, ending the test;
and if the test mode is not closed, continuing to execute the step of judging whether the test mode is closed or not.
In a second aspect, an embodiment of the present invention further provides an automated testing apparatus, including:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the automated testing method described above.
In a third aspect, the present invention also provides a non-transitory computer-readable storage medium, where the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the processor is caused to execute the above automated testing method.
Compared with the prior art, the invention has the beneficial effects that: different from the situation of the prior art, the automatic test method and the automatic test equipment in the embodiment of the invention calculate the protocol format length, the data protocol length and the data packet length based on the protocol format and the data protocol by obtaining the preset protocol format, the preset data protocol and the preset test configuration parameters, then perform data packet packing according to the protocol format length, the preset data protocol length and the preset data protocol length, obtain a data packet, then send the data packet to the Wi Fi module through a serial port according to the test configuration parameters, further obtain a response data packet sent by the Wi Fi module, and determine the test result according to the sent data packet and the response data packet, so that a user can freely combine the protocol formats according to the requirement, customize the data protocol and fully automate the whole test process, the method has strong universality and can quickly test the communication stability and reliability.
Drawings
One or more embodiments are illustrated by way of example in the accompanying drawings, which correspond to the figures in which like reference numerals refer to similar elements and which are not to scale unless otherwise specified.
FIG. 1 is a schematic diagram of an application scenario of an automated testing method according to an embodiment of the present invention;
FIG. 2 is a schematic flow diagram of an automated testing method in accordance with an embodiment of the invention;
FIG. 3 is a schematic flow chart of obtaining preset protocol formats, data protocols, and test configuration parameters in one embodiment of the present invention;
FIG. 4 is a schematic interface diagram of automated test equipment in one embodiment of the invention;
FIG. 5 is a schematic flow chart of an automated testing method according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of an automated test equipment according to an embodiment of the present invention;
FIG. 7 is a diagram of a hardware configuration of an automated test equipment in an embodiment of the invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. 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 invention.
It should be noted that, if not conflicted, the various features of the embodiments of the invention may be combined with each other within the scope of protection of the invention. Additionally, while functional block divisions are performed in apparatus schematics, with logical sequences shown in flowcharts, in some cases, steps shown or described may be performed in sequences other than block divisions in apparatus or flowcharts. The terms "first", "second", "third", and the like used in the present invention do not limit data and execution order, but distinguish the same items or similar items having substantially the same function and action.
The automatic test method provided by the invention is suitable for the application environment shown in figure 1, and comprises automatic test equipment and a Wi Fi module. Fig. 1 schematically shows an automated test equipment 10 and a Wi Fi module 20, where the automated test equipment 10 and the Wi Fi module 20 are connected by a serial line. Wherein, automatic test equipment 10 can operate on the PC computer, automatic test equipment for example can be the host computer, Wi Fi module 20 for example can be the Wi Fi module in intelligent household appliances such as champignon machine, bright lamp champignon machine. The Wi Fi module 20 is configured to receive a data packet sent by the automatic test equipment 10, and send a response data packet to the automatic test equipment 10 based on the received data packet, so that the automatic test equipment 10 calculates a test result according to the send data packet and the response data packet.
It should be noted that the method provided by the embodiment of the present invention may be further extended to other suitable application environments, and is not limited to the application environment shown in fig. 1. In an actual application process, the application environment can also comprise more or less automatic test equipment and Wi Fi modules.
As shown in fig. 2, an embodiment of the present invention provides an automatic test method, which is applied to an automatic test device, and the method includes:
step 202, acquiring a preset protocol format, a data protocol and a test configuration parameter.
In the embodiment of the invention, the protocol format is a format to which all data is required to follow from the beginning byte to the end byte of the data packet. Illustratively, the protocol format includes, but is not limited to, a packet header, a data length, a protocol version, a packet sequence number, a status bit, a reserved word, a data type, a check code checking method, and the like. Some protocol formats are fixed by default and some are obtained by calculation according to a template imported subsequently. Illustratively, the protocol version in the protocol format defaults to a fixed version, the reserved byte length defaults to 0x00 bytes, the packet header defaults to a fixed byte, the packet header may be, for example, 5A, FF, AE, etc., when both communication parties receive a data packet with bytes similar to 5A, FF, AE, they deem to be the start of a packet of data, and the data area byte length and the command byte length need to be automatically calculated according to a subsequently imported template. The packet sequence number is used to indicate the transmission sequence of the data packet, the reserved word is used to reserve bytes for the subsequent development of new functions, the data type may be control data, status data, etc., the check code checking method may be CRC-8, CRC-16/X25, etc., and the check code verifying method is used to check the data packet.
The data protocol is communication content designated by a user, and the communication content is different and the expressed meaning is different. The test configuration parameters are used for simulating normal serial port communication between the automatic test equipment and the Wi Fi module, and can be parameters such as serial port numbers, baud rates, data bits and stop bits. The serial port number is a serial interface number, and the automatic test equipment generally has two serial port numbers COM1 and COM2 and is mainly used for serial bitwise metadata transmission. The baud rate is used to indicate how much symbol data the automated test equipment has transmitted in one second, the data bits are used to indicate the number of data bits that a group of data actually contains, and the stop bit is used to indicate the end of a character transfer.
Specifically, the automated testing equipment acquires a protocol format, a data protocol and testing configuration parameters which are pre-configured by a user.
As an implementation of step 202, as shown in fig. 3, the method includes:
step 302, importing the protocol format template and the data protocol template.
In the embodiment of the invention, the subsequent user can conveniently configure the data protocol, and the protocol format template and the data protocol template need to be preset. The protocol format templates and data protocol templates may be in the form of EXCEL tables, for example. Specifically, the protocol format EXCEL form template is formulated in advance based on a product of a certain company, and comprises a packet header, a data length, a protocol version, a packet sequence number, a state bit, a reserved word, a data type, a check code check mode and the like, wherein the packet header defaults to a fixed byte, the byte length of the packet header is 1, the protocol version defaults to a fixed version, the byte length of the packet header is 2, the reserved word defaults to a fixed byte, the byte length of the reserved word is 2, the data length, a data area and the like are determined in advance according to the product of the certain company, for example, the byte length of the data length is 2, and the byte length of the data area is 2. The EXCEL form template of the data protocol comprises byte number, variable description, variable identification, data type, numerical range, space, multiple, unit, reserved word and the like. Illustratively, if the variable is described as a color, the corresponding variable identifier is co l or, the data type is LONG, and the data range is 1-red light and 2-green light. Or, the variable in the data protocol is described as light adjustment, and the variable is identified as l i lightContro l, the data type is LONG, the data range is 0-light out, and the like.
Specifically, the user can configure the data protocol according to the requirement of the company to form a set of communication protocol format used by the company product. Specifically, a user fills in an actual protocol format and a data protocol of the user on an automatic testing device, namely a protocol format template and a data protocol template preset by an upper computer, by exporting the protocol format template and the data protocol template, and then imports the filled protocol format template and the filled data protocol template into the automatic testing device. And displaying the imported protocol format template and the imported data protocol template on a setting interface of the automatic test equipment, wherein the packet header, the protocol version, the reserved words and the like are unchanged, and the data length and the required parameters of the data area need to be recalculated and determined according to the protocol format template and the data protocol template imported by a user.
And 304, displaying the parameters of the protocol format template and the data protocol template on a setting interface.
In the embodiment of the invention, as shown in fig. 4, an automatic test device is developed through VS + C, a window is directly built by using Wi windows application (NET frame) improved by VS, and the whole interface is divided into two blocks: set interface (not scalable) + print window (scalable). The setting interface is used for displaying configuration information, and the printing window is used for displaying reply information of the Wi F i module and the like. Specifically, after the protocol format template and the data protocol template are imported into the automatic test equipment, the parameters of the protocol format template and the parameters of the data protocol template are displayed on a setting interface of the automatic test equipment. The parameters of the protocol format template and the parameters of the data protocol template are byte lengths after byte names. Illustratively, the parameters of the protocol format template are, for example, the byte length 1 of the packet header, the byte length 2 of the packet sequence number, and the like.
And step 306, acquiring the preset protocol format, the data protocol and the test configuration parameters according to the modification of the setting interface by the user.
In the embodiment of the invention, after the user imports the protocol format template and the data protocol template into the automatic test equipment, the user can also modify the protocol format and the data protocol which are filled in advance in the setting interface of the automatic test equipment, and then the automatic test equipment obtains the preset protocol format, the preset data protocol and the preset test configuration parameters according to the modification of the setting interface by the user for the subsequent calculation of the length of the data packet. For example, as shown in fig. 4, the byte length of the packet sequence number of the current setting interface is 2, and the user may modify the packet sequence number to 1 according to the requirement, or may modify the data packet transmission stepping interval from 20 ms/time to 40 ms/time, and then the automatic test equipment obtains the preset protocol format, data protocol, and test configuration parameters according to the modification of the user.
And step 204, calculating the protocol format length, the data protocol length and the data packet length according to the protocol format and the data protocol.
To know how many bytes of the data packet sent this time, it needs to be determined by the length of the data packet, specifically, how many bytes of the data packet are known by the length of the data packet, and after receiving the specified length of bytes, it means that the data packet is completely received this time. Therefore, the automated test equipment calls an algorithm to automatically calculate the protocol format length, the data protocol length, and the packet length based on the protocol format and the data protocol. Specifically, because the protocol format and the data protocol are imported in the form of EXCEL table, the location where the data is stored is determined first by using a code summation formula, which is as follows:
Mi crosoft.Off i ce.I nterop.Exce l.Rangec1=exce l.Ce l l s[row][c o l umn];
Mi crosoft.Off i ce.I nterop.Exce l.Rangec2=exce l.Ce l l s[row][c o l umn];
Mi crosoft.Off i ce.I nterop.Exce l.Range range=(Mi crosoft.Off i ce.I nterop.Exce l.Range)exce l.get_Range(c1,c2);
wherein c1, c2 represent data storage areas, wherein c1 represents the upper left of the area, and c2 represents the lower right of the area; ce l l s [ i ] [ j ] where i represents a column and j represents a row.
After the data storage area is determined, a function Str i ng. concat ("═ SUM (C" + co l umn, ": or" V "+ co l umn,") is called in the determined area to directly calculate a column total byte data, thereby obtaining a protocol format length and a data protocol length.
Further, the packet length is protocol format length + data protocol length-the calculation of the hooked participating byte length on the setup page. The protocol format length, the data protocol length and the data packet length can be obtained through the method.
In some embodiments, after said calculating a protocol format length, a data protocol length, and a packet length according to said protocol format and said data protocol, said method further comprises:
judging whether a printing window is opened or not; if the printing window is opened, judging whether a test mode is started; and if the test mode is started, performing data packet packing according to the protocol format length, the data protocol length and the data packet length to obtain a data packet.
Specifically, the data packet package needs to satisfy two conditions, one is that the printing window is in an open state, and the other is that the test mode is in a start state, and only if the two conditions are both satisfied, the automatic test equipment will perform the data packet package.
And step 206, performing data packet packing according to the protocol format length, the data protocol length and the data packet length to obtain a data packet.
Specifically, the length of the data packet can be obtained by calculating the length of the participated bytes selected on the setting page by using the protocol format length + the data protocol length. And automatically packaging the data packet based on the data packet length to obtain the data packet. Illustratively, the data packet may be, for example:
5A 00 16 10 79 00 00 00 02 03 00 02 08 00 00 00 00 00 00 00 00 1A 73。
as an implementation of step 206, the method includes automatically generating a packet sequence number and a check code according to the protocol format length, the data protocol length, and the data packet length; acquiring a packaging sequence; and generating data packets according to the group packet sequence.
In order to ensure the reliability of data, a check code is added into each packet of data, the check code is generated by calculating the length of the data packet and the content of the data packet, and the generated check codes are different for different lengths of the data packet and the content of the data packet. The check code is generally arranged at the tail of the data packet, different check code modes require that the byte length of the data packet is an integral multiple of N, the automatic test equipment automatically calculates the byte length of the data packet, and when the byte length of the data packet does not meet the multiple of N, 0 is automatically supplemented after the data defined by the user so as to form the data packet which the user wants. Illustratively, the CRC-8 check mode requires a multiple of the data packet length of 8, the CRC-16 check mode requires a multiple of the data packet length of 16, and when the byte length does not satisfy the check requirement, the data is automatically complemented by 0.
Meanwhile, since the number of data packets is large, a packet sequence number needs to be generated for each data packet to identify the transmission sequence of the data packet. Further, the package group sequence is the sequence that the user has selected when configuring the data protocol in the previous period according to the requirement. Specifically, an algorithm is built in the automatic test equipment, and specifically, in the embodiment of the present invention, the algorithm is: x + ((0 ═ X% 16)): 0. The algorithm can ensure that the final data packet is a multiple of 16, and the final data packet is automatically complemented if the final data packet is not a multiple of 16. The check code is automatically generated in the above mode, then the packaging sequence is obtained, and then the complete data packet is generated according to the packaging sequence.
And step 208, sending the data packet to a WIF I module through a serial port according to the test configuration parameters.
The automatic test equipment and the Wi Fi module want to communicate normally, and both communication sides need to match the same bit rate, data bits and the like. In the embodiment of the invention, the default is that the automatic test equipment and the WiFi module are matched in advance, and after the automatic test equipment acquires a data packet, the data packet is sent to the WiFi module through the serial port according to the test configuration parameters.
As an implementation of step 208, the method comprises:
starting a serial port; and sending the data packet to a WI FI module through a serial port based on the data packet sending stepping interval.
The test configuration parameters include a transmission stepping interval. Illustratively, if the user configuration option is 1024 bytes per packet, the step is 100ms transmission interval, the number of transmission packets is 500, and the maximum transmission interval is 5 seconds, then the byte length of data transmission of each packet of the automated test equipment is: 1024 bytes/packet, and in the same data packet transmission interval (for example, 100ms for the first time), after 500 packets are continuously transmitted, the data packet transmission interval is automatically increased by 100 ms. Specifically, the automatic test equipment starts a serial port and automatically sends data packets to the WiFi module through the serial port based on the data packet sending step interval. Further, the user can also automatically change the sending step interval according to the requirement to carry out the WiFi module serial port data communication test.
And step 210, acquiring the response data packet sent by the WIF I module.
Specifically, when the automated testing equipment and the WiFi module are in a state of being capable of sending data to each other through the serial port, data content sent by the other side needs to be analyzed, in order to ensure effective and reliable communication, data packets are defined as a protocol format and a data protocol, the protocol format defines a framework of data interaction, and the data protocol is some control executed by the automated testing equipment. After the data packet is sent to the WiFi module, if the length byte or the frequency of the data packet is within the processing range of the Wi Fi module, the WiFi module can automatically return a response data packet, and further, the automatic test equipment acquires the response data packet sent by the WiFi module. In other embodiments, if the WiFi module does not answer the data packet sent by the automated testing equipment, it is determined that the processing of the current data packet WiFi module fails.
Step 212, determining a test result according to the transmission data packet and the response data packet.
The test result comprises the data packet sending success rate and the packet loss rate. The success rate of sending the data packets is equal to the number of response data packets/the number of sending data packets x 100%, and the packet loss rate is equal to 100% -the success rate of sending the data packets. Specifically, after the automatic test equipment acquires a response data packet sent by the Wi Fi module, a test result is obtained by calculating the sent data packet and the response data packet. Further, when the packet loss rate is greater than 10%, the communication is considered to be unreliable.
In the embodiment of the invention, by acquiring the preset protocol format, data protocol and test configuration parameters, calculating the protocol format length, the data protocol length and the data packet length based on the protocol format and the data protocol, then according to the protocol format length, the data protocol length and the data packet length, performing data packet packaging to obtain a data packet, then sending the data packet to a WiFi module through a serial port according to the test configuration parameters, further acquiring a response data packet sent by the WiFi module, determining a test result according to the sending data packet and the response data packet, by the method, the user can freely combine the protocol formats according to the requirement and customize the data protocol, and the whole testing process is full-automatic, so that the method not only has strong universality, but also can quickly test the communication stability and reliability.
In some embodiments, after determining the test result according to the transmission data packet and the response data packet, the method further comprises: and saving the test result.
Specifically, after determining the test result according to the transmission data packet and the response data packet, the test result is stored according to a log format, for example, as follows: data packet transmission byte length, data packet transmission interval, transmission packet number, success rate and packet loss rate.
In some other embodiments, after saving the test result, the method further comprises: judging whether the test mode is closed or not; if the test mode is closed, ending the test; and if the test mode is not closed, continuing to execute the step of judging whether the test mode is closed or not.
In the embodiment of the invention, the test between the automatic test equipment and the WiFi module is ended only after the test mode is closed. Specifically, the automatic test equipment judges whether the test mode is closed, and if the test mode is closed, the test is ended; if the test mode is not closed, the automatic test equipment continues to execute the step of judging whether the test mode is closed until the test mode is closed.
In order that the invention may be readily understood, reference will now be made in detail to the invention, as illustrated in figure 5,
s500, importing the protocol format template and the data protocol template, and turning to S501;
s501, displaying the protocol format template and the parameters of the data protocol template on a setting interface, and turning to S502;
s502, the preset protocol format, the data protocol and the test configuration parameters are obtained according to the modification of the setting interface by the user, and the operation goes to S503;
s503, calculating the protocol format length, the data protocol length and the data packet length according to the protocol format and the data protocol, and turning to S504;
s504, judging whether a printing window is opened or not, if so, turning to S505, otherwise, turning to S504;
s505, judging whether a test mode is started, if the test mode is started, turning to S506, and if not, turning to S505;
s506, automatically generating a packet sequence number and a check code according to the protocol format length, the data protocol length and the data packet length, and turning to S507;
s507, acquiring a packaging sequence, and turning to S508;
s508, generating a data packet according to the packet packaging sequence, and turning to S509;
s509, starting a serial port, and turning to S510;
s510, sending the data packet to a WIF I module through a serial port based on the data packet sending stepping interval, and turning to S511;
s511, acquiring a response data packet sent by the WIF I module, and turning to S512;
s512, determining a test result according to the sending data packet and the response data packet, and turning to S513;
s513, storing the test result, and turning to S514;
s514, judging whether the test mode is closed, if so, turning to S515, otherwise, turning to S514;
and S515, ending the test.
Correspondingly, an embodiment of the present invention further provides an automatic testing apparatus 600, as shown in fig. 6, including:
a first obtaining module 602, configured to obtain a preset protocol format, a preset data protocol, and preset test configuration parameters;
a calculating module 604, configured to calculate a protocol format length, a data protocol length, and a data packet length according to the protocol format and the data protocol;
a packaging module 606, configured to package data according to the protocol format length, the data protocol length, and the data packet length to obtain a data packet;
a sending module 608, configured to send the data packet to the WI F I module through a serial port according to the test configuration parameter;
a second obtaining module 610, configured to obtain a response packet sent by the WI F I module;
a determining module 612, configured to determine a test result according to the sending data packet and the response data packet.
In the embodiment of the invention, a first acquisition module is used for acquiring a preset protocol format, a data protocol and a test configuration parameter; then calculating the protocol format length, the data protocol length and the data packet length according to the protocol format and the data protocol through a calculation module; then, data packing is carried out through a packing module according to the protocol format length, the data protocol length and the data packet length to obtain a data packet; further, the data packet is sent to the WI FI module through a serial port according to the test configuration parameters through a sending module; then, a response data packet sent by the WI FI module is obtained through a second obtaining module; finally, determining a test result according to the sending data packet and the response data packet through a determining module; by the method, the user can freely combine the protocol formats according to the requirement, the data protocol is customized, the whole testing process is full-automatic, and the method not only has strong universality, but also can quickly test the communication stability and reliability.
Optionally, in another embodiment of the apparatus, as shown in fig. 6, the apparatus 600 further includes:
the setting module 614 is configured to preset a protocol format template and a data protocol template.
Optionally, in another embodiment of the apparatus, as shown in fig. 6, the apparatus 600 further includes:
a judging module 616, configured to judge whether the printing window is opened; if the printing window is opened, judging whether a test mode is started; and if the test mode is started, performing data packet packing according to the protocol format length, the data protocol length and the data packet length to obtain a data packet. Judging whether the test mode is closed or not; if the test mode is closed, ending the test; and if the test mode is not closed, continuing to execute the step of judging whether the test mode is closed or not.
Optionally, in another embodiment of the apparatus, as shown in fig. 6, the apparatus 600 further includes:
the saving module 618 is configured to save the test result.
Optionally, in other embodiments of the apparatus, the first obtaining module 602 is specifically configured to:
importing the protocol format template and the data protocol template;
displaying the protocol format template and the parameters of the data protocol template on a setting interface;
and acquiring the preset protocol format, the data protocol and the test configuration parameters according to the modification of the setting interface by the user.
Optionally, in other embodiments of the apparatus, the group package module 606 is specifically configured to:
automatically generating a packet sequence number and a check code according to the protocol format length, the data protocol length and the data packet length;
acquiring a packaging sequence;
and generating data packets according to the group packet sequence.
Optionally, in other embodiments of the apparatus, the sending module 608 is specifically configured to:
the test configuration parameters include a packet transmission step interval,
starting a serial port;
and sending the data packet to a WIF I module through a serial port based on the data packet sending stepping interval.
It should be noted that the automatic testing apparatus of the present invention may execute the automatic testing method provided by the embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
Fig. 7 is a schematic diagram of a hardware structure of an automatic test device according to an embodiment of the present invention, and as shown in fig. 7, the automatic test device 700 includes:
one or more processors 702 and memory 704, one processor 702 being illustrated in FIG. 7.
The processor 702 and the memory 704 may be connected by a bus or other means, such as by a bus in FIG. 7.
The memory 704 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as program instructions/modules corresponding to the automated testing method in the embodiments of the present invention. The processor 702 executes various functional applications and data processing of the automated testing equipment by executing nonvolatile software programs, instructions, and modules stored in the memory 704, that is, implements the automated testing method in the above-described embodiment.
The memory 704 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the automated test equipment, and the like. Further, the memory 704 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some embodiments, the memory 704 may optionally include memory located remotely from the processor 702, which may be connected to the automated test equipment via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
Embodiments of the present invention also provide a non-transitory computer-readable storage medium, where computer-executable instructions are stored, and when executed by one or more processors, may cause the one or more processors to perform an automated testing method in any of the above method embodiments.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a general hardware platform, and certainly can also be implemented by hardware. It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware related to instructions of a computer program, which can be stored in a computer readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-only Memory (ROM), a Random Access Memory (RAM), or the like.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; within the idea of the invention, also technical features in the above embodiments or in different embodiments may be combined, steps may be implemented in any order, and there are many other variations of the different aspects of the invention as described above, which are not provided in detail for the sake of brevity; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (9)

1. An automated testing method applied to automated testing equipment is characterized by comprising the following steps:
presetting a protocol format template and a data protocol template;
respectively filling a protocol format to be tested and a data format into the protocol format template and the data protocol template to obtain the protocol format template to be tested and the data protocol template to be tested, wherein the data protocol template is in an Excel format and comprises byte numbers, variable description, variable identification, data types, numerical value ranges, intervals, multiples, units and whether words are reserved or not;
acquiring the protocol format, the data protocol and the test configuration parameters;
calculating a protocol format length, a data protocol length and a data packet length according to the protocol format and the data protocol;
performing data packet packing according to the protocol format length, the data protocol length and the data packet length to obtain a data packet;
sending the data packet to a WIFI module through a serial port according to the test configuration parameters;
acquiring a response data packet sent by the WIFI module;
and determining a test result according to the sending data packet and the response data packet.
2. The method of claim 1, wherein obtaining the protocol format, the data protocol, and the test configuration parameters comprises:
importing the protocol format template to be tested and the data protocol template to be tested;
displaying the protocol format template to be tested and the parameters of the data protocol template to be tested on a setting interface;
and acquiring the protocol format, the data protocol and the test configuration parameters according to the modification of the setting interface by the user.
3. The method of claim 2, wherein after calculating a protocol format length, a data protocol length, and a packet length based on the protocol format and the data protocol, the method further comprises:
judging whether a printing window is opened or not;
if the printing window is opened, judging whether a test mode is started;
and if the test mode is started, performing data packet packing according to the protocol format length, the data protocol length and the data packet length to obtain a data packet.
4. The method of claim 1, wherein said packing data packets according to the protocol format length, the data protocol length, and the data packet length to obtain data packets comprises:
automatically generating a packet sequence number and a check code according to the protocol format length, the data protocol length and the data packet length;
acquiring a package sequence;
and generating data packets according to the group packet sequence.
5. The method of claim 1, wherein the test configuration parameters include a packet transmission stepping interval,
the sending the data packet to the WIFI module through a serial port according to the test configuration parameters comprises:
starting a serial port;
and sending the data packet to the WIFI module through a serial port based on the data packet sending stepping interval.
6. The method of any of claims 1-5, wherein after determining the test result from the transmit data packet and the reply data packet, the method further comprises:
and saving the test result.
7. The method of claim 6, wherein after saving the test results, the method further comprises:
judging whether the test mode is closed or not;
if the test mode is closed, ending the test;
and if the test mode is not closed, continuing to execute the step of judging whether the test mode is closed or not.
8. An automated test apparatus, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-7.
9. A non-transitory computer-readable storage medium having stored thereon computer-executable instructions that, when executed by a processor, cause the processor to perform the method of any one of claims 1-7.
CN202011254864.8A 2020-11-11 2020-11-11 Automatic test method and automatic test equipment Active CN112491645B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011254864.8A CN112491645B (en) 2020-11-11 2020-11-11 Automatic test method and automatic test equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011254864.8A CN112491645B (en) 2020-11-11 2020-11-11 Automatic test method and automatic test equipment

Publications (2)

Publication Number Publication Date
CN112491645A CN112491645A (en) 2021-03-12
CN112491645B true CN112491645B (en) 2022-08-30

Family

ID=74929588

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011254864.8A Active CN112491645B (en) 2020-11-11 2020-11-11 Automatic test method and automatic test equipment

Country Status (1)

Country Link
CN (1) CN112491645B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112948194B (en) * 2021-03-15 2023-08-15 中国联合网络通信集团有限公司 Communication protocol testing method and device
CN113377362B (en) * 2021-07-14 2022-05-17 深圳市集贤科技有限公司 Automatic source code generation and adaptation method for private protocol analysis of electric control end
CN114070753B (en) * 2021-10-12 2023-03-21 山东有人物联网股份有限公司 Transparent transmission equipment testing method and device and computer readable storage medium
CN114090117A (en) * 2021-11-10 2022-02-25 深圳Tcl新技术有限公司 Configuration method, device, equipment and storage medium
CN114338487B (en) * 2021-12-17 2023-06-20 国网电力科学研究院有限公司 Communication protocol testing device and method for low-voltage intelligent circuit breaker

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2189862A1 (en) * 2008-11-20 2010-05-26 Siemens Aktiengesellschaft Method for operating an automation device, automation device using the procedure and automation system with such a device
CN104734900B (en) * 2013-12-21 2019-05-17 北京市腾河智慧能源科技有限公司 A kind of sending control method of communication protocol test
CN109815107B (en) * 2017-11-22 2022-06-07 北京京东尚科信息技术有限公司 Method and device for automatic testing
CN108833333B (en) * 2018-04-12 2020-07-10 中国科学院信息工程研究所 Honeypot system based on DCS distributed control
CN109376042A (en) * 2018-10-12 2019-02-22 华自科技股份有限公司 Serial ports test method, device, communication manager and storage medium
CN109450730A (en) * 2018-11-09 2019-03-08 中电科仪器仪表有限公司 A kind of dynamic application layer protocol test method based on standard data interchange format
CN109739747A (en) * 2018-12-13 2019-05-10 西安现代控制技术研究所 A kind of general analytic method of serial communication information protocol

Also Published As

Publication number Publication date
CN112491645A (en) 2021-03-12

Similar Documents

Publication Publication Date Title
CN112491645B (en) Automatic test method and automatic test equipment
CN111404883B (en) Method and device for analyzing Internet of things equipment universal protocol
CN112104654A (en) Multi-protocol automatic identification and conversion method and intelligent gateway
CN102761391B (en) Oil field Internet of Things system communication method
CN111526606B (en) Method and device for data transmission, smart home equipment and storage medium
EP3073698A1 (en) Method for processing address resolution protocol message, forwarder and controller
CN114362885B (en) Data transmission method, communication system, equipment and medium of Internet of things
CN102053935A (en) MODBUS serial communication protocol-based communication method
CN110224913A (en) Data transmission method, device, data transmission system and equipment
CN115065732B (en) Data transmission method, device, electronic setting and storage medium
CN110166467A (en) The cross-platform control method of PLC based on HTML_WEB gateway
CN109214895A (en) A kind of game resource promotion method, apparatus and system
CN108600150A (en) The data acquisition flow method of data acquisition platform and internet-of-things terminal cooperation
CN111555984A (en) Method and device for data transmission, smart home equipment and storage medium
CN110750478A (en) Multi-serial port communication method and system
US10776536B2 (en) Method for generating a Petri Net simulation model of an industrial control system
CN104717109A (en) Simulation testing method and system for wide area network links
CN117472387B (en) Method and device for dynamically analyzing data and cloud platform
CN107005917B (en) Method, device, terminal and router for establishing communication
CN106980301B (en) Communication means and device
CN112015435A (en) Data transmission method for online debugging of converter
CN112887277A (en) Conversion method and device of field bus and Ethernet and computer storage medium
CN109873742B (en) Simulation control method and device for FC-AE bus
CN111556535A (en) Communication method, communication device, electronic apparatus, and storage medium
CN209994400U (en) Program file downloading and programming 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
GR01 Patent grant
GR01 Patent grant