API (Application Program Interface) description file verification method for AI (Automatic Infrastructure) automatic test
By extracting and analyzing the feature information in the API interface description file, and combining historical test data for error correction and matrix evaluation, the accuracy and completeness of API interface description file verification are solved, and efficient and reliable API interface verification and automated testing are achieved.
Patent Information
- Application Number
- CN202411622391.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-03-07
AI Technical Summary
It is difficult for the prior art to effectively verify the accuracy and completeness of API interface description files, which makes it difficult to improve the efficiency and accuracy of API testing.
By reading the API interface description file, extracting the feature information of each API interface and storing it in a structured data structure, calculating the mean and deviation of the feature information, combining historical test data for error correction, building a correction relative error matrix, performing matrix evaluation and calculation, and using sample data and signal quality basic analyzer for integrated analysis to achieve comprehensive verification of the API interface.
It improves the accuracy of API interface verification, reduces the probability of false alarms and missed alarms, enhances the security and stability of the system, and realizes the efficiency and reliability of automated testing.
Smart Images

Figure BDA0005133783720000091 
Figure BDA0005133783720000121 
Figure FDA0005133783710000031
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of computer technology, and in particular relates to a method for verifying an API interface description file for AI automated testing. Background Art
[0002] With the rapid development of information technology, APIs (Application Programming Interfaces) have become a core component of modern software development and integration. APIs enable communication and interaction between different software applications and services, enabling data sharing and expanding functionality. However, as the number and complexity of APIs continue to increase, testing them to ensure their quality and stability has become increasingly important.
[0003] Traditional API testing methods often rely on manual testing, which is not only time-consuming and labor-intensive, but also prone to errors. To improve testing efficiency and accuracy, AI-powered automated testing has emerged. AI-powered automated testing leverages artificial intelligence technology to build automated testing frameworks and tools, enabling fast, accurate, and comprehensive testing of API interfaces.
[0004] API interface description files play a crucial role in AI automated testing. They detail key information such as the API path, method, request parameters, and response parameters, serving as the foundation and basis for testers to conduct API testing. However, because API interface description files can contain a large amount of information and this information can vary between different APIs, effectively verifying the accuracy and completeness of API interface description files has become a pressing issue. Summary of the Invention
[0005] In order to overcome the shortcomings and deficiencies of the above-mentioned prior art, the present invention adopts the following technical solutions:
[0006] The API interface description file verification method for AI automated testing is as follows:
[0007] Step 1: Read the API interface description file to obtain the description information of all API interfaces;
[0008] Step 2: traverse each API interface in the API interface description file, extract its feature information, including path, method, request parameters, and response parameters, and store the extracted feature information in a structured data structure;
[0009] Step 3: Calculate the mean of each API interface feature information, calculate the deviation of each API interface feature information from the mean, and obtain relative error information of multiple API interfaces;
[0010] Step 4: Obtain historical test data of the API interface, including historical time relative error information and historical parameter relative error information; use the historical data to perform verification in the relative error correction table to obtain multiple time correction coefficients and multiple parameter correction coefficients; use the correction coefficients to perform correction calculations on the API interface relative error information to obtain multiple corrected API interface relative error information;
[0011] Step 5: Obtain preset API interface error information, including preset time relative error information and preset parameter relative error information; construct a corrected relative error matrix based on multiple corrected API interface relative error information; perform matrix evaluation calculation based on the corrected relative error matrix, preset time relative error information, and preset parameter relative error information to obtain multiple single-channel API interface detection results;
[0012] Step 6: Use sample data and the signal quality basic analyzer to perform integrated analysis on the single-channel API test results to obtain the signal quality level;
[0013] Step 7. Parameter Verification and Service Circuit Breaking: Collect parameter samples and service call parameters, input them into the parameter verification model for annotation; decide whether to allow the API request to pass based on the annotation results; input the annotation and service call parameters into the circuit breaker threshold model, output the safety threshold; input the parameter samples into the service grading model, output the service rating; input the service rating and safety threshold into the circuit breaker activation model, output the activation code.
[0014] Preferably, the parameter sample includes parameter type, parameter name, parameter value range, parameter format and parameter mandatory; the annotations of the parameter sample include normal, type mismatch, injection attack, value out of bounds, malformed data and missing mandatory fields; the service call parameters include error rate and response time.
[0015] As a preferred option, the structure of the parameter verification model is a hybrid of CNN+LSTM+DNN, including:
[0016] CNN module: includes the first input layer, two convolutional layers (the first and second convolutional layers), two pooling layers (the first and second pooling layers), and the first output layer; the first input layer receives a one-dimensional sequence input, the convolution kernel size is 1×3, the activation function is ReLU, the first convolutional layer depth is 32, the second convolutional layer depth is 64, the pooling layer window size and stride are both 2, and the first output layer outputs a 64-channel one-dimensional vector sequence;
[0017] LSTM module: includes the second input layer, LSTM layer, and second output layer; the second input layer receives the one-dimensional vector sequence output by the CNN module, the hidden state dimension of the LSTM layer is 64, the LSTM unit contains the input gate, candidate unit state, recurrent unit, forget gate, and output gate, and the activation functions are sigmoid and tanh respectively. The second output layer outputs the hidden state vector of the last time step;
[0018] DNN module: includes the third input layer, the first hidden layer, the second hidden layer and the third output layer; the third input layer concatenates the one-dimensional vector sequence output by the CNN module and the hidden state vector output by the LSTM module. The number of input nodes is 128, the number of nodes in the first hidden layer and the second hidden layer are both 256, the activation function is ReLU, dropout is added to the second hidden layer, and the dropout rate is 0.5. The number of nodes in the third output layer is 6, and the activation function is Softmax.
[0019] Preferably, the training method of the parameter verification model includes:
[0020] Select N groups of parameter samples and their corresponding annotations from the background log to form a training set;
[0021] Initialize the weights of the parameter validation model;
[0022] Forward propagation calculates the loss function loos, backward propagation calculates the gradient, and the optimizer Adam is set to update the network weights. Repeat the training until the loss function converges, and the parameter verification model training is completed;
[0023] Among them, the calculation formula of the loss function loos is as follows: y i is the true probability of the annotation corresponding to the parameter sample of group i; p i is the predicted probability of the annotation corresponding to the i-th group of parameter samples; ∈ is the preset value; N is the number of sample groups; i≤N.
[0024] Preferably, the method for constructing the circuit breaker threshold model includes:
[0025] Convert the annotations and service call parameters of each set of parameter samples into the form of a first feature vector. The elements in the first feature vector include normal, type mismatch, injection attack, value out of bounds, malformed data, missing required fields, error rate, and response time.
[0026] The set of all first eigenvectors is used as the input of the circuit breaker threshold model. The circuit breaker threshold model uses the safety threshold predicted for each set of first eigenvectors as the output, the actual safety threshold corresponding to each set of first eigenvectors as the prediction target, and the minimization of the sum of the first prediction accuracies of all predicted safety thresholds as the training goal.
[0027] The calculation formula of the first prediction accuracy is as follows: Kd=(Zd-Qd) 2 ; Zd is the predicted safety threshold corresponding to the annotation of the d-th group of parameter samples and the service call parameters; Qd is the actual safety threshold; d is the group number of the first eigenvector. The circuit breaker threshold model is trained until the sum of the first prediction accuracy reaches convergence and the training is stopped.
[0028] Preferably, the service ratings include 11, 12, and 13; the activation code is 0 or 1, 0 means not activating the fuse mechanism, and 1 means activating the fuse mechanism; 13 is core service, 12 is general service, and 11 is non-core service.
[0029] Preferably, the method for constructing the service grading model includes:
[0030] Convert each set of API request parameter samples into a second feature vector, where the elements of the second feature vector include parameter type, parameter name, parameter value range, parameter format, and parameter mandatory.
[0031] The set of all second eigenvectors is used as input to the service grading model. The service grading model uses the service rating predicted for each set of second eigenvectors as output, uses the actual service rating corresponding to each set of second eigenvectors as a prediction target, and uses minimizing the sum of the second prediction accuracies of all predicted service ratings as a training objective.
[0032] The calculation formula of the second prediction accuracy is as follows: Tr = (Sr-Vr) 2 ; Sr is the predicted service rating corresponding to the parameter sample of the rth group of API requests; Vr is the actual service rating; r is the group number of the second feature vector. The service grading model is trained until the sum of the second prediction accuracies reaches convergence and the training is stopped.
[0033] Preferably, the method for constructing the circuit breaker initiation model includes:
[0034] Collect c groups of service ratings and activation codes corresponding to security thresholds in advance, and convert the service ratings, security thresholds, and corresponding activation codes into a corresponding set of feature vectors;
[0035] Each set of feature vectors is used as the input to the circuit breaker activation model. The circuit breaker activation model outputs a set of activation codes corresponding to each set of service ratings and safety thresholds. The actual activation codes corresponding to each set of service ratings and safety thresholds are used as prediction targets. The actual activation codes are the pre-collected activation codes corresponding to the service ratings and safety thresholds. The training objective is to minimize the sum of the prediction errors for all service ratings and safety thresholds.
[0036] The calculation formula of the prediction error is as follows: dfrh = (drh - dxh) 2 ; drh is the predicted value of the startup code corresponding to the hth group of service ratings and safety thresholds; dxh is the actual startup code; h is the group number of the feature vector corresponding to the service rating and safety threshold. The circuit breaker startup model is trained until the sum of the prediction errors reaches convergence and the training is stopped.
[0037] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:
[0038] 1. The present invention extracts characteristic information such as the path, method, request parameters, response parameters, etc. of each API interface by reading the API interface description file, and stores it in a structured data structure to provide basic data for subsequent verification; by calculating the mean and deviation of the characteristic information of each API interface, relative error information is obtained, and error correction is performed in combination with historical test data to improve the accuracy of verification.
[0039] 2. The present invention constructs a corrected relative error matrix, performs matrix evaluation calculations, obtains single-channel API interface detection results, and uses sample data and a signal quality basic analyzer for integrated analysis to derive the signal quality level, ensuring the comprehensiveness and reliability of the verification results.
[0040] 3. During the API interface description file verification process, the present invention collects parameter samples and service call parameters, annotates them through the parameter verification model, and decides whether to allow the API request to pass based on the annotation results. It also implements dynamic circuit breaker protection for services through the circuit breaker threshold model, service grading model and circuit breaker startup model to enhance the security of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0042] Figure 1 The flowchart of the API interface description file verification method for AI automated testing of the present invention is shown;
[0043] Figure 2 A flowchart of relative error correction of the API interface of the present invention is shown;
[0044] Figure 3 A flow chart of parameter verification and service fusing according to the present invention is shown. DETAILED DESCRIPTION
[0045] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0046] In addition, the described features, structures or characteristics can be combined in any suitable manner in one or more example embodiments. In the following description, many specific details are provided to provide a full understanding of the example embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure can be practiced while omitting one or more of the specific details, or other methods, components, steps, etc. can be adopted. In other cases, well-known structures, methods, implementations or operations are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0047] Example 1:
[0048] See Figure 1 As shown, the API interface description file verification method for AI automated testing in this embodiment includes the following steps:
[0049] Step 1: Read the API interface description file to obtain the description information of all API interfaces.
[0050] Read the API interface description file to obtain the description information of all API interfaces, including path, method, request parameters, response parameters, etc.
[0051] Step 2: Extract API interface features.
[0052] Traverse API interface description information: Traverse each API interface in the API interface description file and extract its characteristic information, including path, method, request parameters, response parameters, etc.
[0053] Storing feature information: Store the extracted feature information in a structured data structure, such as a dictionary or object.
[0054] Step 3: Relative analysis of API interface features.
[0055] Purpose: Calculate the deviation between the feature information of each API interface and the mean, and obtain the relative error information of multiple API interfaces.
[0056] Calculate the mean: Calculate the mean of each API interface feature information (such as path, method, request parameters, and response parameters).
[0057] Calculate deviation: Calculate the deviation between the feature information of each API interface and the mean, and obtain the relative error information of multiple API interfaces.
[0058] Example: Suppose there are two API interfaces, with paths / users and / orders, and methods of GET and POST respectively.
[0059] Calculate the path mean: ( / users+ / orders) / 2
[0060] Calculation method: (GET+POST) / 2
[0061] Calculate the deviation of each API interface's path and method from the mean.
[0062] Step 4: Correct relative errors of the API interface.
[0063] Purpose: To correct and calculate the relative error information of multiple API interfaces based on the historical test data of the API interface.
[0064] See Figure 2 As shown, the relative error correction of the API interface is as follows:
[0065] Get historical data: Get historical test data of the API interface, including historical time relative error information and historical parameter relative error information.
[0066] Calculate the correction coefficients: Use historical data to verify in the relative error correction table to obtain multiple time correction coefficients and multiple parameter correction coefficients.
[0067] Correction: Correction coefficients are used to calculate the relative error information of the API interface to obtain multiple corrected relative error information of the API interface.
[0068] Example:
[0069] Assume that in the historical data, the historical time relative error of path / users is 0.05, and the historical time relative error of path / orders is 0.03.
[0070] Calculation time correction factor: 0.05->1.05, 0.03->1.03
[0071] Use the correction coefficient to correct the current API interface relative error information.
[0072] Step 5: API interface matrix evaluation.
[0073] Matrix evaluation calculation:
[0074] Purpose: According to the preset API interface error information, perform matrix evaluation calculation on the relative error information of multiple corrected API interfaces.
[0075] Get preset error information: Get preset API interface error information, including preset time relative error information and preset parameter relative error information.
[0076] Constructing a matrix: Constructing a correction relative error matrix based on the relative error information of multiple correction API interfaces.
[0077] Matrix evaluation: Matrix evaluation calculation is performed based on the corrected relative error matrix, preset time relative error information, and preset parameter relative error information to obtain multiple single-channel API interface detection results.
[0078] Example: Construct the corrected relative error matrix A,
[0079]
[0080] Perform matrix evaluation calculations:
[0081] K i =WT·(T i -T)+WC·(C i -C);
[0082] Among them, K i is the single-channel signal detection result of the i-th API interface; WT and WC are the time weight and parameter weight; T and C are the preset time relative error information and the preset parameter relative error information respectively; T i and C i It is the correction time relative error information and correction parameter relative error information of the i-th API interface.
[0083] Step 6: API interface integration analysis.
[0084] Based on the detection results of multiple single-channel API interfaces, integrated analysis is performed to obtain the verification results of the API interface.
[0085] Get sample data: Get multiple sample single-channel API interface test result sets and multiple sample signal quality levels.
[0086] Build a basic analyzer: Use sample data to build a basic analyzer of signal quality.
[0087] Integrated analysis: Use the signal quality basic analyzer to perform integrated analysis on multiple single-channel API interface detection results to obtain the signal quality level as the verification result of the multi-channel API interface.
[0088] Example: There are multiple sample single-channel API interface test results and the corresponding signal quality levels.
[0089] Build a basic signal quality analyzer to integrate and analyze the current multiple single-channel API interface detection results to obtain the final signal quality level.
[0090] Step 7: Parameter verification and service circuit breaking.
[0091] See Figure 3 As shown, parameter verification and service fuse are as follows:
[0092] Collect parameter samples of API requests and service call parameters: During the API interface description file verification process, collect parameter samples of API requests and service call parameters.
[0093] Input the parameter samples of the API request into the pre-built parameter verification model and output the annotations of the parameter samples: Input the collected parameter samples into the pre-built parameter verification model and output the annotations of the parameter samples.
[0094] Determine whether to grant permission to the API request based on the annotations of the parameter sample:
[0095] When the parameter sample is marked as normal, the API request is granted permission.
[0096] When the parameter sample is not labeled as normal, the API request is denied permission and an error report is sent to the backend.
[0097] Input parameter sample annotations and service call parameters into the pre-built circuit breaker threshold model to output the safety threshold: Input parameter sample annotations and service call parameters into the pre-built circuit breaker threshold model to output the safety threshold.
[0098] Input the parameter sample of the API request into the pre-built service grading model to output the service rating: Input the parameter sample of the API request into the pre-built service grading model to output the service rating.
[0099] Input the service rating and safety threshold into the pre-built circuit breaker activation model and output the activation code: Input the service rating and safety threshold into the pre-built circuit breaker activation model and output the activation code.
[0100] Parameter samples and annotations
[0101] Parameter sample: including parameter type, parameter name, parameter value range, parameter format and parameter mandatory.
[0102] Annotation of parameter samples: including normal, type mismatch, injection attack, value out of bounds, malformed data, and missing required fields.
[0103] Service call parameters: including error rate and response time.
[0104] Parameter Verification Model
[0105] Structure: A hybrid of CNN+LSTM+DNN, including CNN modules, LSTM modules, and DNN modules.
[0106] CNN module: includes the first input layer, two convolutional layers (the first convolutional layer and the second convolutional layer), two pooling layers (the first pooling layer and the second pooling layer) and the first output layer; the first input layer receives a one-dimensional sequence input, the convolution kernel size is 1×3, the activation function is ReLU, the depth of the first convolutional layer is 32, the depth of the second convolutional layer is 64, the window size and stride of the pooling layer are both 2, and the first output layer outputs a one-dimensional vector sequence of 64 channels.
[0107] LSTM module: includes the second input layer, LSTM layer and second output layer; the second input layer receives the one-dimensional vector sequence output by the CNN module, the hidden state dimension of the LSTM layer is 64, the LSTM unit contains the input gate, candidate unit state, recurrent unit, forget gate and output gate, the activation functions are sigmoid and tanh respectively, and the second output layer outputs the hidden state vector of the last time step.
[0108] DNN module: includes the third input layer, the first hidden layer, the second hidden layer and the third output layer; the third input layer concatenates the one-dimensional vector sequence output by the CNN module and the hidden state vector output by the LSTM module. The number of input nodes is 128, the number of nodes in the first hidden layer and the second hidden layer are both 256, the activation function is ReLU, dropout is added to the second hidden layer, and the dropout rate is 0.5. The number of nodes in the third output layer is 6, and the activation function is Softmax.
[0109] Parameter validation model training
[0110] The training method is as follows: select N groups of parameter samples and their corresponding annotations from the background log; initialize the parameters to verify the model weights; calculate the loss function loos, and use the Adam optimizer to update the network weights until the loss function converges.
[0111] The loss function formula is as follows:
[0112]
[0113] Among them, y i is the true probability of the annotation corresponding to the parameter sample of group i; p i is the predicted probability of the annotation corresponding to the parameter sample of group i; ∈ is the preset value; N is the number of sample groups; i≤N;
[0114] Circuit breaker threshold model
[0115] The construction method is as follows: the annotations of parameter samples and service call parameters are converted into the first feature vector, the elements of which include normal, type mismatch, injection attack, value out of bounds, deformed data, missing required fields, error rate and response time; the goal is to minimize the sum of the first prediction accuracy of all predicted security thresholds.
[0116] The first prediction accuracy formula is as follows:
[0117] Kd=(Zd-Qd) 2 ;
[0118] Among them, Zd is the predicted safety threshold corresponding to the annotation of the d-th group of parameter samples and the service call parameters; Qd is the actual safety threshold; d is the group number of the first eigenvector.
[0119] Service tier model
[0120] The construction method is as follows: the parameter samples of the API request are converted into a second feature vector, the elements of which include parameter type, parameter name, parameter value range, parameter format and parameter mandatory; the goal is to minimize the sum of the second prediction accuracies of all predicted service ratings.
[0121] The second prediction accuracy formula is as follows:
[0122] Tr=(Sr-Vr) 2 ;
[0123] Where Sr is the predicted service rating corresponding to the parameter sample of the rth group of API requests; Vr is the actual service rating; and r is the group number of the second eigenvector.
[0124] The method for constructing the circuit breaker activation model is as follows: collect the activation codes corresponding to the service ratings and safety thresholds of group C in advance and convert them into a set of feature vectors; the goal is to minimize the sum of the prediction errors of all service ratings and safety thresholds.
[0125] The prediction error formula is as follows:
[0126] dfrh=(drh-dxh) 2 ;
[0127] Where drh is the predicted value of the startup code corresponding to the hth group of service ratings and security thresholds; dxh is the actual startup code; and h is the group number of the feature vector corresponding to the service ratings and security thresholds.
[0128] The circuit breaker activation model is trained until the sum of the prediction errors converges.
[0129] The beneficial effects of this embodiment are: through feature relative analysis and error correction, combined with historical test data, the accuracy of API interface verification is improved, and the probability of false alarms and missed alarms is reduced; through parameter verification model, circuit breaker threshold model, service classification model and circuit breaker startup model, a multi-level security protection mechanism is implemented, which effectively prevents malicious attacks and abnormal requests, and enhances the security and stability of the system; through a comprehensive API interface description file verification process, combined with advanced parameter verification models and multi-level security protection mechanisms, the efficiency and reliability of automated testing are achieved, the need for manual intervention is reduced, and testing efficiency is improved; through dynamic training and optimization, the model can adapt to different API interfaces and application scenarios, has strong generalization ability and adaptability, and is suitable for API interface verification in various complex environments.
[0130] The weights of this invention are used to measure the degree to which different factors or variables influence a particular outcome or decision. Weights are defined as numerical values assigned to each factor when comparing and evaluating multiple factors, reflecting its importance or priority. These weights can be determined based on specific circumstances and needs, and are typically developed and confirmed by professionals or stakeholders. By properly setting weights, programs or systems can be made to make more accurate decisions or predictions.
[0131] The above description is only a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with the technical field, within the technical scope disclosed by the present invention, who makes equivalent replacements or changes based on the technical solution and inventive concept of the present invention, should be covered by the scope of protection of the present invention.
[0132] The preferred embodiments of the present invention disclosed above are intended only to help illustrate the present invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the present invention to specific embodiments. Obviously, many modifications and variations are possible based on the contents of this specification. These embodiments are selected and described in detail in this specification to better explain the principles and practical applications of the present invention, thereby enabling those skilled in the art to better understand and utilize the present invention. The present invention is limited only by the claims and their full scope and equivalents.
Claims
1. An API interface description file verification method for AI automated testing, characterized in that: The method steps are as follows: Step 1: Read the API interface description file to obtain the description information of all API interfaces; Step 2: Traverse each API interface in the API interface description file and extract its feature information. Including path, method, request parameters, response parameters, and storing the extracted feature information in a structured data structure; Step 3: Calculate the mean of each API interface feature information, calculate the deviation of each API interface feature information from the mean, and obtain relative error information of multiple API interfaces; Step 4: Obtain historical test data of the API interface, including historical time relative error information and historical parameter relative error information; use historical data to verify in the relative error correction table to obtain multiple time correction coefficients and multiple parameter correction coefficients; use the correction coefficient to perform correction calculation on the API interface relative error information to obtain multiple corrected API interface relative error information; Step 5: Obtain preset API interface error information, including preset time relative error information and preset parameter relative error information; According to the relative error information of multiple correction API interfaces, a correction relative error matrix is constructed; According to the corrected relative error matrix, the preset time relative error information and the preset parameter relative error information, a matrix evaluation calculation is performed to obtain multiple single-channel API interface detection results; Step 6: Use sample data and signal quality basic analyzer to perform integrated analysis on the single-channel API test results to obtain the signal quality level; Step 7: Parameter verification and service fuse: Collect parameter samples and service call parameters, and input them into the parameter verification model for annotation; Decide whether to allow the API request to pass based on the annotation results; input the annotation and service call parameters into the fuse threshold model and output the safety threshold; Input parameter samples to the service grading model and output service ratings; The service rating and safety threshold are input into the circuit breaker activation model, and the activation code is output.
2. The API interface description file verification method for AI automated testing according to claim 1 is characterized in that: The parameter sample includes parameter type, parameter name, parameter value range, parameter format and parameter mandatory; the annotations of parameter samples include normal, type mismatch, injection attack, value out of bounds, deformed data and missing mandatory fields; service call parameters include error rate and response time.
3. The API interface description file verification method for AI automated testing according to claim 1, characterized in that: The structure of the parameter verification model is a hybrid of CNN+LSTM+DNN, including: CNN module: includes the first input layer, two convolutional layers, two pooling layers and the first output layer; the first input layer receives a one-dimensional sequence input, the convolution kernel size is 1×3, the activation function is ReLU, the first convolutional layer depth is 32, the second convolutional layer depth is 64, the pooling layer window size and step size are both 2, and the first output layer outputs a 64-channel one-dimensional vector sequence; LSTM module: includes the second input layer, LSTM layer and the second output layer; the second input layer receives the one-dimensional vector sequence output by the CNN module, the hidden state dimension of the LSTM layer is 64, the LSTM unit contains the input gate, candidate unit state, recurrent unit, forget gate and output gate, the activation functions are sigmoid and tanh respectively, and the second output layer outputs the hidden state vector of the last time sequence step; DNN module: includes the third input layer, the first hidden layer, the second hidden layer and the third output layer; the third input layer concatenates the one-dimensional vector sequence output by the CNN module with the hidden state vector output by the LSTM module. The number of input nodes is 128, the number of nodes in the first hidden layer and the second hidden layer are both 256, the activation function is ReLU, dropout is added to the second hidden layer, and the dropout rate is 0.
5. The number of nodes in the third output layer is 6, and the activation function is Softmax.
4. The API interface description file verification method for AI automated testing according to claim 1, characterized in that: The training method of the parameter verification model includes: Select N groups of parameter samples and the annotations corresponding to the parameter samples from the background log to form a training set; Initialize the weights of the parameter validation model; Forward propagation calculates the loss function loos, backward propagation calculates the gradient, and the optimizer Adam is set to update the network weights. Repeat the training until the loss function converges, and the parameter verification model training is completed; Among them, the calculation formula of the loss function loos is as follows: y i is the true probability of the annotation corresponding to the parameter sample of the i-th group; p i is the predicted probability of the annotation corresponding to the i-th group of parameter samples; ∈ is the preset value; N is the number of sample groups; i≤N.
5. The API interface description file verification method for AI automated testing according to claim 1, characterized in that: The method for constructing the fuse threshold model includes: Convert the annotations of each set of parameter samples and the service call parameters into the form of a first feature vector, where the elements of the first feature vector include normal, type mismatch, injection attack, value out of bounds, deformed data, missing required fields, error rate, and response time; The set of all first feature vectors is used as the input of a fuse threshold model, wherein the fuse threshold model uses the safety threshold predicted for each group of first feature vectors as the output, uses the actual safety threshold corresponding to each group of first feature vectors as the prediction target, and uses minimizing the sum of the first prediction accuracies of all predicted safety thresholds as the training target; The calculation formula of the first prediction accuracy is as follows: Kd = (Zd-Qd) 2 ; Zd is the predicted safety threshold corresponding to the annotation of the dth group of parameter samples and the service call parameters; Qd is the actual safety threshold; d is the group number of the first feature vector. The fuse threshold model is trained until the sum of the first prediction accuracy reaches convergence and the training is stopped.
6. The API interface description file verification method for AI automated testing according to claim 1, characterized in that: The service ratings include 11, 12, and 13; the activation code is 0 or 1, 0 means not activating the fuse mechanism, and 1 means activating the fuse mechanism; 13 is core service, 12 is general service, and 11 is non-core service.
7. The API interface description file verification method for AI automated testing according to claim 1, characterized in that: The method for constructing the service classification model includes: Convert each set of API request parameter samples into the form of a second feature vector, where the elements of the second feature vector include parameter type, parameter name, parameter value range, parameter format, and parameter mandatory; The set of all second feature vectors is used as the input of the service grading model, the service grading model takes the service rating predicted for each group of second feature vectors as the output, takes the actual service rating corresponding to each group of second feature vectors as the prediction target, and takes minimizing the sum of the second prediction accuracies of all predicted service ratings as the training target; The calculation formula of the second prediction accuracy is as follows: Tr = (Sr-Vr) 2 ; Sr is the predicted service rating corresponding to the parameter sample of the rth group of API requests; Vr is the actual service rating; r is the group number of the second feature vector. The service classification model is trained until the sum of the second prediction accuracies reaches convergence and the training is stopped.
8. The API interface description file verification method for AI automated testing according to claim 1, characterized in that: The method for constructing the fuse initiation model includes: Collect c groups of service ratings and start codes corresponding to security thresholds in advance, and convert the service ratings, security thresholds and corresponding start codes into a corresponding set of feature vectors; Each set of feature vectors is used as the input of the fuse activation model. The fuse activation model takes a set of activation codes corresponding to each set of service ratings and safety thresholds as output, and takes the actual activation codes corresponding to each set of service ratings and safety thresholds as prediction targets. The actual activation codes are the activation codes corresponding to the service ratings and safety thresholds collected in advance. Minimizing the sum of the prediction errors of all service ratings and safety thresholds is used as the training target. The calculation formula of the prediction error is as follows: dfrh = (drh-dxh) 2 ; drh is the predicted value of the startup code corresponding to the hth group of service ratings and safety thresholds; dxh is the actual startup code; h is the group number of the feature vector corresponding to the service rating and safety threshold. The fuse startup model is trained until the sum of the prediction errors reaches convergence and the training is stopped.