CN109510737B - Protocol interface testing method and device, computer equipment and storage medium - Google Patents
Protocol interface testing method and device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN109510737B CN109510737B CN201811530304.3A CN201811530304A CN109510737B CN 109510737 B CN109510737 B CN 109510737B CN 201811530304 A CN201811530304 A CN 201811530304A CN 109510737 B CN109510737 B CN 109510737B
- Authority
- CN
- China
- Prior art keywords
- protocol
- interface
- classification
- information
- identifier
- 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
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/50—Testing arrangements
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/18—Multiprotocol handlers, e.g. single devices capable of handling multiple protocols
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Computer And Data Communications (AREA)
Abstract
The present application relates to the field of computer communications technologies, and in particular, to a protocol interface testing method and apparatus, a computer device, and a storage medium. Acquiring message request information, extracting a characteristic identifier of a protocol from the message request information, and acquiring a response message according to a feedback result after the characteristic identifier is input into an interface; extracting the protocol parameter information and parameter information in the response message to obtain the ID identification of the protocol, calling a classification file to classify the ID identification of the protocol to obtain the protocol classification identification of the protocol, and writing the protocol into a corresponding interface according to the protocol classification identification; and acquiring an inverse protocol classification identifier corresponding to the interface, assembling the inverse protocol classification identifier to obtain a protocol group, reading the protocol group to obtain an inverse classification file corresponding to the protocol group, and acquiring an extrapolation message of the protocol. The message information is effectively classified, and the message information can be effectively adapted according to the classification result.
Description
Technical Field
The present application relates to the field of computer communications technologies, and in particular, to a protocol interface testing method and apparatus, a computer device, and a storage medium.
Background
The interface test is generally used for interactive development among multiple systems or test of development of an application system with multiple subsystems. The interface test is suitable for the bottom-layer framework system and the central service system which provide services for other systems, and mainly tests the interfaces provided by the systems to the outside to verify the correctness and stability of the interfaces. The interface test is also suitable for a service layer interface in an upper layer system, and the test difficulty is higher the upper layer is.
At present, the information entry modes of interfaces with different protocols are basically the same during interface testing, but the interface protocols are inconsistent during interface running, and certain platform tools adopt a mode suitable for the protocol during entry in order to ensure that the interfaces with different protocols are accurately sent, such as a Jmeter testing tool and the like.
However, in the conventional testing technology, when a multi-protocol test is performed, the same interface cannot meet the requirements of different protocols, so that data needs to be repeatedly input, and the testing efficiency is reduced.
Disclosure of Invention
In view of the above, it is necessary to provide a protocol interface testing method, apparatus, computer device and storage medium for solving the problem that multiple protocols cannot be adapted effectively when writing into an interface.
A protocol interface test method comprises the following steps:
acquiring message request information, extracting a characteristic identifier of a protocol from the message request information, and acquiring a response message according to a feedback result after the characteristic identifier is input into an interface;
extracting the protocol parameter information and parameter information in the response message to obtain the ID identification of the protocol, calling a classification file to classify the ID identification of the protocol to obtain the protocol classification identification of the protocol, writing the protocol into a corresponding interface according to the protocol classification identification, and pre-storing the classification file in a server;
acquiring an inverse protocol classification identifier corresponding to the interface, assembling the inverse protocol classification identifier to obtain a protocol group, reading the protocol group to obtain an inverse classification file corresponding to the protocol group, acquiring an extrapolation message of the protocol from the inverse classification file, and sending the extrapolation message of the protocol to a test terminal.
In one embodiment, the obtaining of the message request information, extracting a feature identifier of a protocol from the message request information, and obtaining a response message according to a feedback result after the feature identifier is input to the interface includes:
acquiring message request information, and extracting a characteristic identifier of a protocol from the message request information;
acquiring a regular expression rule corresponding to the message request information, extracting a starting identifier and a message source address field in the characteristic identifier of the protocol from the regular expression rule, generating a matching rule list according to the starting identifier and the message source address field, and storing the regular expression rule in a database;
positioning and acquiring a response message corresponding to the matching rule list according to the mapping relation between the matching rule list and the response message;
and detecting whether the upstream interface information contained in the response message is matched with the downstream mapping node information contained in the message request information, if so, accepting the response message, and otherwise, acquiring the response message again.
In one embodiment, the extracting the protocol entry parameter information and the protocol exit parameter information in the response packet to obtain the ID identifier of the protocol, calling a classification file to classify the ID identifier of the protocol to obtain a protocol classification identifier of the protocol, writing the protocol into a corresponding interface according to the protocol classification identifier, and pre-storing the classification file in a server includes:
extracting the parameter entering information and the parameter exiting information of the protocol in the response message, extracting the characteristic parameters of the parameter entering information and the parameter exiting information, marking the characteristic parameters, and determining the ID identification of the protocol according to the change of the characteristic parameters during parameter entering and parameter exiting;
acquiring an encryption rule of the classified file, encrypting the classified file, and acquiring an encrypted classified file and a key identifier;
classifying the ID identification of the protocol according to the key identifier in the key identification to obtain the protocol classification identification;
acquiring a corresponding table of an interface ID identification and the protocol classification identification, establishing a mapping relation between the protocol classification identification of the protocol and the interface ID corresponding to the protocol according to the corresponding table, and writing the protocol into a corresponding interface according to the mapping relation, wherein the corresponding table of the interface ID identification and the protocol classification identification is stored in a database.
In one embodiment, the obtaining the reverse protocol classification identifier corresponding to the interface, assembling the reverse protocol classification identifier to obtain a protocol group, reading the protocol group to obtain a reverse classification file corresponding to the protocol group, obtaining an extrapolation packet of the protocol from the reverse classification file, and sending the extrapolation packet of the protocol to the test terminal includes:
establishing a corresponding relation table of the interface and the protocol classification identifier, performing matrixing expression on elements in the corresponding relation table to obtain an interface protocol matrix, inverting the interface protocol matrix to obtain an interface protocol inverse matrix, performing normalization processing on the elements in the interface protocol inverse matrix to obtain each element in the interface protocol inverse matrix after the normalization processing, and setting the value of each element as the inverse protocol classification identifier corresponding to the interface;
assembling the reverse protocol classification identification to obtain the protocol group;
adding the protocol group into a new example function, and obtaining an inverse classification file corresponding to the protocol group after the protocol group is added;
and acquiring a starting node and an ending node of data generation in the reverse classified file, and sequentially sending protocol information in the reverse classified file to a test terminal from the starting node to the ending node.
In one embodiment, the obtaining the message request information and extracting the feature identifier of the protocol from the message request information includes:
acquiring a preset time interval for extracting message request information, and acquiring message information according to the time interval;
detecting whether the obtained message information is complete or not, and if the message information is incomplete, re-obtaining the message information;
and comparing the message information with the response message of the previous turn to obtain the difference points of the message information and the response message of the previous turn, and obtaining the characteristic identifier according to the position in a protocol characteristic mapping table corresponding to the difference points, wherein the protocol characteristic mapping table is stored in data.
In one embodiment, the extracting the entry parameter information and the exit parameter information of the protocol in the response message, extracting feature parameters of the entry parameter information and the exit parameter information, marking the feature parameters, and determining the ID identifier of the protocol according to the change of the feature parameters during entry and exit includes:
sorting the parameter input information according to a parameter input time sequence to generate a line of parameter input matrixes, and sorting the parameter output information according to a parameter output time sequence to generate a list parameter matrixes;
performing matrix multiplication on the parameter input matrix and the parameter output matrix to obtain a parameter input-parameter output matrix;
extracting data on a main diagonal line from the parameter input-parameter output matrix as an original characteristic parameter;
carrying out normalization processing on the parameter input-parameter output matrix to obtain a normalized parameter input-parameter output matrix;
extracting data on a secondary diagonal line in the normalized parameter-input-parameter-output matrix as a characteristic parameter weight;
and matching and calculating the characteristic parameter weight and the original characteristic parameter to obtain the ID of the protocol.
In one embodiment, the assembling the inverse protocol classification identifier to obtain the protocol group includes:
according to the interface source of the protocol classification mark, the inverse protocol classification mark is layered and packaged to form a plurality of protocol layers;
identifying protocol data between the protocol layers to obtain a data association index between the protocol layers, wherein the data association index is used for representing the number of data from the same interface between the two protocol layers;
and assembling the two protocol layers with the maximum data association degree into a protocol group.
A protocol interface testing device comprises the following modules:
the request acquisition module is arranged for acquiring message request information, extracting a characteristic identifier of a protocol from the message request information, and acquiring a response message according to a feedback result after the characteristic identifier is input into an interface;
a classification write-in module, configured to extract the protocol entry parameter information and the protocol exit parameter information in the response reply packet to obtain an ID identifier of the protocol, call a classification file to classify the ID identifier of the protocol to obtain a protocol classification identifier of the protocol, write the protocol into a corresponding interface according to the protocol classification identifier, and pre-store the classification file in a server;
and the extrapolation message module is configured to acquire the reverse protocol classification identifier corresponding to the interface, assemble the reverse protocol classification identifier to obtain a protocol group, read the protocol group to obtain a reverse classification file corresponding to the protocol group, acquire an extrapolation message of the protocol from the reverse classification file, and send the extrapolation message of the protocol to the test terminal.
A computer device comprising a memory and a processor, the memory having stored therein computer readable instructions which, when executed by the processor, cause the processor to perform the steps of the protocol interface testing method described above.
A storage medium having stored thereon computer-readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the protocol interface testing method described above.
The protocol interface test method, the device, the computer equipment and the storage medium comprise the steps of obtaining message request information, extracting the characteristic identification of a protocol from the message request information, and obtaining a response message according to a feedback result after the characteristic identification is input into an interface; extracting the protocol parameter information and parameter information in the response message to obtain the ID identification of the protocol, calling a classification file to classify the ID identification of the protocol to obtain the protocol classification identification of the protocol, writing the protocol into a corresponding interface according to the protocol classification identification, and pre-storing the classification file in a server; acquiring an inverse protocol classification identifier corresponding to the interface, assembling the inverse protocol classification identifier to obtain a protocol group, reading the protocol group to obtain an inverse classification file corresponding to the protocol group, acquiring an extrapolation message of the protocol from the inverse classification file, and sending the extrapolation message of the protocol to a test terminal. The technical scheme can effectively adapt according to the classification result by effectively classifying the message information aiming at the problem that the various protocols can not effectively adapt when writing in the interface.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application.
FIG. 1 is a flowchart illustrating an overall protocol interface testing method according to an embodiment of the present application;
FIG. 2 is a diagram illustrating a request acquisition process in a protocol interface test according to an embodiment of the present application;
FIG. 3 is a diagram illustrating a classification writing process in a protocol interface testing method according to an embodiment of the present application;
fig. 4 is a block diagram of a protocol interface testing device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
Fig. 1 is an overall flowchart of a protocol interface testing method in an embodiment of the present application, and as shown in fig. 1, a protocol interface testing method includes the following steps:
s1, obtaining message request information, extracting the characteristic identification of the protocol from the message request information, and obtaining a response message according to the feedback result after the characteristic identification is input into the interface;
specifically, a receiving protocol interface detection initiator sends message request information, and extracts a feature label for identifying a multi-protocol attribute, such as a type field of an operation, maintenance and management (OAM) message in multi-protocol label switching (MPLS), from the message request information; and then inputting the type field of the operation maintenance management OAM message in the multi-protocol label switching MPLS into an interface to obtain a response message.
S2, extracting the protocol parameter information and parameter information in the response message to obtain the ID identification of the protocol, calling a classification file to classify the ID identification of the protocol to obtain the protocol classification identification of the protocol, writing the protocol into a corresponding interface according to the protocol classification identification, and pre-storing the classification file in a server;
specifically, all functions used on an interface are obtained, a protocol is respectively entered into the functions for calculation to obtain a parameter result, and the result with the largest repeated occurrence frequency in the parameter result is used as the ID identification of the protocol; the protocol classification is mainly divided into a transmission control protocol TCP, a user datagram protocol UDP, a hypertext transfer protocol HTTP, and the like.
S3, obtaining the reverse protocol classification mark corresponding to the interface, assembling the reverse protocol classification mark to obtain a protocol group, reading the protocol group to obtain a reverse classification file corresponding to the protocol group, obtaining an extrapolation message of the protocol from the reverse classification file, and sending the extrapolation message of the protocol to a test terminal.
Specifically, the inverse protocol identifier corresponding to the interface is obtained by performing inverse analysis on the protocol, and when the inverse protocol identifier is assembled, the inverse protocol identifier may be assembled according to the generation sequence of the inverse protocol identifier, or the same inverse classification identifier may be assembled into a protocol group.
In the embodiment, the protocol can be adapted to the interface by effectively analyzing and classifying the protocol.
Fig. 2 is a schematic diagram of a request obtaining process in a protocol interface test according to the present application, where as shown in the figure, obtaining message request information, extracting a feature identifier of a protocol from the message request information, and obtaining a response message according to a feedback result after the feature identifier is input to an interface includes:
s101, acquiring message request information, and extracting a characteristic identifier of a protocol from the message request information;
specifically, a message request information sending task is set, and when the message request information sending task is triggered, the detection terminal sends the message request information and the server, wherein the characteristic identifier of the protocol refers to an abbreviated symbol of the protocol and the like.
S102, acquiring a regular expression rule corresponding to the message request information, extracting a starting identifier and a message source address field in a characteristic identifier of the protocol from the regular expression rule, generating a matching rule list according to the starting identifier and the message source address field, and storing the regular expression rule in a database;
the regular expression rule is mainly to use regular expression to carry out regularization processing to the character string, the regular expression is a logic formula for operating the character string, namely, a 'regular character string' is formed by using some specific characters defined in advance and the combination of the specific characters, and the 'regular character string' is used to express a filtering logic to the character string. A regular expression is a text pattern that describes one or more strings of characters to be matched when searching for text.
S103, positioning and acquiring a response message corresponding to the matching rule list according to the mapping relation between the matching rule list and the response message;
specifically, the structured query SQL language and the like are applied to search key contents in the message contents of the matching rule list, and the position of the response message in the matching rule list is determined according to the search result.
S104, detecting whether the upstream interface information contained in the response message is matched with the downstream mapping node information contained in the message request information, if so, accepting the response message, otherwise, acquiring the response message again.
In this embodiment, the integrity of the response message can be effectively ensured by verifying the receiving process of the response message.
Fig. 3 is a schematic diagram of a classification writing process in a protocol interface testing method according to the present application, where as shown in the figure, the protocol entry parameter information and the protocol exit parameter information in the response reply packet are extracted to obtain an ID identifier of the protocol, a classification file is called to classify the ID identifier of the protocol to obtain a protocol classification identifier of the protocol, the protocol is written into a corresponding interface according to the protocol classification identifier, and the classification file is prestored in a server, and includes:
s201, extracting the participation information and the participation information of the protocol in the response message, extracting the characteristic parameters of the participation information and the participation information, marking the characteristic parameters, and determining the ID identification of the protocol according to the change of the characteristic parameters during participation and participation;
specifically, the characteristic parameters in the response reply message mainly refer to information such as an interface method name, a version number, a group and the like, and if a version of a parameter output result corresponding to parameter output is changed, the version number is used as a protocol ID.
S202, acquiring an encryption rule of the classified file, encrypting the classified file, and acquiring an encrypted classified file and a key identifier;
the encryption rule may be based 64 encryption, MD5 encryption, key string encryption, or the like.
S203, classifying the ID identification of the protocol according to the key identifier in the key identification to obtain the protocol classification identification;
the key identifier refers to a first character in the key identifier, and if the first character identified by the protocol ID is consistent with the key identifier, the protocol is classified according to the category in the classification file corresponding to the key identifier.
S204, acquiring a corresponding table of an interface ID identification and the protocol classification identification, establishing a mapping relation between the protocol classification identification of the protocol and the interface ID corresponding to the protocol according to the corresponding table, and writing the protocol into a corresponding interface according to the mapping relation, wherein the corresponding table of the interface ID identification and the protocol classification identification is stored in a database.
In this embodiment, the interface is matched with the protocol by establishing the corresponding relationship between the interface ID identifier and the protocol classification identifier.
In an embodiment, the obtaining the reverse protocol classification identifier corresponding to the interface, assembling the reverse protocol classification identifier to obtain a protocol group, reading the protocol group to obtain a reverse classification file corresponding to the protocol group, obtaining an extrapolation packet of the protocol from the reverse classification file, and sending the extrapolation packet of the protocol to the test terminal includes:
establishing a corresponding relation table of the interface and the protocol classification identifier, performing matrixing expression on elements in the corresponding relation table to obtain an interface protocol matrix, inverting the interface protocol matrix to obtain an interface protocol inverse matrix, performing normalization processing on the elements in the interface protocol inverse matrix to obtain each element in the interface protocol inverse matrix after the normalization processing, and setting the value of each element as the inverse protocol classification identifier corresponding to the interface;
specifically, when an element in the correspondence table is extracted, the position of the extracted element in the record table is recorded, and the row-column number corresponding to the position is used as the numerical value of the element in the protocol matrix, for example, if the position of a certain element in the correspondence table is the 3 rd row and the 4 th column, the numerical value of the certain element in the protocol matrix is 34%; and writing the numerical values into the interface protocol matrix in turn according to the element extraction sequence.
Assembling the reverse protocol classification identification to obtain the protocol group;
specifically, the assembly can be performed by the plane tangent plane programming AOP only when the classification marks are assembled.
Adding the protocol group into a new example function, and obtaining an inverse classification file corresponding to the protocol group after the protocol group is added;
specifically, when the new example function uses AOP, a newInstance () function is used to perform an enter-join or exit-join operation.
And acquiring a starting node and an ending node of data generation in the reverse classified file, and sequentially sending protocol information in the reverse classified file to a test terminal from the starting node to the ending node.
In this embodiment, by performing matrixing processing on the protocol classification elements, the accuracy of extrapolation message sending can be improved.
In one embodiment, the obtaining of the message request information and extracting the feature identifier of the protocol from the message request information include:
acquiring a preset time interval for extracting message request information, and acquiring message information according to the time interval;
specifically, the time interval is obtained from the historical data, different weights may be given to different historical data when performing historical data statistics, and the weight of the historical data closer to the current time is larger, and vice versa.
Detecting whether the obtained message information is complete or not, and if the message information is incomplete, re-obtaining the message information;
specifically, when detecting the integrity of the message information, the initial character and the terminal character of the message may be detected according to a preset message rule, and if the initial character or the terminal character of the message information does not conform to the preset message rule, the message is incomplete.
And comparing the message information with the response message of the previous turn to obtain the difference points of the message information and the response message of the previous turn, and obtaining the characteristic identifier according to the position in a protocol characteristic mapping table corresponding to the difference points, wherein the protocol characteristic mapping table is stored in data.
Specifically, when comparing the response messages, the response messages may be segmented into a plurality of message subsections, and then difference point comparison is performed on each subsection.
In this embodiment, the integrity and the difference detection are completed by responding to the response message, so that the accuracy of the protocol and the interface matching can be better improved.
In one embodiment, the extracting the entry parameter information and the exit parameter information of the protocol in the response message, extracting feature parameters of the entry parameter information and the exit parameter information, marking the feature parameters, and determining the ID identifier of the protocol according to the change of the feature parameters during entry and exit includes:
sorting the parameter input information according to a parameter input time sequence to generate a line of parameter input matrixes, and sorting the parameter output information according to a parameter output time sequence to generate a list parameter matrixes;
performing matrix multiplication on the parameter input matrix and the parameter output matrix to obtain a parameter input-parameter output matrix;
specifically, if the parameter input information is subjected to numerical value conversion, a parameter input matrix a is established, and the parameter output information is subjected to numerical value conversion, and a parameter output matrix B is established. For example a matrixThe matrix A and the matrix B are subjected to product to obtain an input parameter-output parameter matrix
Extracting data on a main diagonal line from the parameter input-parameter output matrix as an original characteristic parameter;
specifically, as in the above example, the original characteristic parameter is 8+10 — 18.
Carrying out normalization processing on the parameter input-parameter output matrix to obtain a normalized parameter input-parameter output matrix;
extracting data on a secondary diagonal line in the normalized parameter-input-parameter-output matrix as a characteristic parameter weight;
specifically, after normalization processing is performed on the matrix C, the sum of the elements on the secondary diagonal is divided by 2, and the obtained weight is 0.5.
And matching and calculating the characteristic parameter weight and the original characteristic parameter to obtain the ID of the protocol.
In this embodiment, the accuracy of determining the protocol ID identifier is improved by performing matrixing processing on the entry parameter information and the exit parameter information.
In one embodiment, said assembling said reverse protocol class identifier to obtain said protocol stack includes:
according to the interface source of the protocol classification mark, the inverse protocol classification mark is layered and packaged to form a plurality of protocol layers;
specifically, when performing layered packing, the inverse protocol classification identifier of the same interface source may be written into one protocol layer, or the inverse protocols of several interface sources of the same category may be written into one protocol layer.
Identifying protocol data between the protocol layers to obtain a data association index between the protocol layers, wherein the data association index is used for representing the number of data from the same interface between the two protocol layers;
and assembling the two protocol layers with the maximum data association degree into a protocol group.
Specifically, if the association degrees between three or more protocol layers are consistent, two protocol layers are randomly extracted and assembled to form a protocol group, and the association degrees are recalculated between the remaining protocol layers and other protocol layers.
In the embodiment, the protocol group is formed by calculating the association degree, so that the speed of testing the protocol interface is improved.
In one embodiment, a protocol interface testing apparatus is proposed, as shown in fig. 4, including the following modules:
the request acquisition module is arranged for acquiring message request information, extracting a characteristic identifier of a protocol from the message request information, and acquiring a response message according to a feedback result after the characteristic identifier is input into an interface;
a classification write-in module, configured to extract the protocol entry parameter information and the protocol exit parameter information in the response reply packet to obtain an ID identifier of the protocol, call a classification file to classify the ID identifier of the protocol to obtain a protocol classification identifier of the protocol, write the protocol into a corresponding interface according to the protocol classification identifier, and pre-store the classification file in a server;
and the extrapolation message module is configured to acquire the reverse protocol classification identifier corresponding to the interface, assemble the reverse protocol classification identifier to obtain a protocol group, read the protocol group to obtain a reverse classification file corresponding to the protocol group, acquire an extrapolation message of the protocol from the reverse classification file, and send the extrapolation message of the protocol to the test terminal.
A computer device comprising a memory and a processor, the memory having stored therein computer-readable instructions that, when executed by the processor, cause the processor to perform the steps of the protocol interface testing method in the embodiments described above.
A storage medium storing computer readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the protocol interface testing method described in the embodiments above. The storage medium may be a non-volatile storage medium.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable storage medium, and the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-described embodiments are merely illustrative of some embodiments of the present application, which are described in more detail and detail, but are not to be construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.
Claims (9)
1. A protocol interface testing method is characterized by comprising the following steps:
acquiring message request information, extracting a characteristic identifier of a protocol from the message request information, and acquiring a response message according to a feedback result after the characteristic identifier is input into an interface;
extracting the protocol parameter information and parameter information in the response message to obtain the ID identification of the protocol, calling a classification file to classify the ID identification of the protocol to obtain the protocol classification identification of the protocol, writing the protocol into a corresponding interface according to the protocol classification identification, and pre-storing the classification file in a server;
acquiring an inverse protocol classification identifier corresponding to the interface, assembling the inverse protocol classification identifier to obtain a protocol group, reading the protocol group to obtain an inverse classification file corresponding to the protocol group, acquiring protocol information of the protocol from the inverse classification file, and sending the protocol information of the protocol to a test terminal, wherein the inverse protocol classification identifier is a value of an element in an interface protocol inverse matrix;
the acquiring the reverse protocol classification identifier corresponding to the interface, assembling the reverse protocol classification identifier to obtain a protocol group, reading the protocol group to obtain a reverse classification file corresponding to the protocol group, acquiring protocol information of the protocol from the reverse classification file, and sending the protocol information of the protocol to a test terminal includes:
establishing a corresponding relation table of the interface and the protocol classification identifier, performing matrixing expression on elements in the corresponding relation table to obtain an interface protocol matrix, inverting the interface protocol matrix to obtain an interface protocol inverse matrix, performing normalization processing on the elements in the interface protocol inverse matrix to obtain each element in the interface protocol inverse matrix after the normalization processing, and setting the value of each element as the inverse protocol classification identifier corresponding to the interface;
assembling the reverse protocol classification identification to obtain the protocol group;
adding the protocol group into a new example function, and obtaining an inverse classification file corresponding to the protocol group after the protocol group is added;
and acquiring a starting node and an ending node of data generation in the reverse classified file, and sequentially sending protocol information in the reverse classified file to a test terminal from the starting node to the ending node.
2. The method for testing a protocol interface according to claim 1, wherein the obtaining of the message request information, extracting the feature identifier of the protocol from the message request information, and obtaining the response message according to the feedback result after the feature identifier is input to the interface comprises:
acquiring message request information, and extracting a characteristic identifier of a protocol from the message request information;
acquiring a regular expression rule corresponding to the message request information, extracting a starting identifier and a message source address field in the characteristic identifier of the protocol from the regular expression rule, generating a matching rule list according to the starting identifier and the message source address field, and storing the regular expression rule in a database;
positioning and acquiring a response message corresponding to the matching rule list according to the mapping relation between the matching rule list and the response message;
and detecting whether the upstream interface information contained in the response message is matched with the downstream mapping node information contained in the message request information, if so, accepting the response message, and otherwise, acquiring the response message again.
3. The protocol interface testing method according to claim 1, wherein the extracting the protocol entry parameter information and the protocol exit parameter information in the response reply packet to obtain the ID identifier of the protocol, calling a classification file to classify the ID identifier of the protocol to obtain a protocol classification identifier of the protocol, writing the protocol into a corresponding interface according to the protocol classification identifier, and the pre-storing of the classification file in a server includes:
extracting the parameter entering information and the parameter exiting information of the protocol in the response message, extracting the characteristic parameters of the parameter entering information and the parameter exiting information, marking the characteristic parameters, and determining the ID identification of the protocol according to the change of the characteristic parameters during parameter entering and parameter exiting;
acquiring an encryption rule of the classified file, encrypting the classified file, and acquiring an encrypted classified file and a key identifier;
classifying the ID identification of the protocol according to the key identifier in the key identification to obtain the protocol classification identification;
acquiring a corresponding table of an interface ID identification and the protocol classification identification, establishing a mapping relation between the protocol classification identification of the protocol and the interface ID corresponding to the protocol according to the corresponding table, and writing the protocol into a corresponding interface according to the mapping relation, wherein the corresponding table of the interface ID identification and the protocol classification identification is stored in a database.
4. The protocol interface testing method of claim 2, wherein the obtaining of the message request information and the extracting of the feature identifier of the protocol from the message request information comprise:
acquiring a preset time interval for extracting message request information, and acquiring message information according to the time interval;
detecting whether the obtained message information is complete or not, and if the message information is incomplete, re-obtaining the message information;
and comparing the message information with the response message of the previous turn to obtain the difference points of the message information and the response message of the previous turn, and obtaining the characteristic identifier according to the position in a protocol characteristic mapping table corresponding to the difference points, wherein the protocol characteristic mapping table is stored in a database.
5. The method according to claim 3, wherein the extracting the entry parameter information and the exit parameter information of the protocol in the response reply message, extracting feature parameters of the entry parameter information and the exit parameter information, marking the feature parameters, and determining the ID of the protocol according to changes of the feature parameters during entry and exit comprises:
sorting the parameter input information according to a parameter input time sequence to generate a line of parameter input matrixes, and sorting the parameter output information according to a parameter output time sequence to generate a list parameter matrixes;
performing matrix multiplication on the parameter input matrix and the parameter output matrix to obtain a parameter input-parameter output matrix;
extracting data on a main diagonal line from the parameter input-parameter output matrix as an original characteristic parameter;
carrying out normalization processing on the parameter input-parameter output matrix to obtain a normalized parameter input-parameter output matrix;
extracting data on a secondary diagonal line in the normalized parameter-input-parameter-output matrix as a characteristic parameter weight;
and matching and calculating the characteristic parameter weight and the original characteristic parameter to obtain the ID of the protocol.
6. The method according to claim 1, wherein said assembling the reverse protocol class identifier to obtain the protocol group comprises:
according to the interface source of the protocol classification mark, the inverse protocol classification mark is layered and packaged to form a plurality of protocol layers;
identifying protocol data between the protocol layers to obtain a data association index between the protocol layers, wherein the data association index is used for representing the number of data from the same interface between the two protocol layers;
and assembling the two protocol layers with the maximum data association degree into a protocol group.
7. A protocol interface testing apparatus, comprising:
the request acquisition module is arranged for acquiring message request information, extracting a characteristic identifier of a protocol from the message request information, and acquiring a response message according to a feedback result after the characteristic identifier is input into an interface;
a classification write-in module, configured to extract the protocol entry parameter information and the protocol exit parameter information in the response reply packet to obtain an ID identifier of the protocol, call a classification file to classify the ID identifier of the protocol to obtain a protocol classification identifier of the protocol, write the protocol into a corresponding interface according to the protocol classification identifier, and pre-store the classification file in a server;
an extrapolation message module, configured to obtain an inverse protocol classification identifier corresponding to the interface, assemble the inverse protocol classification identifier to obtain a protocol group, read the protocol group to obtain an inverse classification file corresponding to the protocol group, obtain protocol information of the protocol from the inverse classification file, and send the protocol information of the protocol to a test terminal, where the inverse protocol classification identifier is a value of an element in an inverse matrix of the interface protocol;
the acquiring the reverse protocol classification identifier corresponding to the interface, assembling the reverse protocol classification identifier to obtain a protocol group, reading the protocol group to obtain a reverse classification file corresponding to the protocol group, acquiring protocol information of the protocol from the reverse classification file, and sending the protocol information of the protocol to a test terminal includes:
establishing a corresponding relation table of the interface and the protocol classification identifier, performing matrixing expression on elements in the corresponding relation table to obtain an interface protocol matrix, inverting the interface protocol matrix to obtain an interface protocol inverse matrix, performing normalization processing on the elements in the interface protocol inverse matrix to obtain each element in the interface protocol inverse matrix after the normalization processing, and setting the value of each element as the inverse protocol classification identifier corresponding to the interface;
assembling the reverse protocol classification identification to obtain the protocol group;
adding the protocol group into a new example function, and obtaining an inverse classification file corresponding to the protocol group after the protocol group is added;
and acquiring a starting node and an ending node of data generation in the reverse classified file, and sequentially sending protocol information in the reverse classified file to a test terminal from the starting node to the ending node.
8. A computer device comprising a memory and a processor, the memory having stored therein computer readable instructions which, when executed by the processor, cause the processor to carry out the steps of the protocol interface testing method according to any one of claims 1 to 6.
9. A storage medium having stored thereon computer-readable instructions which, when executed by one or more processors, cause the one or more processors to perform the steps of the protocol interface testing method according to any one of claims 1 to 6.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811530304.3A CN109510737B (en) | 2018-12-14 | 2018-12-14 | Protocol interface testing method and device, computer equipment and storage medium |
PCT/CN2019/120517 WO2020119430A1 (en) | 2018-12-14 | 2019-11-25 | Protocol interface test method, device, computer device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811530304.3A CN109510737B (en) | 2018-12-14 | 2018-12-14 | Protocol interface testing method and device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109510737A CN109510737A (en) | 2019-03-22 |
CN109510737B true CN109510737B (en) | 2022-04-26 |
Family
ID=65753371
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811530304.3A Active CN109510737B (en) | 2018-12-14 | 2018-12-14 | Protocol interface testing method and device, computer equipment and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN109510737B (en) |
WO (1) | WO2020119430A1 (en) |
Families Citing this family (25)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109510737B (en) * | 2018-12-14 | 2022-04-26 | 深圳壹账通智能科技有限公司 | Protocol interface testing method and device, computer equipment and storage medium |
CN110287070B (en) * | 2019-05-21 | 2024-03-19 | 平安银行股份有限公司 | ESB special protocol interface test method, server and computer readable storage medium |
CN110309058A (en) * | 2019-05-24 | 2019-10-08 | 平安银行股份有限公司 | Business end test method, device, computer installation and computer storage medium |
CN110727475B (en) * | 2019-10-12 | 2023-07-21 | 四川新网银行股份有限公司 | Intelligent service calling method based on configuration |
CN111611147B (en) * | 2020-06-28 | 2023-05-30 | 中国人民解放军国防科技大学 | Method, system and medium for detecting and analyzing performance of internal universal interface of processor |
CN111884776A (en) * | 2020-07-02 | 2020-11-03 | 深圳市赛特新能科技有限公司 | Charging pile protocol consistency testing method |
CN113992549B (en) * | 2020-07-08 | 2023-06-13 | 大唐移动通信设备有限公司 | Test method, test device, electronic equipment and storage medium |
CN114095588B (en) * | 2020-08-03 | 2023-08-18 | 网宿科技股份有限公司 | Sharing method, system and server of multi-protocol ports |
EP3979660B1 (en) | 2020-08-03 | 2023-02-15 | Wangsu Science & Technology Co., Ltd. | Multi-protocol port sharing method and system, and server |
CN112328221A (en) * | 2020-11-06 | 2021-02-05 | 深圳壹账通智能科技有限公司 | Data structure conversion method and device based on microservice framework and computer equipment |
CN112487163B (en) * | 2020-11-30 | 2024-04-12 | 广州品唯软件有限公司 | Execution method of automatic flow and method and device for acquiring interface data of execution method |
CN113779128B (en) * | 2021-09-09 | 2024-04-05 | 平安科技(深圳)有限公司 | Medical data system docking method, device, equipment and storage medium |
CN113709182B (en) * | 2021-09-13 | 2023-03-10 | 支付宝(杭州)信息技术有限公司 | Interface identification method, device and equipment |
CN114070761B (en) * | 2021-11-11 | 2023-09-26 | 北京轨道交通路网管理有限公司 | Protocol message detection method and device and electronic equipment |
CN114500676B (en) * | 2021-12-28 | 2024-05-24 | 浪潮工业互联网股份有限公司 | Information interaction method and device between industrial Internet devices and storage medium |
CN114338448B (en) * | 2021-12-29 | 2024-02-20 | 北京天融信网络安全技术有限公司 | Performance test method and device, electronic equipment and storage medium |
CN115242691B (en) * | 2022-07-04 | 2023-05-19 | 中国电子科技集团公司第三十研究所 | Protocol identification method based on protocol feature library |
CN115729825A (en) * | 2022-11-25 | 2023-03-03 | 中国长江三峡集团有限公司 | Fuzzy test case generation method and device of industrial protocol and electronic equipment |
CN115633098B (en) * | 2022-12-02 | 2023-03-31 | 北京红山微电子技术有限公司 | Storage management method and device of many-core system and integrated circuit |
CN116431718B (en) * | 2023-04-17 | 2024-06-14 | 珠海畅达网络技术有限公司 | Internet-based integrated information processing system and method |
CN116781790B (en) * | 2023-08-25 | 2023-12-05 | 国网江西省电力有限公司电力科学研究院 | Instrument specification intelligent conversion system, method, readable medium and electronic device |
CN117254886B (en) * | 2023-11-17 | 2024-01-23 | 广州市森锐科技股份有限公司 | Cloud desktop data interaction method and device, computer equipment and storage medium |
CN117768400A (en) * | 2023-11-29 | 2024-03-26 | 中科驭数(北京)科技有限公司 | Message classification method, system, device, special data processor and storage medium |
CN117576545B (en) * | 2024-01-16 | 2024-04-05 | 成都同步新创科技股份有限公司 | Multi-algorithm full-matching access adapter access method |
CN117672342B (en) * | 2024-01-29 | 2024-04-05 | 合肥康芯威存储技术有限公司 | Protocol monitoring system and method for memory chip |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104601403A (en) * | 2015-01-07 | 2015-05-06 | 上海瀚之友信息技术服务有限公司 | Automatic test system |
CN205176829U (en) * | 2013-07-25 | 2016-04-20 | 中国航天科工集团第三研究院第八三五七研究所 | Multiple communications protocol's of test configuration system on a chip's test system |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7099438B2 (en) * | 2002-06-14 | 2006-08-29 | Ixia | Multi-protocol, multi-interface communications device testing system |
CN100459530C (en) * | 2005-10-13 | 2009-02-04 | 华为技术有限公司 | Testing adopter and testing tool system and detecting method |
KR100882814B1 (en) * | 2007-06-05 | 2009-02-10 | 주식회사 이노와이어리스 | Dual processing system for ensuring realtime of protocol test |
KR101060181B1 (en) * | 2009-08-03 | 2011-08-29 | 강원대학교산학협력단 | Web-based software debugging device and its method for remote debugging |
CN102694701B (en) * | 2012-06-13 | 2015-12-02 | 青岛海信传媒网络技术有限公司 | Message based method of testing and system |
CN109510737B (en) * | 2018-12-14 | 2022-04-26 | 深圳壹账通智能科技有限公司 | Protocol interface testing method and device, computer equipment and storage medium |
-
2018
- 2018-12-14 CN CN201811530304.3A patent/CN109510737B/en active Active
-
2019
- 2019-11-25 WO PCT/CN2019/120517 patent/WO2020119430A1/en active Application Filing
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN205176829U (en) * | 2013-07-25 | 2016-04-20 | 中国航天科工集团第三研究院第八三五七研究所 | Multiple communications protocol's of test configuration system on a chip's test system |
CN104601403A (en) * | 2015-01-07 | 2015-05-06 | 上海瀚之友信息技术服务有限公司 | Automatic test system |
Non-Patent Citations (1)
Title |
---|
基于compactPcl总线的多功能串行通信接口设计;张国伟;《中国优秀硕士学位论文全文数据库》;20110930;全文 * |
Also Published As
Publication number | Publication date |
---|---|
WO2020119430A1 (en) | 2020-06-18 |
CN109510737A (en) | 2019-03-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109510737B (en) | Protocol interface testing method and device, computer equipment and storage medium | |
CN109670049B (en) | Map path query method, device, computer equipment and storage medium | |
CN103164698B (en) | Text fingerprints library generating method and device, text fingerprints matching process and device | |
CN111680634A (en) | Document file processing method and device, computer equipment and storage medium | |
CN111352907A (en) | Method and device for analyzing pipeline file, computer equipment and storage medium | |
US20120179658A1 (en) | Cleansing a Database System to Improve Data Quality | |
US20170337386A1 (en) | Method, apparatus, and computer-readable medium for automated construction of data masks | |
CN106485261A (en) | A kind of method and apparatus of image recognition | |
CN112651236B (en) | Method and device for extracting text information, computer equipment and storage medium | |
CN110659282A (en) | Data route construction method and device, computer equipment and storage medium | |
CN113641833B (en) | Service demand matching method and device | |
CN111124421B (en) | Abnormal contract data detection method and device for blockchain intelligent contract | |
CN113312258B (en) | Interface testing method, device, equipment and storage medium | |
CN108415971B (en) | Method and device for recommending supply and demand information by using knowledge graph | |
CN113900955A (en) | Automatic testing method, device, equipment and storage medium | |
CN117933239A (en) | Contract and equipment information association method, device, equipment and storage medium | |
WO2021036681A1 (en) | Data verification method and apparatus, computer device and storage medium | |
CN117081801A (en) | Fingerprint identification method, device and medium for content management system of website | |
CN116910820A (en) | Data report processing method, device, computer equipment and storage medium | |
CN116155597A (en) | Access request processing method and device and computer equipment | |
CN106598983A (en) | Information display method and device | |
Francois et al. | Machine learning techniques for passive network inventory | |
WO2021129849A1 (en) | Log processing method, apparatus and device, and storage medium | |
WO2019019456A1 (en) | Claim settlement data processing method and apparatus, computer device and storage medium | |
CN113515705A (en) | Response information generation method, device, equipment and computer readable 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 |