CN110618906A - Detection method and device for missed detection interface, network equipment and storage medium - Google Patents
Detection method and device for missed detection interface, network equipment and storage medium Download PDFInfo
- Publication number
- CN110618906A CN110618906A CN201910725462.2A CN201910725462A CN110618906A CN 110618906 A CN110618906 A CN 110618906A CN 201910725462 A CN201910725462 A CN 201910725462A CN 110618906 A CN110618906 A CN 110618906A
- Authority
- CN
- China
- Prior art keywords
- feature
- request
- characteristic
- test
- tree
- 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.)
- Granted
Links
- 238000001514 detection method Methods 0.000 title claims abstract description 37
- 238000012360 testing method Methods 0.000 claims abstract description 98
- 238000000034 method Methods 0.000 claims abstract description 40
- 239000011159 matrix material Substances 0.000 claims description 46
- 238000004422 calculation algorithm Methods 0.000 claims description 31
- 238000004364 calculation method Methods 0.000 claims description 9
- 230000006870 function Effects 0.000 claims description 8
- 238000001914 filtration Methods 0.000 claims description 7
- 230000003068 static effect Effects 0.000 claims description 7
- 238000004590 computer program Methods 0.000 claims description 6
- 238000003064 k means clustering Methods 0.000 description 12
- 238000010586 diagram Methods 0.000 description 6
- 230000000694 effects Effects 0.000 description 4
- 230000002708 enhancing effect Effects 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 230000005540 biological transmission Effects 0.000 description 3
- 238000010276 construction Methods 0.000 description 3
- 230000007547 defect Effects 0.000 description 3
- 238000007781 pre-processing Methods 0.000 description 3
- 230000015572 biosynthetic process Effects 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 239000000284 extract Substances 0.000 description 2
- 230000001965 increasing effect Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000004931 aggregating effect Effects 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 239000003795 chemical substances by application Substances 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000246 remedial effect Effects 0.000 description 1
- 125000006850 spacer group Chemical group 0.000 description 1
- 239000013598 vector Substances 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/22—Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
- G06F11/2205—Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
- G06F11/221—Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested to test buses, lines or interfaces, e.g. stuck-at or open line faults
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/23—Clustering techniques
-
- 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
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/50—Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Bioinformatics & Computational Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Artificial Intelligence (AREA)
- Signal Processing (AREA)
- Computer Networks & Wireless Communication (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The embodiment of the invention relates to the field of testing, and discloses a method and a device for detecting a leakage test interface, network equipment and a storage medium, wherein the method for detecting the leakage test interface comprises the following steps: acquiring a request message in online traffic; extracting a first request characteristic of the request message; traversing a comparison feature tree according to the first request feature, wherein the comparison feature tree is a feature tree constructed according to a second request feature, and the second request feature is a feature extracted from a request message in the test traffic; and if the first request feature does not exist in the comparison feature tree, outputting an alarm message. The detection method, the detection device, the network equipment and the storage medium for the missed detection interface can improve the detection efficiency of the missed detection interface.
Description
Technical Field
The present invention relates to the field of testing, and in particular, to a method and an apparatus for detecting a missing test interface, a network device, and a storage medium.
Background
In the test work, due to factors such as asynchronous messages between developers and testers, errors in communication and transmission, lack of standardization of development flow and the like, part of interfaces are frequently missed to be tested (not tested), and the untested interfaces may cause problems of functions, safety or performance of products.
Currently, this problem is generally addressed by enhancing management, such as enhancing communication between developers and testers, enhancing the standardization of the development process, or enhancing test coverage, but such an approach is inefficient and adds additional management cost and workload.
Disclosure of Invention
The embodiment of the invention aims to provide a method, a device, network equipment and a storage medium for detecting a missing test interface, so that the detection efficiency of the missing test interface is improved.
In order to solve the above technical problem, an embodiment of the present invention provides a method for detecting a missing test interface, including the following steps: acquiring a request message in online traffic; extracting a first request feature of the request message; traversing a comparison feature tree according to the first request feature, wherein the comparison feature tree is a feature tree constructed according to a second request feature, and the second request feature is a feature extracted from a request message in the test traffic; and if the first request feature does not exist in the comparison feature tree, outputting an alarm message.
The embodiment of the present invention further provides a device for detecting a missing test interface, including: the request acquisition module is used for acquiring a request message in the online flow; the characteristic acquisition module is used for extracting a first request characteristic of the request message; the characteristic comparison module is used for traversing and comparing a characteristic tree according to the first request characteristic, wherein the compared characteristic tree is a characteristic tree constructed according to a second request characteristic, and the second request characteristic is a characteristic extracted from a request message in the test flow; and the alarm output module is used for outputting an alarm message if the first request characteristic does not exist in the comparison characteristic tree.
An embodiment of the present invention further provides a network device, including: at least one processor; and a memory communicatively coupled to the at least one processor; the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the missed test interface detection method.
The embodiment of the invention also provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to realize the detection method of the missed test interface.
Compared with the prior art, the method and the device have the advantages that the comparison characteristic tree is constructed by extracting the characteristics of the request message of the test flow, the characteristics corresponding to the request message of the online flow are obtained and compared with the comparison characteristic tree, whether the missed-test interface exists or not is judged by judging whether the characteristics corresponding to the request message of the online flow exist in the comparison characteristic tree or not, automatic and continuous detection of the missed-test interface is achieved, extra management cost and workload are not increased, and the detection efficiency of the missed-test interface is improved.
In addition, before traversing the comparison feature tree according to the first request feature, the method further includes: acquiring a request message in test flow; extracting a second request characteristic of the request message in the test flow; clustering the second request characteristics by adopting a clustering algorithm; and constructing a comparison feature tree according to the clustered second request features. The second request features are clustered through a clustering algorithm, so that the features of each class in the second request features can be clustered together, and a comparison feature tree can be conveniently constructed.
In addition, clustering the second request features by adopting a clustering algorithm, comprising: forming a feature list according to the second request features corresponding to each test flow; determining a weight factor of each feature according to the position sequence number of each feature in the feature list; forming a total feature list according to second request features corresponding to N test flows, wherein N is a positive integer and is the number of the test flows; forming a characteristic value matrix according to the characteristic list, the weight factor and the total characteristic list; forming a characteristic distance matrix according to the characteristic value matrix; determining the maximum distance of the same cluster according to the preset clustering degree and the characteristic distance matrix; determining K initial clusters according to the maximum distance of the same cluster, wherein K is a positive integer greater than 1; and clustering by adopting a K-means clustering algorithm according to the K initial clusters. And the K value in the K-means clustering algorithm can be determined according to the initial cluster by using the K-means clustering algorithm, so that the defects that the K value in the K-means clustering algorithm is difficult to determine and is easy to fall into a local minimum value and the like are overcome, and the clustering effect is improved.
In addition, determining the weight factor of each feature according to the position sequence number of each feature in the feature list comprises the following steps: determining a weight factor for each feature according to a first calculation:
wherein λ isiA weight factor corresponding to the ith feature in the feature list, L is the total length of the second request feature corresponding to each test flow, LiAnd when the feature is a parameter feature, the weight factor of the parameter feature is the average value of the weight factors calculated by all the parameter features as a whole. The weight factor of each feature is calculated through the position serial number, so that different weights can be configured for different features in the request message, the clustering result conforms to the actual condition, and the clustering effect is improved.
In addition, forming a feature distance matrix from the eigenvalue matrix includes: calculating the distance between every two eigenvalues in the eigenvalue matrix by adopting a Gaussian kernel function; and forming a characteristic distance matrix according to the calculated result. By calculating the characteristic distance matrix, after the maximum distance belonging to a certain cluster is determined, the cluster to which all characteristic values belong can be determined, so that the formation of an initial cluster is facilitated.
In addition, the second request feature includes a domain name, a request path, a request method, and a parameter feature in the request message. By taking the domain name, the request path, the request method and the parameter characteristics in the request message as the request characteristics, the characteristics of the on-line flow and the test flow can be conveniently compared, and whether a missed test interface exists or not can be conveniently judged.
In addition, before acquiring the request message in the online traffic, the method further comprises: and performing static file filtering on the online traffic. By filtering the static file of the request message of the online flow, some useless information in the online flow can be removed, the subsequent data processing is convenient, and the accuracy of the data is ensured.
Drawings
One or more embodiments are illustrated in respective figures of the drawings and are not to be construed as limiting the embodiments.
FIG. 1 is a schematic flow chart illustrating a method for detecting a missed test interface according to a first embodiment of the present invention;
FIG. 2 is a diagram illustrating an alignment feature tree according to a first embodiment of the present invention;
fig. 3 is a flow chart illustrating the method for detecting a missed measure interface according to the first embodiment of the present invention before S103;
fig. 4 is a schematic flowchart of a refinement of S203 in the missed measure interface detection method according to the first embodiment of the present invention;
FIG. 5 is a schematic diagram illustrating a method for detecting a missing test interface according to a first embodiment of the present invention;
FIG. 6 is a block diagram of a device for detecting a missing test interface according to a second embodiment of the present invention;
fig. 7 is a schematic structural diagram of a network device according to a third embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. However, it will be appreciated by those of ordinary skill in the art that numerous technical details are set forth in order to provide a better understanding of the present application in its various embodiments. However, the technical solution claimed in the present application can be implemented without these technical details and various changes and modifications based on the following embodiments.
The first embodiment of the invention relates to a method for detecting a missing test interface. Obtaining a request message in the online flow; extracting a first request characteristic of the request message; traversing a comparison feature tree according to the first request feature, wherein the comparison feature tree is a feature tree constructed according to a second request feature, and the second request feature is a feature extracted from a request message in the test flow; and if the first request feature does not exist in the comparison feature tree, outputting an alarm message. And constructing a feature tree according to the request features of the test flow, then, obtaining the request features of the online flow to compare with the feature tree, and if the request features of the online flow do not exist in the feature tree, indicating that a missed test interface exists during the test, sending an alarm message. The automatic detection of the missing detection interface is realized, and the detection efficiency of the missing detection interface is improved.
The execution agent of the present embodiment may be a server or a server cluster, and is hereinafter referred to as a server, and the following description will take the server as an example.
The specific flow of the detection method for the missed measure interface provided by the embodiment is shown in fig. 1, and the method comprises the following steps:
s101: and acquiring the request message in the online traffic.
S102: a first request feature of the request message is extracted.
S103: and traversing a comparison feature tree according to the first request feature, wherein the comparison feature tree is a feature tree constructed according to a second request feature, and the second request feature is a feature extracted from the request message in the test traffic.
S104: it is determined whether the first requested feature is not present in the feature tree. If the first request feature does not exist in the feature tree, the step S105 is performed; if the first request feature exists in the feature tree, the process ends.
S105: and outputting the alarm message.
The request message refers to a request message sent by the client to the server, optionally, the request message is an HTTP request, and the HTTP request is described as an example below. Wherein the HTTP request comprises: an identifier of the resource and a request method. The identifier of the Resource refers to a Uniform Resource Locator (URL). Wherein, the URL mainly comprises the following parts:
wherein part 1 as a whole is denoted domainn (domain name); part 2 is divided in spacers/may include: [ path ] of1][path2][path3]…[pathn]Part 3 is a parameter, which is typically stored in a URL, separated by the symbol?, for example,? param, when the request method is GET1=data1¶m2=data2&…¶mn=datan(ii) a When the request method is POST, the parameters can be judged according to HTTP message header Content-Type, different message parameter types are classified, and a parameter list is extracted: [ param1][param2][param3]…[paramn]。
Optionally, the extracting the first request feature of the online traffic or the extracting the second request feature of the test traffic may specifically be extracting, for the HTTP request, a domain name, a request path, a request method, and a parameter feature:
[damain][path1][path2]…[pathn][method][param1][param2]…[paramn];
the online flow refers to a request for interacting with a product acquired by a server after the product is online, and the test flow refers to a request for simulating interacting transmission with the product in a test environment.
By taking the domain name, the request path, the request method and the parameter characteristics in the request message as the request characteristics, the characteristics of the on-line flow and the test flow can be conveniently compared, and whether a missing test interface exists or not can be conveniently judged.
After the second request features corresponding to all the test traffic are obtained, a feature tree can be constructed according to the second request features, and a comparison feature tree for comparing with the on-line traffic is obtained. Optionally, after the second request features corresponding to all the test flows are obtained, the server clusters the second request features according to a clustering algorithm, and a comparison feature tree is constructed according to a clustered result. Please refer to fig. 2, which is a diagram illustrating a comparison feature tree.
It should be understood that the request message to get traffic on line refers to a request message to get traffic on line. After acquiring a request message of online flow, extracting a first request feature of the request message, comparing the first request feature with features in a comparison feature tree one by one, if the features in the first request feature do not exist in the comparison feature tree, indicating that an interface corresponding to the online flow and accessed is not included in testing, and if the interface is a missed-testing interface in testing, sending a risk warning message to enable a manager to take corresponding measures, such as testing the interface, and determining whether to take remedial measures according to a test result; if each feature in the first request exists in the comparison feature tree, it indicates that the interface accessed corresponding to the online traffic is included during testing, and there is no interface that is missed to test, and the flow of the step is ended.
Optionally, before the comparison, the domain name in the request message for the on-line traffic and the domain name in the request message for the test traffic are mapped, so that the domain names of the two have a corresponding relationship. Optionally, when the first request feature is compared with the comparison feature tree, if the domain name in the request message of the online traffic has the corresponding domain name in the request message of the test traffic, it indicates that the feature exists in the comparison feature tree, otherwise, it is absent.
Compared with the prior art, the embodiment establishes the comparison feature tree by extracting the features of the request message of the test flow, obtains the features corresponding to the request message of the online flow and compares the features with the comparison feature tree, thereby judging whether the missing detection interface exists or not, realizing the automatic and continuous detection of the missing detection interface, not increasing extra management cost and workload, and improving the detection efficiency of the missing detection interface.
In a specific example, before S101, that is, before acquiring the request message in the online traffic, the method further includes: and performing static file filtering on the online traffic.
Specifically, after acquiring the online traffic, the server pre-processes the acquired online traffic, including filtering out static files such as js, css, and pictures. Optionally, corresponding processing may be performed on the test traffic.
By filtering the static file of the request message of the online flow, some useless information in the online flow can be removed, the subsequent data processing is convenient, and the accuracy of the data is ensured.
In a specific example, as shown in fig. 3, before S103, that is, before comparing the feature tree according to the first request feature, the method for detecting a missed test interface provided in this embodiment further includes the following steps:
s201: and acquiring the request message in the test flow.
S202: second request characteristics of the request messages in the test traffic are extracted.
S203: and clustering the second request characteristics by adopting a clustering algorithm.
S204: and constructing a comparison feature tree according to the clustered second request features.
It should be noted that the test flow rate is all the flow rate for testing the product.
S201 and S202 are similar to S101 and S102, and are not described herein again. The clustering algorithm may include a K-means clustering algorithm, a mean shift clustering algorithm, a density-based clustering method, and the like, and is not particularly limited herein.
Specifically, the server side obtains all request messages for testing the flow, and extracts domain names, request paths, request methods and parameter characteristics from the request messages to obtain second request characteristics; clustering second request characteristics corresponding to all the test flows according to a clustering algorithm, wherein the clustering algorithm can be preset in the server; and the server side constructs a comparison characteristic tree according to the result after clustering by adopting a clustering algorithm.
By extracting the second request features of the test flow and clustering the second request features according to a clustering algorithm, the features of each class in the second request features can be clustered together, and the construction of a comparison feature tree is facilitated.
In a specific example, as shown in fig. 4, in S203, clustering the second request feature by using a clustering algorithm may specifically include the following steps:
s2031: and forming a feature list according to the second request features corresponding to each test flow.
S2032: and determining the weight factor of each feature according to the position sequence number of each feature in the feature list.
S2033: and forming a total characteristic list according to second request characteristics corresponding to the N test flows, wherein N is a positive integer and is the number of the test flows.
S2034: and forming a characteristic value matrix according to the characteristic list, the weight factor and the total characteristic list.
S2035: and forming a characteristic distance matrix according to the characteristic value matrix.
S2036: and determining the maximum distance of the same cluster according to the preset clustering degree and the characteristic distance matrix.
S2037: and determining K initial clusters according to the maximum distance of the same cluster, wherein K is a positive integer greater than 1.
S2038: and clustering by adopting a K-means clustering algorithm according to the K initial clusters.
Specifically, the second request feature extracted for the request feature of each test flow is: [ damain)][path1][path2]…[pathn][method][param1][param2]…[paramn]From these features, a feature list is formed. For example, if the HTTP request is:
https://www.google.com/webhp/search?q=p1&ei=p2&start=p3;
then the following list of features can be obtained:
[https://www.google.com][webhp][search][GET][q][ei][start];
and determining the weight factor of each feature according to the position sequence number of each feature in the feature list. Alternatively, the weight factor for each feature may be determined using the following first calculation:
wherein λ isiThe weighting factor corresponding to the ith feature in the feature list, L is the total length of the second request feature corresponding to each test flow,liThe position number of the ith characteristic in the characteristic list is the serial number of the position of the ith characteristic in the characteristic list.
The above list of features [ https:// www.google.com][webhp][search][GET][q][ei][start]Each square bracket is a feature, and the total length of the square bracket is 7 if the number of the feature values is 7; the first square bracket feature is in the first position in the feature list, then li1, the rest characteristics are analogized in the same way; lambda [ alpha ]iAnd λLIs an unknown number, wherein [ q ]][ei][start]For parameters, these parameters are calculated as a whole reference, with the position numbers li(ii) 5; the calculation of the first row of each feature is thus: lambda [ alpha ]1=(7-1+1)*λL、 λ2=(7-2+1)*λL、λ3=(7-3+1)*λL、λ4=(7-4+1)*λL、λ5=(7-5+1)*λL(ii) a Due to lambda1+λ2+λ3+λ4+λ51, then λ can be calculatedLCorresponding to 1/25, λ can be obtained1=7/25、 λ2=6/25、λ3=5/25、λ44/25 and λ53/25 due to λ5Is λ5、λ6And λ7Sum, i.e. λ5=λ6=λ71/25, the weighting factor for each feature thus obtained is:
it should be understood that the weighting factor is because the influence of different parts of features on the clustering procedure is different, for example, two HTTP requests with the same domain belonging to the same category are more likely to belong to the same category than two HTTP requests with the same path or param, and the weighting factor of domain is higher than that of path or param. Since the feature list is in the order of domain name, request path, request method and parameters, the weight factor of each feature can be calculated based on the location number and the first calculation formula. Alternatively, other calculation formulas may be used to calculate the weight factor of each feature, which is not specifically limited in this embodiment.
The weight factor of each feature is calculated through the position serial number, so that different features in the request message can be configured with different weights, the clustering result is in accordance with the actual situation, and the clustering effect is improved.
And the server forms a total feature list according to the second request features corresponding to the N test flows, wherein N is a positive integer and is the number of the test flows. Optionally, the test traffic may be deduplicated to form an overall feature list, where N is the number of the test traffic after deduplication.
The server side can form a characteristic value matrix according to the characteristic list of each test flow, the weight factor of each characteristic corresponding to the characteristic list and the total characteristic list. Specifically, the total feature list formed by aggregating and de-duplicating all HTTP requests is:
[X1 X2 X3 … XL];
where L is the length of the summarized feature list. Vectorizing the feature list corresponding to each HTTP request, wherein if X in the total feature list is in the feature list corresponding to the HTTP request, the vectorized value is a weight factor of X in the feature list; if X in the total feature list is not in the feature list corresponding to the HTTP request, the vectorized value is 0. Taking the HTTP request as an example, the corresponding feature list is:
[https://www.google.com][webhp][search][GET][q][ei][start];
if the total feature list is:
[https://www.google.com][https://www.baidu.com][webhp][search][find][GET][q][ei][start][end] ;
the result of vectorization of the feature list is:
therefore, the eigenvalue matrix can be obtained according to the eigenvalue list vectors corresponding to the N test flows:
after the eigenvalue matrix is obtained, the server calculates the distance between each two points in the eigenvalue matrix, and a N × N eigenvalue distance matrix can be obtained. Alternatively, a gaussian kernel function may be used to calculate the distance between every two eigenvalues in the eigenvalue matrix, i.e.:
wherein m and n have different values and represent different rows in the eigenvalue matrix. Alternatively, other distance calculation formulas may be used for calculation, such as euclidean distance, manhattan distance, or minkowski distance, and the like, and are not limited herein.
By calculating the characteristic distance matrix, after the maximum distance belonging to a certain cluster is determined, the cluster to which all characteristic values belong can be determined, so that the formation of an initial cluster is facilitated.
In S2036, the preset clustering degree is, for example, a certain path or parameter level clustered into the request message, and may be set according to actual needs, which is not specifically limited herein. The maximum distance d of whether a certain eigenvalue in the eigenvalue matrix belongs to a certain cluster can be calculated according to the degree of clusteringmaxFor example, if the parameters are clustered to the parameter level, the distance corresponding to the two parameters with the largest difference is the maximum distance dmax. If the distance is calculated by adopting the Gaussian kernel function, the distance is greater than the maximum distance d in the characteristic distance matrixmaxMay be divided into a cluster. The server side traverses each row in the characteristic distance matrix, and the median value of the characteristic distance matrix is larger than dmaxAnd dividing the corresponding features into one cluster, otherwise, adding one cluster to form K initial clusters, and finishing clustering by using a K-means clustering algorithm according to the K initial clusters.
It can be understood that the K-means clustering algorithm is simple and easy to implement, but has the defects that the K value is difficult to determine, and the K value is easy to fall into a local minimum value. By determining the value of K first using the method described above, these drawbacks can be avoided.
By calculating the weight factor, a characteristic value matrix can be obtained; through the eigenvalue matrix, an eigenvalue distance matrix formed by every two eigenvalues can be calculated; according to the characteristic distance matrix, whether the characteristics in the characteristic value matrix belong to one cluster can be judged to form an initial cluster; and then, clustering is completed by using a K-means clustering algorithm according to the initial cluster, so that the K value in the K-means clustering algorithm can be determined, the defects that the K value is difficult to determine and is easy to fall into a local minimum value in a K-means clustering algorithm and the like are overcome, and the clustering effect is improved.
Please refer to fig. 5, which is a schematic diagram of the present embodiment. Specifically, the server side obtains test flow, preprocesses the test flow, extracts request features corresponding to the test flow, and carries out vectorization and clustering to form a comparison feature tree; and then acquiring the online flow, preprocessing the online flow, extracting a request feature corresponding to the online flow, comparing the request feature with a feature in a comparison feature tree, and if the request feature does not exist, sending an alarm message.
The steps of the above methods are divided for clarity, and the implementation can be combined into one step or split into multiple steps, and all that is included in the same logic relationship is within the scope of the present patent; it is within the scope of the patent to add insignificant modifications to the algorithms or flows or to introduce insignificant design changes to the core design without changing the algorithms or flows.
A second embodiment of the present invention relates to a device for detecting a missed test interface, as shown in fig. 6, including a request obtaining module 301, a feature obtaining module 302, a feature comparing module 303, and an alarm outputting module 304. Specifically, the method comprises the following steps:
a request obtaining module 301, configured to obtain a request message in an online traffic;
a feature obtaining module 302, configured to extract a first request feature of the request message;
the feature comparison module 303 is configured to traverse a comparison feature tree according to the first request feature, where the comparison feature tree is a feature tree constructed according to a second request feature, and the second request feature is a feature extracted from a request message in the test traffic;
and an alarm output module 304, configured to output an alarm message if the first requested feature does not exist in the comparison feature tree.
Further, the device for detecting the interface leakage detection further comprises a feature tree construction module, wherein the feature tree construction module is used for:
acquiring a request message in test flow;
extracting a second request characteristic of the request message in the test flow;
clustering the second request characteristics by adopting a clustering algorithm;
and constructing a comparison feature tree according to the clustered second request features.
Further, clustering the second request features by using a clustering algorithm specifically includes:
forming a feature list according to the second request features corresponding to each test flow;
determining a weight factor of each feature according to the position sequence number of each feature in the feature list;
forming a total feature list according to second request features corresponding to N test flows, wherein N is a positive integer and is the number of the test flows;
forming a characteristic value matrix according to the characteristic list, the weight factor and the total characteristic list;
forming a characteristic distance matrix according to the characteristic value matrix;
determining the maximum distance of the same cluster according to the preset clustering degree and the characteristic distance matrix;
determining K initial clusters according to the maximum distance of the same cluster, wherein K is a positive integer greater than 1;
and clustering by adopting a K-means clustering algorithm according to the K initial clusters.
Further, determining a weight factor of each feature according to the position sequence number of each feature in the feature list specifically includes:
determining a weight factor for each feature according to a first calculation:
wherein λ isiA weight factor corresponding to the ith feature in the feature list, L is the total length of the second request feature corresponding to each test flow, LiAnd when the feature is a parameter feature, the weight factor of the parameter feature is the average value of the weight factors calculated by all the parameter features as a whole.
Further, forming a feature distance matrix from the feature value matrix, comprising:
calculating the distance between every two eigenvalues in the eigenvalue matrix by adopting a Gaussian kernel function;
and forming a characteristic distance matrix according to the calculated result.
Further, the second request characteristics include a domain name, a request path, a request method, and parameter characteristics in the request message.
Further, the device for detecting the leakage detection interface further comprises a flow preprocessing module, wherein the flow preprocessing module is specifically used for: and performing static file filtering on the online traffic.
It should be understood that this embodiment is an example of the apparatus corresponding to the first embodiment, and that this embodiment can be implemented in cooperation with the first embodiment. The related technical details mentioned in the first embodiment are still valid in this embodiment, and are not described herein again in order to reduce repetition. Accordingly, the related-art details mentioned in the present embodiment can also be applied to the first embodiment.
It should be noted that each module referred to in this embodiment is a logical module, and in practical applications, one logical unit may be one physical unit, may be a part of one physical unit, and may be implemented by a combination of multiple physical units. In addition, in order to highlight the innovative part of the present invention, elements that are not so closely related to solving the technical problems proposed by the present invention are not introduced in the present embodiment, but this does not indicate that other elements are not present in the present embodiment.
A third embodiment of the present invention relates to a network device, as shown in fig. 7, including at least one processor 401; and a memory 402 communicatively coupled to the at least one processor 401; the memory 402 stores instructions executable by the at least one processor 401, and the instructions are executed by the at least one processor 401, so that the at least one processor 401 can execute the above-mentioned missed interface detection method.
Where the memory 402 and the processor 401 are coupled by a bus, which may include any number of interconnected buses and bridges that couple one or more of the various circuits of the processor 401 and the memory 402 together. The bus may also connect various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface provides an interface between the bus and the transceiver. The transceiver may be one element or a plurality of elements, such as a plurality of receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor 401 may be transmitted over a wireless medium via an antenna, which may receive the data and transmit the data to the processor 401.
The processor 401 is responsible for managing the bus and general processing and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And memory 402 may be used to store data used by processor 401 in performing operations.
A fourth embodiment of the present invention relates to a computer-readable storage medium storing a computer program. The computer program realizes the above-described method embodiments when executed by a processor.
That is, those skilled in the art can understand that all or part of the steps in the method for implementing the above embodiments may be implemented by a program to instruct related hardware, where the program is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, etc.) or a processor (processor) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, an optical disk, or other media capable of storing program codes.
It will be understood by those of ordinary skill in the art that the foregoing embodiments are specific examples for carrying out the invention, and that various changes in form and details may be made therein without departing from the spirit and scope of the invention in practice.
Claims (10)
1. A method for detecting a missing test interface is characterized by comprising the following steps:
acquiring a request message in online traffic;
extracting a first request characteristic of the request message;
traversing a comparison feature tree according to the first request feature, wherein the comparison feature tree is a feature tree constructed according to a second request feature, and the second request feature is a feature extracted from a request message in the test traffic;
and if the first request feature does not exist in the comparison feature tree, outputting an alarm message.
2. The missed test interface detection method of claim 1, wherein prior to traversing the comparison feature tree based on the first requested feature, further comprising:
acquiring a request message in the test flow;
extracting a second request characteristic of the request message in the test flow;
clustering the second request characteristics by adopting a clustering algorithm;
and constructing the comparison feature tree according to the clustered second request features.
3. The missed test interface detection method of claim 2, wherein the clustering the second request feature using a clustering algorithm comprises:
forming a feature list according to the second request features corresponding to each test flow;
determining a weight factor of each feature according to the position sequence number of each feature in the feature list;
forming a total feature list according to N second request features corresponding to the test traffic, wherein N is a positive integer and is the number of the test traffic;
forming a characteristic value matrix according to the characteristic list, the weight factors and the total characteristic list;
forming a characteristic distance matrix according to the characteristic value matrix;
determining the maximum distance of the same cluster according to a preset clustering degree and the characteristic distance matrix;
determining K initial clusters according to the maximum distance of the same cluster, wherein K is a positive integer greater than 1;
and clustering by adopting a K mean value clustering algorithm according to the K initial clusters.
4. The missed test interface detection method of claim 3, wherein the determining the weight factor for each feature according to the location number of each feature in the feature list comprises:
determining a weight factor for each of the features according to a first calculation formula:
wherein λ isiA weighting factor corresponding to the ith feature in the feature list, L being the total length of the second request feature corresponding to each of the test flows, LiThe position serial number of the ith feature in the feature list is the position serial number of the ith feature in the feature list, and when the feature is a parameter feature, the weight factor of the parameter feature is the weight factor calculated by all the parameter features as a wholeAverage value of the children.
5. The missed test interface detection method of claim 3, wherein forming an eigenvalue matrix according to the eigenvalue matrix comprises:
calculating the distance between every two eigenvalues in the eigenvalue matrix by adopting a Gaussian kernel function;
and forming the characteristic distance matrix according to the calculated result.
6. The missed interface detection method of any of claims 1-5, wherein the second request characteristics include a domain name, a request path, a request method, and parameter characteristics in the request message.
7. The missed interface detection method of claim 6, wherein prior to obtaining the request message in the online traffic, further comprising: and performing static file filtering on the online flow.
8. A missed measure interface detection device, comprising:
the request acquisition module is used for acquiring a request message in the online flow;
the characteristic acquisition module is used for extracting a first request characteristic of the request message;
the characteristic comparison module is used for traversing a comparison characteristic tree according to the first request characteristic, wherein the comparison characteristic tree is a characteristic tree constructed according to a second request characteristic, and the second request characteristic is a characteristic extracted from a request message in the test flow;
and the alarm output module is used for outputting an alarm message if the first request feature does not exist in the comparison feature tree.
9. A network device, comprising:
at least one processor; and the number of the first and second groups,
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the missed interface detection method of any one of claims 1-7.
10. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the missed interface detection method of any of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910725462.2A CN110618906B (en) | 2019-08-07 | 2019-08-07 | Missing detection interface detection method and device, network equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910725462.2A CN110618906B (en) | 2019-08-07 | 2019-08-07 | Missing detection interface detection method and device, network equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110618906A true CN110618906A (en) | 2019-12-27 |
CN110618906B CN110618906B (en) | 2023-07-18 |
Family
ID=68921687
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910725462.2A Active CN110618906B (en) | 2019-08-07 | 2019-08-07 | Missing detection interface detection method and device, network equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110618906B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20150370694A1 (en) * | 2014-06-20 | 2015-12-24 | Vmware, Inc. | Automatic updating of graphical user interface element locators based on image comparison |
US9483387B1 (en) * | 2014-03-17 | 2016-11-01 | Amazon Technologies, Inc. | Tree comparison functionality for services |
CN107329861A (en) * | 2017-06-12 | 2017-11-07 | 北京奇安信科技有限公司 | A kind of multiplex roles method of testing and device |
CN109002391A (en) * | 2018-06-28 | 2018-12-14 | 西南电子技术研究所(中国电子科技集团公司第十研究所) | The method of automatic detection embedded software interface testing data |
CN109766263A (en) * | 2018-12-15 | 2019-05-17 | 深圳壹账通智能科技有限公司 | Automatic test analysis and processing method, device, computer equipment and storage medium |
-
2019
- 2019-08-07 CN CN201910725462.2A patent/CN110618906B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9483387B1 (en) * | 2014-03-17 | 2016-11-01 | Amazon Technologies, Inc. | Tree comparison functionality for services |
US20150370694A1 (en) * | 2014-06-20 | 2015-12-24 | Vmware, Inc. | Automatic updating of graphical user interface element locators based on image comparison |
CN107329861A (en) * | 2017-06-12 | 2017-11-07 | 北京奇安信科技有限公司 | A kind of multiplex roles method of testing and device |
CN109002391A (en) * | 2018-06-28 | 2018-12-14 | 西南电子技术研究所(中国电子科技集团公司第十研究所) | The method of automatic detection embedded software interface testing data |
CN109766263A (en) * | 2018-12-15 | 2019-05-17 | 深圳壹账通智能科技有限公司 | Automatic test analysis and processing method, device, computer equipment and storage medium |
Non-Patent Citations (1)
Title |
---|
企鹅号 - TESTERHOME: "搞定接口测试变态要求:海量接口返回值对比验证", 《HTTPS://CLOUD.TENCENT.COM/DEVELOPER/NEWS/303327》 * |
Also Published As
Publication number | Publication date |
---|---|
CN110618906B (en) | 2023-07-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109342989B (en) | Error analysis method and device for electric energy meter | |
CN108683530B (en) | Data analysis method and device for multi-dimensional data and storage medium | |
CN110572297B (en) | Network performance evaluation method, server and storage medium | |
CN109167812B (en) | Method for evaluating service quality and determining adjustment strategy, server and storage medium | |
CN103631787B (en) | Webpage type identification method and type of webpage identification device | |
CN106776337A (en) | Performance analysis method and device and electronic equipment | |
CN108763536A (en) | Data bank access method and device | |
CN107391230B (en) | Implementation method and device for determining load of virtual machine | |
CN113504996A (en) | Load balance detection method, device, equipment and storage medium | |
EP2731021B1 (en) | Apparatus, program, and method for reconciliation processing in a graph database | |
CN110618906B (en) | Missing detection interface detection method and device, network equipment and storage medium | |
CN111581235A (en) | Method and system for identifying common incidence relation | |
CN109409411B (en) | Problem positioning method and device based on operation and maintenance management and storage medium | |
CN103491074A (en) | Botnet detection method and device | |
CN116366312A (en) | Web attack detection method, device and storage medium | |
CN113052509B (en) | Model evaluation method, model evaluation device, electronic apparatus, and storage medium | |
CN109547236A (en) | Electronic data uploads storage method, readable storage medium storing program for executing and terminal | |
CN113285978B (en) | Fault identification method based on block chain and big data and general computing node | |
CN116842183A (en) | Map merging method and device, electronic equipment and storage medium | |
CN113869904A (en) | Suspicious data identification method, device, electronic equipment, medium and computer program | |
CN114490405A (en) | Resource demand determination method, device, equipment and storage medium | |
JP2014164486A (en) | Quality attribute specification system for service quality information and quality attribute specification method for service quality information | |
CN112527622A (en) | Performance test result analysis method and device | |
CN116841913B (en) | Test case generation method and device, electronic equipment and storage medium | |
CN104050070B (en) | High-dimensional flow data changing point detection method in distributed system |
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 |