CN106330593B - Protocol detection method and device - Google Patents
Protocol detection method and device Download PDFInfo
- Publication number
- CN106330593B CN106330593B CN201510379789.0A CN201510379789A CN106330593B CN 106330593 B CN106330593 B CN 106330593B CN 201510379789 A CN201510379789 A CN 201510379789A CN 106330593 B CN106330593 B CN 106330593B
- Authority
- CN
- China
- Prior art keywords
- protocol
- tested
- test
- command
- document
- 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
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/18—Protocol analysers
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/22—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks comprising specially adapted graphical user interfaces [GUI]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Human Computer Interaction (AREA)
- Maintenance And Management Of Digital Transmission (AREA)
- Computer And Data Communications (AREA)
- Communication Control (AREA)
Abstract
The invention provides a protocol detection method and a device, wherein the method comprises the following steps: the test platform receives a plurality of protocols to be tested; the test platform generates a test command corresponding to the protocol to be tested according to the protocol to be tested; the test platform detects the protocol to be tested according to the test command; the protocol to be tested comprises a protocol document and a protocol code. The invention solves the problem of how to effectively test the communication protocol of the power supply equipment for communication in the related technology, thereby improving the protocol testing efficiency.
Description
Technical Field
The invention relates to the field of communication, in particular to a protocol detection method and a protocol detection device.
Background
The power supply equipment for communication supplies working power to various communication equipment, which is indispensable equipment in the construction of a communication base station, the attention to the power supply equipment for communication has been the reliability, safety and performance of hardware, the attention to the system control and battery management is paid to the software management function, and little effort is paid to the communication function of the power supply equipment and a background.
However, with the development of digital control, various protocols are used between the power supply device and the sub-device, and between the power supply device and the background to collect and control information. Meanwhile, the coming of the cloud era brings new changes to the development of power supply equipment, big data processing is mentioned and used all the time, data acquisition and transmission are the foundation in the big data processing, and data transmission depends on a communication link and a communication protocol.
At present, 485 and CAN buses are used as communication interfaces between power supply equipment and sub-equipment, and most protocol types are self-defined; communication interfaces used between the power supply equipment and the background and between the power supply equipment and the intelligent terminal are 232, Ethernet and the like, the protocol types are 1104 and 1363 protocols specified by telecommunication standards, and self-defined protocols are also provided.
The diversity of the communication interface and the communication protocol of the power supply equipment makes the test of the power supply equipment extremely troublesome. Two methods have been used for the testing of protocols: firstly, testing is carried out depending on a specific background developed by equipment; secondly, the tester sends a generating command to the tester, and the tester sends a protocol to be analyzed through the debugging assistant of various communication interfaces.
The defects of the two modes are obvious, the first mode is opaque in test data, whether equipment is in failure or background analysis is in failure or not in failure, and failure is not judged well; in the second method, the amount of work is extremely large in a power supply system having a large number of parameters, information, and records.
In the related art, no effective solution is provided for the problem of how to effectively test the communication protocol of the power supply equipment for communication.
Disclosure of Invention
The invention provides a protocol detection method and a protocol detection device, which at least solve the problem of how to effectively test the communication protocol of power supply equipment for communication in the related art.
According to an aspect of the present invention, there is provided a protocol detection method, including: the test platform receives a plurality of protocols to be tested; the test platform generates a test command corresponding to the protocol to be tested according to the protocol to be tested; the test platform detects the protocol to be tested according to the test command; wherein the protocol to be tested comprises a protocol document and a protocol code.
Optionally, before the test platform generates the test command according to the protocol to be tested, the method includes: and checking the protocol document to determine that the protocol document is a correct protocol document.
Optionally, the generating, by the test platform, a test command according to the protocol to be tested includes: and generating the test command according to the protocol document.
Optionally, the detecting, by the test platform, the protocol to be tested according to the test command includes: sending the test command to the equipment to be tested; receiving a response message to the test command sent by the equipment to be tested; and detecting whether the protocol to be tested is correct or not according to the response message.
Optionally, the detecting whether the protocol to be tested is correct according to the response message includes: and comparing the response message with a preset judgment condition, determining that the protocol to be tested is correct under the condition that the comparison result is consistent, and determining that the protocol to be tested is wrong under the condition that the comparison result is inconsistent.
Optionally, determining that the protocol to be tested is erroneous comprises: generating a visual interface according to the protocol document; and searching for the protocol to be tested which realizes the error through the visual interface.
Optionally, before sending the test command to the device under test, the method includes: and acquiring a communication link, wherein the communication link is used for determining a mode of sending a test command to the equipment to be tested by the test platform.
According to an aspect of the present invention, there is provided a protocol detection apparatus applied to a test platform, the apparatus including: the receiving module is used for receiving a plurality of protocols to be tested; the first generating module is used for generating a test command corresponding to the protocol to be tested according to the protocol to be tested; the detection module is used for detecting the protocol to be tested according to the test command; wherein the protocol to be tested comprises a protocol document and a protocol code.
Optionally, the apparatus further comprises: and the checking module is used for checking the protocol document and determining that the protocol document is a correct protocol document.
Optionally, the first generating module is further configured to generate the test command according to the protocol document.
Optionally, the detection module further includes: the sending unit is used for sending the test command to the equipment to be tested; a receiving unit, configured to receive a response message to the test command sent by the device under test; and the detection unit is used for detecting whether the protocol to be tested is correct or not according to the response message.
Optionally, the detecting unit is further configured to compare the response message with a predetermined judgment condition, determine that the protocol to be tested is correct if the comparison result is consistent, and determine that the protocol to be tested is wrong if the comparison result is inconsistent.
Optionally, the apparatus further comprises: the second generation module is used for generating a visual interface according to the protocol document; and the searching module is used for searching the protocol to be tested for realizing the error through the visual interface.
Optionally, the apparatus further comprises: the device comprises an acquisition module and a communication link, wherein the acquisition module is used for acquiring the communication link, and the communication link is used for determining the mode of sending the test command to the device to be tested by the test platform.
According to the invention, a test platform is adopted to receive a plurality of protocols to be tested; the test platform generates a test command corresponding to the protocol to be tested according to the protocol to be tested; the test platform detects the protocol to be tested according to the test command; the protocol to be tested comprises a protocol document and a protocol code. The problem of how to effectively test the communication protocol of the power supply equipment for communication in the related art is solved, and the protocol testing efficiency is further improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow diagram of a protocol detection method according to an embodiment of the invention;
fig. 2 is a block diagram of a structure of a protocol detecting apparatus according to an embodiment of the present invention;
FIG. 3 is a block diagram of the structure of a protocol detection apparatus according to an embodiment of the present invention;
fig. 4 is a block diagram of the structure of a protocol detection apparatus according to an embodiment of the present invention (ii);
fig. 5 is a block diagram (iii) of the structure of a protocol detection apparatus according to an embodiment of the present invention;
fig. 6 is a block diagram (iv) of the structure of the protocol detecting apparatus according to the embodiment of the present invention;
FIG. 7 is a diagram of a multi-protocol test platform component module connection according to an embodiment of the invention;
FIG. 8 is a flow diagram of protocol test platform usage according to an embodiment of the present invention;
FIG. 9 is a flow diagram of a protocol copy function according to an embodiment of the present invention;
fig. 10 is a process flow diagram of parameter setting according to an embodiment of the present invention.
Detailed Description
The invention will be described in detail hereinafter with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
In this embodiment, a protocol detection method is provided, and fig. 1 is a flowchart of a protocol detection method according to an embodiment of the present invention, as shown in fig. 1, the flowchart includes the following steps:
step S102, a test platform receives a plurality of protocols to be tested;
step S104, the test platform generates a test command corresponding to the protocol to be tested according to the protocol to be tested;
step S106, the testing platform detects the protocol to be tested according to the testing command; the protocol to be tested comprises a protocol document and a protocol code.
Through the steps, the test platform can directly detect the protocol to be tested, compared with the related technology, the test platform has the advantages that test data of the protocol is not transparent, failure is not easy to judge, or the workload is extremely huge in a power supply system with huge parameters, information and records, the problem of how to effectively test the communication protocol of the power supply equipment for communication in the related technology is solved, and the protocol test efficiency is further improved.
In an alternative embodiment, the protocol document is checked to determine that the protocol document is a correct protocol document. After the protocol document is determined to be the correct protocol document, the protocol code in the protocol to be tested is detected.
The step S104 mentioned above involves the test platform generating the test command according to the protocol to be tested, and in an optional embodiment, generating the test command according to the protocol document.
In step S106, the test platform detects the protocol to be tested according to the test command, and in an optional embodiment, the test command is sent to the device to be tested, a response message to the test command sent by the device to be tested is received, and whether the protocol to be tested is correct is detected according to the response message.
In the process of detecting whether the protocol to be tested is correct according to the response message in the above steps, in an optional embodiment, the response message is compared with a predetermined judgment condition, the protocol to be tested is determined to be correct if the comparison result is consistent, and the protocol to be tested is determined to be wrong if the comparison result is inconsistent.
Upon detecting an erroneous protocol implementation, in an alternative embodiment, a visualization interface is generated from the protocol document; and searching for the protocol to be tested which realizes the error through the visual interface.
In an optional embodiment, before the test command is sent to the device under test, a communication link is obtained, where the communication link is used to determine a manner in which the test platform sends the test command to the device under test.
In this embodiment, a protocol detection apparatus is further provided, and the apparatus is used to implement the foregoing embodiments and preferred embodiments, and details of which have been already described are omitted. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 2 is a block diagram of a protocol detection apparatus according to an embodiment of the present invention, applied to a test platform, and as shown in fig. 2, the apparatus includes: a receiving module 22, configured to receive a plurality of protocols to be tested; the first generating module 24 is used for generating a test command corresponding to the protocol to be tested according to the protocol to be tested; the detection module 26 is used for detecting the protocol to be tested according to the test command; the protocol to be tested comprises a protocol document and a protocol code.
Fig. 3 is a block diagram (a) of a protocol detection apparatus according to an embodiment of the present invention, and as shown in fig. 3, the apparatus further includes: and the checking module 32 is used for checking the protocol document to determine that the protocol document is a correct protocol document.
Optionally, the first generating module 24 is further configured to generate the test command according to the protocol document.
Fig. 4 is a block diagram (ii) of the structure of the protocol detection apparatus according to the embodiment of the present invention, and as shown in fig. 4, the detection module 26 further includes: a sending unit 262, configured to send the test command to the device under test; a receiving unit 264, configured to receive a response message to the test command sent by the device under test; the detecting unit 266 is configured to detect whether the protocol to be tested is correct according to the response message.
Optionally, the detecting unit 266 is further configured to compare the response message with a predetermined judgment condition, determine that the protocol to be tested is correct if the comparison result is consistent, and determine that the protocol to be tested is wrong if the comparison result is inconsistent.
Fig. 5 is a block diagram (iii) of the structure of the protocol detection apparatus according to the embodiment of the present invention, and as shown in fig. 5, the apparatus further includes: a second generating module 52, configured to generate a visual interface according to the protocol document; and the searching module 54 is used for searching the protocol to be tested for realizing the error through the visual interface.
Fig. 6 is a block diagram (iv) of the structure of the protocol detection apparatus according to the embodiment of the present invention, and as shown in fig. 6, the apparatus further includes: the obtaining module 62 is configured to obtain a communication link, where the communication link is used to determine a manner in which the test platform sends a test command to the device under test.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in a plurality of processors.
In view of the above-described problems in the related art, the following description will be made in conjunction with specific alternative embodiments.
An object of an alternative embodiment of the present invention is to provide a multi-protocol test platform for a power supply device for communication, which comprehensively covers protocol contents of the power supply device for communication and is used for communication protocol test and communication troubleshooting of the power supply device for communication.
The technical scheme of the optional embodiment of the invention comprises the following steps:
the protocol testing method of the power supply equipment for communication comprises the following steps: carrying out three-remote (remote control, remote signaling and remote measuring) operation on the tested equipment through a Personal Computer (PC) machine provided with test software, and checking whether a data packet between the personal computer and the tested equipment meets the requirement content of a communication protocol or not; acquiring the history content of the tested device, and checking whether the response content of the tested device is consistent with the content in the tested device; erroneous packets may also be sent to check whether the device under test responds erroneously (i.e., fault tolerance testing of the protocol).
The multi-protocol test platform for the power supply equipment for communication is test software installed on a PC, which is mentioned in the test method.
To test a communication protocol, first, an implementation manner of the communication protocol is known, which is as follows:
the protocol implementation of the power supply equipment for communication includes two parts, namely a protocol document (protocol representation form, hereinafter collectively referred to as protocol original description) and a power supply equipment protocol code (protocol implementation form), and the power supply equipment protocol code (protocol implementation form) includes two aspects, in a large aspect, a single data packet and multiple data packets, wherein the single data packet is used for processing response data of remote control, remote signaling and remote measuring, and the multiple data packets are used for processing response data of historical record information. The multi-protocol test platform of the power supply equipment for communication tests the contents.
The judgment of the result of the communication protocol test is correct or wrong, and the judgment of the test result by the multi-protocol test platform of the power supply equipment for communication is as follows:
analyzing the command (hereinafter, collectively referred to as response information) returned by the tested device, comparing the command with the preset judgment condition in the platform, and giving a correct or wrong result.
The preset judgment conditions in the platform are different according to different types of operation commands issued by the PC to the tested equipment:
the judgment conditions for the remote control operation are as follows: whether a return code in the returned response information of the tested equipment is a normal value specified in the protocol or not, whether the obtained state value is consistent with an expected control state or not, if both the obtained state value and the expected control state meet the requirements, the judgment is correct, and if one does not meet the requirements, the judgment is wrong;
the judgment conditions for telecommand, telemetry, and multi-packet commands (history) are: and judging whether the return code in the returned response information of the tested equipment is a normal value specified in the protocol or not, judging whether the obtained data size is consistent with the data of the tested equipment or not, judging that the data size is correct if both the obtained data size and the data of the tested equipment meet the requirements, and judging that the data size is wrong if one of the obtained data size and the data of the tested equipment does not meet the requirements.
The multi-protocol test platform for the power supply equipment for communication is a software platform of a power supply equipment protocol test system for communication, and a hardware platform of the power supply equipment protocol test system for communication comprises:
1. testing the host computer: PC (Windows operating system);
2. a device under test (a power supply device with protocol implementation code);
3. a communication cable (connecting the test host and the device under test);
the multi-protocol test platform for the power supply equipment for communication runs on a test host, the input of the platform is original description of a protocol (a document consisting of a protocol command code and a data segment is described, and the document is a visible protocol interface), and the platform also needs to configure a protocol type and a communication mode. The protocol original description is used for generating command test content; the protocol type is used for specifying the packaging mode of the command; the communication means is used to specify a protocol communication link.
The multi-protocol test platform for the power supply equipment for communication needs to complete the following functions:
carrying out full coverage test on a plurality of protocols passing through various communication modes;
examining a visual description of a protocol-a protocol document;
detecting the correctness of the protocol command executed by the power supply equipment;
detecting the correctness of the history record sent by the power supply equipment;
and perfect fault finding and analysis support is provided.
Fig. 7 is a connection diagram of modules constituting the multi-protocol test platform according to the embodiment of the present invention, and as shown in fig. 7, the test platform includes five functional modules, namely, a presentation layer (i.e., a man-machine interface), a protocol primitive description check, a multi-protocol copy test, a single command debug, and a background simulation.
The multi-protocol copying machine test, single command debugging and background simulation functions of the test platform are complex to realize, and the method is specifically realized as follows:
multi-protocol copy machine function: the system comprises a command generation module, a command transceiving module, a response information analyzing and storing module, a historical record command transceiving module and a historical record response information analyzing and storing module;
single command debug function: the single command generating module and the single command analyzing module;
background simulation function: the device comprises a background simulation interface generating and displaying module, a command transceiving module and a response information analyzing and displaying module.
The operation steps of the platform are as follows:
step 1) connecting a test host and tested equipment through a physical link;
step 2) configuring the type of a communication protocol, configuring the communication mode, selecting the original description of the protocol on a test platform, and selecting a test result storage path;
step 3) the testing platform completes the inspection of the original description of the protocol, if the original description of the protocol has errors in the aspects of format, filling of necessary items, testability requirements and the like, the errors are recorded and an inspection result document is output, and the step is continued after modification until no error exists, and the step 4 can not be carried out; if no error exists, directly performing the step 4;
step 4) a multi-protocol copying module of the test platform generates a command set according to the original description of the protocol, and stores a command set document, wherein the command set comprises all test commands and fault-tolerant commands;
step 5) the multi-protocol copying machine module of the test platform completes single data packet command test and multi-data packet command test, and the method specifically comprises the following steps:
single packet command test: completing the sending of the single data packet command in the command set, the storage and analysis of response information, the judgment and recording of a test result (correct or wrong), and storing a single data packet command test result document;
multi-packet command testing: the method comprises the steps of finishing the selection, the sequencing, the sending and the response information storage and analysis of multiple data packet commands in a command set, recording test results, and storing multiple data packet command test result documents;
and 6) selecting an error command by a multi-protocol copying module of the test platform according to the single data packet command test result and data in the multi-data packet command test result document, and giving error analysis.
Step 7), generating a command by the single debugging function of the test platform according to the protocol packet format, sending the command to the power supply equipment, receiving response information, analyzing according to the original description of the protocol, and finding out errors;
and 8) testing the simulation background function of the platform, reading the original description content of the protocol, providing visual selection items, sending corresponding commands through the function selected by the interface, analyzing response information, and displaying the analysis result, thereby finding out errors.
Fig. 8 is a flowchart of the protocol test platform usage according to an embodiment of the present invention, as shown in fig. 8, the flowchart includes the following steps:
step S802, judging whether the original description content of the protocol is correct, if not, executing step S804, and if yes, executing step S806;
step S804, modifying according to the test result;
step S806, copying machine;
step S808, judging whether the result is correct, if so, executing step S816, and if not, executing step S810;
step S810 of determining whether the protocol is familiar, and if the determination result is yes, step S814 is executed, and if the determination result is no, step S812 is executed;
step S812, a background simulation function searches for a problem;
step S814, finding problems by the single debugging function;
step S816 ends.
The test platform can find out data errors in the communication protocol through sending and analyzing the commands, so that the reason causing the errors can be further analyzed to be present in the original description of the protocol or the protocol code of the tested device.
The key to the alternative embodiment of the invention is:
in the selection of the communication protocol and the communication mode, a plurality of protocols are supported to be sent by adopting different communication modes, so that a plurality of protocols can be selected to be tested in sequence or simultaneously, and the test platform can automatically test the next protocol after detecting that the test of one protocol is finished without human participation.
Adopting a mode of reading original description of a protocol to complete command generation and response information analysis, and shielding differences of various communication protocols or different versions of the same protocol;
the original description of the protocol is checked to ensure that the test input is correct and reliable;
generating a background parameter setting command, wherein parameters are generated according to original protocol description without presetting, so that the complicated parameter setting command is completely covered;
analyzing the response information of the power supply equipment, reserving the original data of the data volume in the response information, and analyzing a visual result according to a data transmission mode, so that the problem is conveniently searched;
and testing the historical record command, wherein the historical record command is acquired with particularity, the sent command comprises a plurality of commands, the sending sequence of the commands needs to be marked in the generation of the command set, and the marked quantity in the response information is analyzed after the response information is received for selecting the next sent command.
And a single command debugging and background simulation function is provided, and protocol error analysis support is carried out.
In a power supply product for communication of a certain type produced in the related art, a communication link supports RS232 and an Ethernet interface, and a communication protocol supports telecommunication oil standard protocols 1104 and 1363 and a custom protocol A. All three protocols can be transmitted through two communication links.
The multi-protocol test platform for the power supply equipment for communication has the following test implementation modes: (including single and multiple protocols)
1. Configuration of
Single protocol single communication link testing:
examples are: carrying out 1363 protocol test through an Ethernet interface, selecting a communication protocol type as a 1363 protocol, selecting a communication mode as an internet access, and selecting a 1363 protocol document path;
testing a plurality of protocol multi-communication links:
examples are: three kinds of protocol tests are carried out through two kinds of communication links, and 6 kinds of combination modes are provided according to different combinations of protocols and communication modes. Selecting a communication protocol type as a 1363 protocol, selecting a communication mode as an internet access, and selecting a 1363 protocol document; using an adding button on an interface, adding a 1363 protocol as a communication protocol type, selecting a 1363 protocol document as a communication mode, and selecting a serial port; then, the following 4 communication protocol types, protocol documents and communication modes are added in sequence.
2. Document inspection
The testing platform checks the format, the filling of necessary items and the testability of the protocol document, and the main checking contents comprise:
data of each command;
secondly, whether the parameters in the parameter setting command of the data table have upper limit, lower limit and default values or not and whether the unused parameters are marked or not are judged.
Checking testability: such as whether there are line spaces between different commands in the data table.
3. Command set generation
Reading command codes, parameter names and parameter values according to the contents of the protocol documents to generate a command set; and generating error commands of all fields in the command frame and giving judgment criteria.
4. Command transmission
And receiving the response information and storing the response information and the corresponding sending command. Analyzing the response information, sequentially judging whether the parameter setting result is correct according to the parameter values in the command set, and storing the sending command, the response information and the test result.
5. History record acquisition
And sending a first command of the first type of history record according to the history record command mark in the command set, selecting the next command to be sent according to the mark in the response information, circularly sending the command until the history record of the equipment is sent, and recording an index in the type of history record to mark that the group of commands are the same type of history record. After which the acquisition of the next type of history is started.
6. And checking whether the document checking result, the test result of all the commands in the command set and the test result of the historical record, particularly the acquisition commands in the historical record and the command set are consistent with the information in the equipment.
FIG. 9 is a flow chart of the protocol copy function according to the embodiment of the present invention, as shown in FIG. 9, the flow includes:
step S902, checking whether the protocol document meets the requirement, if the judgment result is no, executing step S904, and if the judgment result is yes, executing step S906;
step S904, modifying the protocol document;
step S906, reading the command code and the data segment definition to generate a command set;
step S908, sending all commands and storing corresponding response information;
step S910, determining whether the determination is successful, if the determination result is no, executing step S908, and if the determination result is yes, executing step S912;
step S912, analyzing the response information and saving the test result;
a step S914 of determining whether to perform a history command test, and if yes, executing a step S916, and if no, executing a step S922;
step S916, sending a history recording command according to a set rule and storing corresponding response information;
step S918, determining whether the history command test is completed, if the determination result is no, executing step S916, and if the determination result is yes, executing step S920;
s920, analyzing the response information of the history record;
and S922, ending.
Fig. 10 is a flowchart of a process of parameter setting according to an embodiment of the present invention, and as shown in fig. 10, the process includes the following steps:
step S1002, reading a parameter setting command code in a protocol document;
step S1004, finding out a corresponding command, reading an upper limit, a lower limit and a default value;
step S1006, generating abnormal parameter values, and storing the random parameter values;
in step S1008, a parameter setting command is generated. And storing the corresponding acquisition command;
step S1010, sending a parameter setting command and a parameter acquiring command together, and storing corresponding response information;
step S1012, the command is completely sent, and parameter values in the command are analyzed and obtained;
step S1014, whether the acquired parameter value and the set value coincide with each other, if the determination result is yes, step S1020 is executed, and if the determination result is no, step S1016 is executed;
a step S1016 of determining whether the expected result is satisfied, and if yes, performing a step S1020, and if no, performing a step S1018;
step S1018, recording the test result as an error;
in step S1020, the test result is recorded as correct.
The implementation manner of the multi-protocol test system simulation background for the power supply equipment for communication is as follows:
1. configuration of
The test platform checks the protocol document according to the detected protocol type; and establishing connection with the power supply equipment with the monitor through the detected communication mode. The main examination content of the protocol document is consistent with the first approach.
2. Starting background simulation function
After the test platform checks that no serious errors exist in the protocol document, the operation of a simulation background can be carried out;
3. simulating use of a background
The test platform is in a background simulation function, command codes and data in the protocol document are packaged, after the test platform detects a command name to be sent, corresponding command content is automatically sent to the tested equipment, response information is received and analyzed into visual data, and a user can conveniently set and search errors of single data.
In summary, the multi-protocol test platform for the power equipment for communication provided by the invention realizes the test of the correctness and fault tolerance of the communication protocol of the power equipment for communication, is suitable for the test of multiple protocols and communication links of the same equipment, encapsulates the difference of data contents between the protocols, can automatically complete the full coverage test of parameter setting, the test of obtaining historical records and provides a convenient error analysis mechanism compared with the existing protocol test method. The compatibility of protocol test is improved: the communication protocol test of the power supply equipment and the background is not required to be carried out by developing the background aiming at the specific protocol of the specific equipment; the tester is no longer required to be familiar with the command generation and data parsing of each protocol; the efficiency of protocol test is improved: all commands in the protocol are calculated according to 1000 on average, a single analysis mode is generated according to a manual single command, the test time of each command is calculated according to 8min, the command works for 8 hours a day, and 16 days are required! After the system is used, the command generation and analysis are all completed by the test platform, one command is sent and analyzed according to 5s calculation, the test, result storage and error pre-analysis of all data can be completed within 1.4 hours, and the test time is greatly shortened. The coverage rate of protocol test is improved: the system can be used for carrying out full coverage test on all command codes and wrong commands in the protocol commands. And the manual test mode and the background test mode cannot be guaranteed.
In another embodiment, a software is provided, which is used to execute the technical solutions described in the above embodiments and preferred embodiments.
In another embodiment, a storage medium is provided, in which the software is stored, and the storage medium includes but is not limited to: optical disks, floppy disks, hard disks, erasable memory, etc.
It will be apparent to those skilled in the art that the modules or steps of the present invention 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 multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (12)
1. A protocol detection method, comprising:
the method comprises the steps that a test platform receives a plurality of protocols to be tested, wherein the protocols to be tested comprise protocol documents and protocol codes; the protocol document is the original description of the protocol, is composed of a description protocol command code and a data segment, and can shield the difference of various communication protocols or different versions of the same protocol;
the test platform generates a test command according to the protocol document;
and the test platform detects the protocol to be tested according to the test command.
2. The method of claim 1, wherein before the test platform generates the test command according to the protocol to be tested, the method comprises:
and checking the protocol document to determine that the protocol document is a correct protocol document.
3. The method of claim 1, wherein the testing platform detecting the protocol to be tested according to the test command comprises:
sending the test command to the equipment to be tested;
receiving a response message to the test command sent by the equipment to be tested;
and detecting whether the protocol to be tested is correct or not according to the response message.
4. The method of claim 3, wherein detecting whether the protocol to be tested is correct based on the response message comprises:
and comparing the response message with a preset judgment condition, determining that the protocol to be tested is correct under the condition that the comparison result is consistent, and determining that the protocol to be tested is wrong under the condition that the comparison result is inconsistent.
5. The method of claim 4, wherein determining that the protocol to be tested is erroneous comprises:
generating a visual interface according to the protocol document;
and searching for the protocol to be tested which realizes the error through the visual interface.
6. The method of claim 5, wherein sending the test command to the device under test comprises:
and acquiring a communication link, wherein the communication link is used for determining a mode of sending a test command to the equipment to be tested by the test platform.
7. A protocol detection device applied to a test platform is characterized by comprising:
the system comprises a receiving module, a test module and a test module, wherein the receiving module is used for receiving a plurality of protocols to be tested, and the protocols to be tested comprise protocol documents and protocol codes; the protocol document is the original description of the protocol, is composed of a description protocol command code and a data segment, and can shield the difference of various communication protocols or different versions of the same protocol;
the first generation module is used for generating a test command according to the protocol document;
and the detection module is used for detecting the protocol to be tested according to the test command.
8. The apparatus of claim 7, further comprising:
and the checking module is used for checking the protocol document and determining that the protocol document is a correct protocol document.
9. The apparatus of claim 7, wherein the detection module further comprises:
the sending unit is used for sending the test command to the equipment to be tested;
a receiving unit, configured to receive a response message to the test command sent by the device under test;
and the detection unit is used for detecting whether the protocol to be tested is correct or not according to the response message.
10. The apparatus of claim 9, wherein the detecting unit is further configured to compare the response message with a predetermined judgment condition, determine that the protocol to be tested is correct if the comparison result is consistent, and determine that the protocol to be tested is wrong if the comparison result is inconsistent.
11. The apparatus of claim 10, further comprising:
the second generation module is used for generating a visual interface according to the protocol document;
and the searching module is used for searching the protocol to be tested for realizing the error through the visual interface.
12. The apparatus of claim 9, further comprising:
the device comprises an acquisition module and a communication link, wherein the acquisition module is used for acquiring the communication link, and the communication link is used for determining the mode of sending the test command to the device to be tested by the test platform.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510379789.0A CN106330593B (en) | 2015-07-01 | 2015-07-01 | Protocol detection method and device |
PCT/CN2015/092041 WO2017000424A1 (en) | 2015-07-01 | 2015-10-15 | Protocol detection method and apparatus |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510379789.0A CN106330593B (en) | 2015-07-01 | 2015-07-01 | Protocol detection method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106330593A CN106330593A (en) | 2017-01-11 |
CN106330593B true CN106330593B (en) | 2021-03-26 |
Family
ID=57607540
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510379789.0A Active CN106330593B (en) | 2015-07-01 | 2015-07-01 | Protocol detection method and device |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN106330593B (en) |
WO (1) | WO2017000424A1 (en) |
Families Citing this family (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106603581B (en) * | 2017-02-22 | 2020-04-07 | 欣旺达电子股份有限公司 | Test method and device supporting multiple communication protocols |
CN108009088A (en) * | 2017-11-30 | 2018-05-08 | 惠州市德赛西威汽车电子股份有限公司 | A kind of automatization test system of underlying protocol |
CN109660417A (en) * | 2018-05-02 | 2019-04-19 | 王泽政 | A kind of method and device of the test multi-communication protocol based on equipment manager |
CN110224898A (en) * | 2019-06-26 | 2019-09-10 | 南方电网科学研究院有限责任公司 | Specification encryption test method, device, equipment and the storage medium of distribution terminal |
CN111444052B (en) * | 2020-03-26 | 2024-02-13 | 杭州涂鸦信息技术有限公司 | Yield testing method, system and device thereof |
CN111506501B (en) * | 2020-04-13 | 2023-09-26 | 杭州涂鸦信息技术有限公司 | Method and device for generating test instruction set and electronic equipment |
CN111858319B (en) * | 2020-07-02 | 2021-12-10 | 天筑科技股份有限公司 | Method and device for testing monitoring unit |
CN112415404B (en) * | 2020-10-30 | 2023-06-27 | 蜂巢能源科技有限公司 | Battery pack testing method and battery pack testing device |
CN112422564A (en) * | 2020-11-18 | 2021-02-26 | 青岛海尔科技有限公司 | Protocol testing method, device, storage medium and electronic device |
CN112948194B (en) * | 2021-03-15 | 2023-08-15 | 中国联合网络通信集团有限公司 | Communication protocol testing method and device |
CN113032276A (en) * | 2021-04-16 | 2021-06-25 | 上海寰果信息科技有限公司 | Positioning product test system and test method |
CN113765741A (en) * | 2021-08-04 | 2021-12-07 | 格力电器(合肥)有限公司 | Communication protocol switching device and test equipment |
CN115550231B (en) * | 2022-03-31 | 2024-09-13 | 许昌开普检测研究院股份有限公司 | Multi-protocol test platform based on configuration file and test method thereof |
CN114553977B (en) * | 2022-04-25 | 2023-06-20 | 同日云联信息技术(苏州)有限公司 | Communication system of production equipment and upper system based on socket communication |
CN115208795A (en) * | 2022-06-30 | 2022-10-18 | 中车青岛四方车辆研究所有限公司 | Interface test method and device of Ethernet control equipment |
CN115314427B (en) * | 2022-10-11 | 2023-03-31 | 荣耀终端有限公司 | Protocol testing method, electronic equipment and chip system |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1866221A (en) * | 2006-02-27 | 2006-11-22 | 华为技术有限公司 | Software interface testing method and apparatus |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040107213A1 (en) * | 2002-12-02 | 2004-06-03 | Pedro Zubeldia | Systems and methods for generating data files for testing EDI receiving and processing capabilities |
CN100370764C (en) * | 2004-11-16 | 2008-02-20 | 华为技术有限公司 | Protocol test device and method for realizing protocol test |
CN102480394A (en) * | 2010-11-27 | 2012-05-30 | 陕西艾特隆技术有限公司 | Multi-protocol analyzer |
CN102123058A (en) * | 2011-01-19 | 2011-07-13 | 北京神州绿盟信息安全科技股份有限公司 | Test equipment and method for testing network protocol decoder |
US9959186B2 (en) * | 2012-11-19 | 2018-05-01 | Teradyne, Inc. | Debugging in a semiconductor device test environment |
CN104507101A (en) * | 2014-12-11 | 2015-04-08 | 华侨大学 | Test platform for network communication protocol of heterogeneous wireless sensor and test method of test platform |
-
2015
- 2015-07-01 CN CN201510379789.0A patent/CN106330593B/en active Active
- 2015-10-15 WO PCT/CN2015/092041 patent/WO2017000424A1/en active Application Filing
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1866221A (en) * | 2006-02-27 | 2006-11-22 | 华为技术有限公司 | Software interface testing method and apparatus |
Also Published As
Publication number | Publication date |
---|---|
CN106330593A (en) | 2017-01-11 |
WO2017000424A1 (en) | 2017-01-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106330593B (en) | Protocol detection method and device | |
CN108683562B (en) | Anomaly detection positioning method and device, computer equipment and storage medium | |
CN102946616B (en) | Internet of things middleware performance testing system and testing method | |
CN105302716B (en) | Test method, device under the development mode of interflow | |
CN112241360B (en) | Test case generation method, device, equipment and storage medium | |
CN111108481B (en) | Fault analysis method and related equipment | |
CN105068929A (en) | Test script generation method, test script generation device, testing method, testing device and testing system | |
CN107241229B (en) | Service monitoring method and device based on interface testing tool | |
CN111694752B (en) | Application testing method, electronic device and storage medium | |
CN102798833B (en) | Automatic test system and method for diagnosis instrument | |
CN112737886A (en) | Tool testing method and system | |
CN111966587A (en) | Data acquisition method, device and equipment | |
CN106776346A (en) | The method of testing and device of CCMTS equipment | |
KR20120133711A (en) | Apparatus and method for providing vehicle data for testing product | |
CN109670316A (en) | A kind of leak detection method and device based on Java exception | |
CN115963379A (en) | Automatic test method, device, equipment and storage medium for circuit board | |
CN115542875A (en) | Vehicle detection method based on SOA service and related equipment | |
CN112583663B (en) | Automatic network performance testing method based on domestic operating system | |
CN114924546A (en) | Calibration system and method for hardware-in-loop test | |
CN109189679A (en) | Interface test method and system, electronic equipment, storage medium | |
CN114371974A (en) | Buried point data checking method and electronic equipment | |
CN113094281B (en) | Test method and device for hybrid App | |
CN111008113B (en) | SAS-Expander test method and tool | |
CN115756994A (en) | Firmware testing method, system, electronic device and readable storage medium | |
CN114490337A (en) | Debugging method, debugging platform, equipment and storage medium |
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 |