Intelligent test method for automatically testing API (Application Program Interface)
Through the intelligent testing method of automated testing API interface, the problem of low testing efficiency of existing API interfaces is solved, intelligent protocol matching and automation processes are realized, testing efficiency and accuracy are significantly improved, and system stability and user experience are improved.
Patent Information
- Application Number
- CN202411365120.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2024-12-27
AI Technical Summary
The existing API interface testing technology is inefficient, testers need to have an in-depth understanding of the protocol, and the writing of test cases is cumbersome, especially when third-party interfaces are connected, resulting in duplicate labor and low coverage.
Using the intelligent testing method of automated testing API interface, through information input and location identification, resolution system, detection system, service system, packaging system, monitoring and optimization, intelligent protocol matching and automation process are achieved, human intervention is reduced, and testing efficiency and accuracy are improved. .
It significantly improves data transmission efficiency and accuracy, reduces latency and errors, improves system stability and reliability, simplifies the testing process, and improves user experience and system performance.
Smart Images

Figure CN119201739A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of software testing and automated testing, and specifically relates to an automated testing API interface intelligent testing method. Background Art
[0002] In single-protocol API testing, although we are able to plan the test strategy in detail, including comprehensive coverage from input condition verification to resource modification, the existing testing technology still shows obvious shortcomings in practice. Testers need to have an in-depth understanding of the API interface protocol, which undoubtedly increases the learning cost; at the same time, the writing of each test case and assertion needs to be done independently, which is cumbersome and time-consuming. Defining test scenarios and suites by protocol further exacerbates this problem, especially when connecting with third-party interfaces, inefficiency becomes a major pain point. Therefore, exploring more efficient and automated testing solutions to reduce duplication of work and improve test coverage and accuracy is an issue that needs to be addressed urgently. Summary of the invention
[0003] The purpose of the present invention is to provide an automated testing API interface intelligent testing method to solve the problems raised in the above background technology.
[0004] In order to achieve the above object, the present invention provides the following technical solution: an automated API interface intelligent testing method, the specific steps of which are as follows:
[0005] S1: Information input and location identification: The user inputs a request, the system parses the URL location service interface, and extracts the service identification information;
[0006] S2: Parsing system - decomposes data and analyzes data characteristics: parses request parameters and extracts characteristic data, including type, format, size, request header and file, to prepare for protocol matching;
[0007] S3: Detection system - calculate feature data weight and match protocol: calculate feature weight, intelligently match protocol, combine weight and round-robin inspection, and select the best protocol to process the request;
[0008] S4: Service system - execute request and get response: match the protocol access interface, send request and receive server status code, header and body data;
[0009] S5: Encapsulation system - sorting returned data: processing response body, parsing format, encapsulating data, and ensuring client usability;
[0010] S6: Return to user: encapsulate data and send it, record log information, and assist in performance analysis and troubleshooting;
[0011] S7: Monitoring and optimization: Monitor performance, optimize protocol matching, and improve system efficiency and user experience.
[0012] Preferably, the specific steps of information input and location identification in S1 are as follows:
[0013] Step 1: Submit a request: The user submits a request including the request URL, request method, and request parameters through the interface or API interface;
[0014] Step 2: Parse the URL and extract information: After receiving the request, the system parses the requested URL to identify the specific service interface location and extracts relevant service identification information in the process.
[0015] Preferably, the specific steps of the parsing system in S2 - decomposing data and parsing data characteristics are as follows:
[0016] Step 1: Parsing request parameters: First, the system parses each parameter in the request one by one, identifies its data type and format, and checks whether the parameter size meets the preset limit (such as the upper limit of file size);
[0017] Step 2: Parse the request header: Then, the system parses the request header information, such as Content-Type to understand the media type of the request body, and Authorization to verify the identity and authority of the requester;
[0018] Step 3: Process the requested files: If the request contains files, the system will perform necessary processing on these files, such as verifying the file type, size, and security;
[0019] Step 4: Extract characteristic data: Finally, based on the parsed parameters and request header information, the system extracts key characteristic data, evaluates the complexity of the data structure, and whether specific encryption processing is required, in preparation for subsequent protocol matching and data processing.
[0020] Preferably, the specific steps of the detection system in S3 - calculating the characteristic data weight and matching the protocol are as follows:
[0021] Step 1: Calculation of characteristic data weight: First, quantitatively evaluate each parameter characteristic analyzed and assign corresponding weight values according to their importance;
[0022] Step 2: Build a weight evaluation system: Establish a weight evaluation system, compare the calculated feature weights with the protocol features, and calculate the matching score between each protocol and the current request;
[0023] Step 3: Intelligent protocol matching: Using weight information and the first round of inspection, the protocol set intelligently selects the protocol with the highest matching degree to process the current request.
[0024] Preferably, the service system in S4 - executing the request and obtaining the response means that based on the matched best protocol mode, the system initiates a request to the server through the corresponding application layer interface and transport layer interface, and then the system monitors and receives response data from the server, which data contains in detail the status code to indicate the request processing result, the response header provides additional metadata information, and the response body contains the actual data content.
[0025] Preferably, the encapsulation system in S5 - collating the returned data means that after receiving the response from the server, the system first processes the response body content in detail, performs corresponding parsing operations according to the actual format of the response body, and after completing the content collation, the system further encapsulates the collated data according to the pre-agreed format. During the encapsulation process, a custom response header is added to convey additional information and adjust the data structure to better adapt to the client's processing logic.
[0026] Preferably, returning to the user in S6 means that after the system completes data encapsulation, the processing result is immediately returned to the user through HTTP, RPC and TCP efficient protocols. At the same time, in order to optimize system performance and improve maintenance efficiency, the system records in detail the key information of the entire request processing process, such as the request initiation time, server processing time and the final response status.
[0027] Preferably, the specific steps of monitoring and optimizing in S7 are:
[0028] Step 1: Performance monitoring: Implement a comprehensive performance monitoring system to collect and analyze system response time and processing efficiency data in real time, and promptly identify potential performance bottlenecks or abnormal behaviors by setting thresholds and alarm mechanisms;
[0029] Step 2: Problem analysis and bottleneck location: After discovering the performance problem, conduct in-depth problem analysis and use logs, stack traces, and performance analysis tools to accurately locate the specific link or component that causes the performance bottleneck.
[0030] Step 3: Protocol and service optimization: Based on the performance monitoring results and problem analysis conclusions, perform targeted optimization on the protocol matching algorithm and service calling method, including improving algorithm logic, optimizing data transmission format, adjusting service deployment architecture, or introducing new efficient technology stacks.
[0031] The beneficial effects of the present invention are as follows:
[0032] The present invention brings significant benefits by adopting an automated process of executing requests and obtaining responses by the service system, combined with intelligent characteristic data weight calculation and protocol matching methods. By accurately quantifying the importance of each parameter characteristic and assigning weights, a scientific basis is provided for selecting the best protocol, and a weight evaluation system is constructed to ensure that the matching degree of different protocols and requests is accurately evaluated, which helps to improve the efficiency and accuracy of data transmission. The intelligent protocol matching mechanism, combined with the first round inspection and optimization strategy, can quickly locate and apply the protocol method that best suits the current request, effectively reduce delays and errors, and improve user experience. This process has a high degree of automation, reduces human intervention, and improves the stability and reliability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is the overall flow chart of the intelligent testing method of the present invention;
[0034] Figure 2 The flowchart of the API interface intelligent testing solution of the present invention is organized;
[0035] Figure 3 This is a relationship diagram between the Web API protocols of the present invention. DETAILED DESCRIPTION
[0036] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. 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 creative work are within the scope of protection of the present invention.
[0037] like Figures 1 to 3 As shown, the embodiment of the present invention provides an automated testing API interface intelligent testing method, and the specific steps of the testing method are as follows:
[0038] S1: Information input and location identification: The user inputs a request, the system parses the URL location service interface, and extracts the service identification information;
[0039] S2: Parsing system - decomposes data and analyzes data characteristics: parses request parameters and extracts characteristic data, including type, format, size, request header and file, to prepare for protocol matching;
[0040] S3: Detection system - calculate feature data weight and match protocol: calculate feature weight, intelligently match protocol, combine weight and round-robin inspection, and select the best protocol to process the request;
[0041] S4: Service system - execute request and get response: match the protocol access interface, send request and receive server status code, header and body data;
[0042] S5: Encapsulation system - sorting returned data: processing response body, parsing format, encapsulating data, and ensuring client usability;
[0043] S6: Return to user: encapsulate data and send it, record log information, and assist in performance analysis and troubleshooting;
[0044] S7: Monitoring and optimization: Monitor performance, optimize protocol matching, and improve system efficiency and user experience.
[0045] The specific steps of information input and location identification in S1 are as follows:
[0046] Step 1: Submit a request: The user submits a request including the request URL, request method (such as GET, POST) and request parameters through the interface or API interface.
[0047] Step 2: Parse the URL and extract information: After receiving the request, the system parses the requested URL to identify the specific service interface location (i.e., API path), and extracts relevant service identification information in the process.
[0048] Users submit requests through an intuitive interface or API interface, and the system responds quickly, accurately parsing the URL to locate the service interface and extract key information. This process simplifies user operations and improves the efficiency and accuracy of request processing. Through automatic parsing and information extraction, the system can understand user needs more quickly, laying a solid foundation for subsequent service calls and data processing, thereby improving the overall user experience and system response speed.
[0049] The specific steps of the parsing system in S2 - decomposing data and analyzing data characteristics are as follows:
[0050] Step 1: Parse request parameters: First, the system parses each parameter in the request one by one, clarifies its data type (String, Int) and format (such as JSON, XML), and checks whether the parameter size meets the preset limit (such as the upper limit of file size);
[0051] Step 2: Parse the request header: Then, the system parses the request header information, such as Content-Type to understand the media type of the request body, and Authorization to verify the identity and authority of the requester;
[0052] Step 3: Process the requested file: If the request contains files (such as pictures, documents, etc.), the system will perform necessary processing on these files, such as verifying the file type, size and security.
[0053] Step 4: Extract characteristic data: Finally, based on the parsed parameters and request header information, the system extracts key characteristic data, evaluates the complexity of the data structure (such as the number of nested layers), and whether specific encryption processing (such as HTTPS, TLS encryption) is required, and prepares for subsequent protocol matching and data processing.
[0054] The parsing system decomposes and analyzes data characteristics through detailed steps to ensure the accuracy and security of data processing. From parameter type and format to request header information, to file processing and feature data extraction, each step is strictly controlled to optimize the data processing process. This process not only improves the efficiency and accuracy of data processing, but also lays a solid foundation for subsequent protocol matching and data processing, and enhances the overall performance of the system and user experience.
[0055] Among them, the specific steps of the detection system in S3 - calculating the characteristic data weight and matching the protocol are as follows:
[0056] Step 1: Calculate the weight of characteristic data: First, quantify and evaluate each parameter characteristic analyzed, and assign corresponding weight values according to their importance; these weights will be used to subsequently evaluate the matching degree between different protocols and the current request.
[0057] Step 2: Build a weight evaluation system: Establish a weight evaluation system, compare the calculated feature weights with the protocol features, and calculate the matching score between each protocol and the current request;
[0058] Step 3: Intelligent protocol matching: Using weight information and the first round of inspection method (such as interface identifier hash search, recently used cache and other optimization strategies), intelligently select the protocol method with the highest matching degree in the available protocol set to process the current request.
[0059] The detection system significantly improves service efficiency and accuracy by accurately calculating the weight of characteristic data and intelligently matching protocols. The weight evaluation system ensures that each parameter characteristic is properly considered and optimizes the accuracy of protocol matching. Intelligent matching combined with the first round inspection strategy quickly locates the best protocol and reduces processing delays. This not only enhances the flexibility and adaptability of the system, but also optimizes resource utilization, bringing users a smoother and more efficient service experience.
[0060] Among them, the service system in S4 - executing the request and obtaining the response means that based on the matched best protocol method, the system initiates a request to the server through the corresponding application layer interface (such as RESTful API) and transport layer interface (such as TCP connection or WebSocket session), and then the system monitors and receives response data from the server. These data include in detail the status code to indicate the request processing result, the response header provides additional metadata information, and the response body contains the actual data content for subsequent processing.
[0061] Service system - executes requests and obtains responses, accurately initiates requests through the best protocol, and ensures efficient data transmission. Receives detailed response data, including status code, response header and body, and provides comprehensive information support. This process optimizes request processing efficiency, enhances inter-system communication capabilities, lays a solid foundation for subsequent data processing, and improves overall service quality and user experience.
[0062] Among them, the encapsulation system in S5 - collating the returned data means that after receiving the response from the server, the system first processes the content of the response body in detail, and performs corresponding parsing operations according to the actual format of the response body (such as JSON or XML) to ensure the accuracy and availability of the data. After completing the content collation, the system further encapsulates the collated data in a pre-agreed format. During the encapsulation process, a custom response header is added to pass additional information, or the data structure is adjusted to better adapt to the client's processing logic. This series of operations is designed to optimize the presentation of data and improve the client's ease of use and data processing efficiency.
[0063] Encapsulation system - organizes the returned data to ensure that the data is accurate and available, and optimizes the content accuracy by parsing the response body format (such as JSON / XML). When encapsulating, add custom response headers and adjust the structure to enhance data adaptability and facilitate client processing. This process not only improves data processing efficiency, but also promotes seamless docking between systems, enhancing user experience and system flexibility.
[0064] Among them, the return to the user in S6 means that after the system completes data encapsulation, the processing results are immediately returned to the user through HTTP, RPC and TCP efficient protocols to ensure timely data transmission and availability. At the same time, to optimize system performance and improve maintenance efficiency, the system records in detail the key information of the entire request processing process, such as the request initiation time, server processing time and the final response status. These log information provides valuable data support for subsequent performance analysis, and also greatly simplifies the complexity of troubleshooting, ensuring the stable operation of the system.
[0065] After data encapsulation, the system returns the processing results instantly through an efficient protocol to ensure data timeliness and availability. Detailed logs record the entire request process to provide data support for performance optimization, simplify troubleshooting, and enhance system stability. These measures not only improve user experience, but also optimize system performance and maintenance efficiency, providing a solid guarantee for the stable operation of the system.
[0066] The specific steps of monitoring and optimization in S7 are as follows:
[0067] Step 1: Performance monitoring: Implement a comprehensive performance monitoring system to collect and analyze system response time and processing efficiency data in real time, and promptly identify potential performance bottlenecks or abnormal behaviors by setting thresholds and alarm mechanisms;
[0068] Step 2: Problem analysis and bottleneck location: After discovering the performance problem, conduct in-depth problem analysis and use logs, stack traces, and performance analysis tools to accurately locate the specific link or component that causes the performance bottleneck.
[0069] Step 3: Protocol and service optimization: Based on the performance monitoring results and problem analysis conclusions, optimize the protocol matching algorithm and service calling method. This may include improving algorithm logic, optimizing data transmission format, adjusting service deployment architecture, or introducing new efficient technology stacks to improve overall performance and user experience.
[0070] Implementing the three steps of performance monitoring, problem analysis and bottleneck location, and protocol and service optimization can significantly improve system response speed and processing efficiency. Through real-time monitoring and early warning, performance bottlenecks can be quickly located and resolved, and protocol matching and service calls can be optimized. This not only enhances system stability and reliability, but also promotes technology iteration and innovation, bringing users a smoother and more efficient user experience.
[0071] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.
[0072] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. Automated testing API interface intelligent testing method, characterized by: The specific steps of the test method are as follows: S1: Information input and location identification: The user inputs a request, the system parses the URL location service interface, and extracts the service identification information; S2: Parsing system - decomposes data and analyzes data characteristics: parses request parameters and extracts characteristic data, including type, format, size, request header and file, to prepare for protocol matching; S3: Detection system - calculate feature data weight and match protocol: calculate feature weight, intelligently match protocol, combine weight and round-robin inspection, and select the best protocol to process the request; S4: Service system - execute request and get response: match the protocol access interface, send request and receive server status code, header and body data; S5: Encapsulation system - sorting returned data: processing response body, parsing format, encapsulating data, and ensuring client usability; S6: Return to user: encapsulate data and send it, record log information, and assist in performance analysis and troubleshooting; S7: Monitoring and optimization: Monitor performance, optimize protocol matching, and improve system efficiency and user experience.
2. The automated testing API interface intelligent testing method according to claim 1 is characterized by: The specific steps of information input and location identification in S1 are as follows: Step 1: Submit a request: The user submits a request including the request URL, request method, and request parameters through the interface or API interface; Step 2: Parse the URL and extract information: After receiving the request, the system parses the requested URL to identify the specific service interface location and extracts relevant service identification information in the process.
3. The method for intelligent testing of the automated testing API interface according to claim 1, characterized in that: The specific steps of the parsing system in S2 - decomposing data and analyzing data characteristics are as follows: Step 1: Parsing request parameters: First, the system parses each parameter in the request one by one, identifies its data type and format, and checks whether the parameter size meets the preset limit; Step 2: Parse the request header: Then, the system parses the request header information, such as Content-Type to understand the media type of the request body, and Authorization to verify the identity and authority of the requester; Step 3: Process the requested files: If the request contains files, the system will perform necessary processing on these files, such as verifying the file type, size, and security; Step 4: Extract characteristic data: Finally, based on the parsed parameters and request header information, the system extracts key characteristic data, evaluates the complexity of the data structure, and whether specific encryption processing is required, in preparation for subsequent protocol matching and data processing.
4. The method for intelligent testing of the automated testing API interface according to claim 1, characterized in that: The specific steps of the detection system in S3 - calculating the characteristic data weight and matching the protocol are as follows: Step 1: Calculation of characteristic data weight: First, quantitatively evaluate each parameter characteristic analyzed and assign corresponding weight values according to their importance; Step 2: Build a weight evaluation system: Establish a weight evaluation system, compare the calculated feature weights with the protocol features, and calculate the matching score between each protocol and the current request; Step 3: Intelligent protocol matching: Using weight information and the first round of inspection, the protocol set intelligently selects the protocol with the highest matching degree to process the current request.
5. The method for intelligent testing of the automated testing API interface according to claim 1, characterized in that: The service system in S4 - executing the request and obtaining the response means that based on the matched best protocol mode, the system initiates a request to the server through the corresponding application layer interface and transport layer interface. Subsequently, the system monitors and receives the response data from the server. These data include in detail the status code to indicate the request processing result, the response header provides additional metadata information, and the response body contains the actual data content.
6. The method for intelligent testing of the automated testing API interface according to claim 1, characterized in that: The encapsulation system in S5 - arranging the returned data means that after receiving the response from the server, the system first processes the content of the response body in detail, performs corresponding parsing operations according to the actual format of the response body, and after completing the content arrangement, the system further encapsulates the arranged data according to the pre-agreed format. During the encapsulation process, a custom response header is added to convey additional information and adjust the data structure to better adapt to the client's processing logic.
7. The method for intelligent testing of an automated testing API interface according to claim 1, characterized in that: Returning to the user in S6 means that after the system completes data encapsulation, the processing result is immediately returned to the user through HTTP, RPC and TCP efficient protocols. At the same time, in order to optimize system performance and improve maintenance efficiency, the system records in detail the key information of the entire request processing process, such as the request initiation time, server processing time and the final response status.
8. The method for intelligent testing of an automated testing API interface according to claim 1, characterized in that: The specific steps of monitoring and optimization in S7 are as follows: Step 1: Performance monitoring: Implement a comprehensive performance monitoring system to collect and analyze system response time and processing efficiency data in real time, and promptly identify potential performance bottlenecks or abnormal behaviors by setting thresholds and alarm mechanisms; Step 2: Problem analysis and bottleneck location: After discovering the performance problem, conduct in-depth problem analysis and use logs, stack traces, and performance analysis tools to accurately locate the specific link or component that causes the performance bottleneck. Step 3: Protocol and service optimization: Based on the performance monitoring results and problem analysis conclusions, perform targeted optimization on the protocol matching algorithm and service calling method, including improving algorithm logic, optimizing data transmission format, adjusting service deployment architecture, or introducing new efficient technology stacks.