AI-based full-process coverage test automation method and system
By deconstructing the code project and generating test cases with AI assistance, and then executing them with testing tools, the problem of time-consuming and labor-intensive traditional manual operations is solved, achieving efficient and comprehensive coverage testing automation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 上海北汇信息科技有限公司
- Filing Date
- 2026-04-20
- Publication Date
- 2026-05-19
AI Technical Summary
Traditional software coverage testing relies on manual operation, making it difficult to achieve efficient coverage throughout the entire process. AI-assisted testing solutions have failed to build a closed-loop iterative system, resulting in low levels of testing automation and minimal improvement in coverage.
By deconstructing the code project under test to extract function body code, branch structure and function call relationship, natural language question statements are generated, test case data is obtained using AI interface, and test tools are used to execute and iteratively optimize until the coverage threshold is reached.
It achieves fully automated testing, shortens testing time, improves the efficiency and completeness of coverage testing, and ensures the generation of high-quality test reports.
Smart Images

Figure CN122064599A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of software testing technology, and in particular to an AI-based method and system for automating the entire process of coverage testing. Background Technology
[0002] Traditional software coverage testing relies excessively on manual code logic analysis and test case creation. It is difficult to conduct in-depth static analysis of the code project, and it is impossible to fully extract core test information such as function bodies, branch structures, and function call dependencies. Test case generation lacks systematicity and comprehensiveness, and there are many omissions in branch coverage. Manual operation is time-consuming and labor-intensive, making it difficult to achieve the testing goal of efficient coverage throughout the entire process.
[0003] Existing AI-assisted testing solutions can only generate test cases for a single test. They lack a closed-loop iterative system for test execution, result analysis, and test case completion. They cannot accurately locate uncovered branches based on test reports and generate supplementary test cases accordingly. The automation level of the entire testing process is extremely low, the coverage improvement effect is minimal, and the overall testing efficiency and completeness are far from meeting the standards of actual engineering applications. Therefore, how to improve the efficiency of AI-based full-process coverage testing automation has become an urgent problem to be solved. Summary of the Invention
[0004] This invention provides an AI-based method and system for automating the entire process of coverage testing, in order to solve the problems mentioned in the background art.
[0005] To achieve the above objectives, this invention provides an AI-based method for automating the entire process of coverage testing, comprising: A1. Based on the test configuration information, the obtained code project to be tested is deconstructed and extracted, and the extracted function body code, branch structure information and function call relationship are associated and stored to obtain the function structure dataset of the code project to be tested; A2. Combine the function structure dataset with the test case format template in the test configuration information to form a natural language question statement for the code project under test, and send the natural language question statement to the preset AI interface; A3. Based on the test case format template, perform adaptive extraction on the original test case data returned by the AI interface to obtain the test case set of the code project to be tested; A4. Based on the test tool call interface information in the test configuration information, import the test case set into the test tool for execution to generate the initial test report of the code project under test; A5. Identify the uncovered branch code segments in the initial test report, and combine the function body code and branch structure information corresponding to the uncovered branch code segments in the function structure dataset to generate targeted question statements for the code project under test, and send them to the AI interface to obtain supplementary test case data; A6. According to the test case format template, import the supplementary test cases parsed from the supplementary test case data into the test tool to generate an updated test report for the code project under test. Then, use the updated test report as a new initial test report and repeat A5 to A6 until the threshold for the number of iterations in the test configuration information is reached.
[0006] In a preferred embodiment, the step of deconstructing and extracting the obtained code project under test according to the test configuration information, and associating and storing the extracted function body code, branch structure information and function call relationships to obtain a function structure dataset of the code project under test, including: Based on the code parsing rules in the test configuration information, static source code analysis is performed on the code project under test to obtain the abstract syntax tree of the code project under test, and the function nodes in the abstract syntax tree are identified and the function body code is extracted from the function nodes. The logical control statements in the function body code are decomposed into their syntactic structure to obtain the branch structure information of the function body code; Scan the function body code reference declarations in the code project under test, parse out the call dependencies between function body code, and construct the function call relationship graph of the code project under test; Using function body code as the basic storage unit and attribute labels as the basic storage unit for branch structure information and function call relationship graph, a function structure dataset of the code project under test is constructed.
[0007] In a preferred embodiment, the step of constructing the function structure dataset of the code project under test, using function body code as the basic storage unit and attribute labels as the basic storage units for branch structure information and function call relationship graphs, includes: Assign a unique storage identifier to the function body code, and store the function body code as the basic storage unit in the memory buffer; The branch structure information is extracted in a structured manner to obtain the branch attribute records of the code project under test, and the branch attribute records are associated and mounted as the first attribute tag of the basic storage unit. Extract the outgoing edge set starting from the function corresponding to the function body code and the incoming edge set ending at the function from the function call relationship graph, and combine the outgoing edge set and the incoming edge set into function call relationship description data; The call relationship description data is associated and mounted as the second attribute label of the basic storage unit; All basic storage units with the first and second attribute labels are aggregated and stored to obtain the function structure dataset of the code project under test.
[0008] In a preferred embodiment, the step of combining the function structure dataset with the test case format template in the test configuration information into a natural language question statement for the code project under test, and sending the natural language question statement to a preset AI interface, includes: Data features are extracted from the function body code, branch structure information and function call relationships in the function structure dataset to obtain the key test elements of the code project under test. Based on the test case format template in the test configuration information, semantic mapping is performed on key test elements to obtain the initial questioning framework of the code project under test; Based on a pre-defined natural language generation engine, the initial question framework is enhanced with context and the test objectives and constraints of the code project under test are incorporated to obtain the natural language question statements of the code project under test. By standardizing and encapsulating the natural language question statements using the communication protocol specified in the test configuration information, the encapsulated question statements are sent to the preset AI interface.
[0009] In a preferred embodiment, the step of adapting and extracting the original test case data returned by the AI interface according to the test case format template to obtain the test case set of the code project to be tested includes: The raw test case data returned by the AI interface is parsed in a multi-level structure to obtain the test input data, expected result data and execution condition data of the raw test case data; Based on the field definition of the test case format template, the test input data, expected result data, and execution condition data are filled into the corresponding template fields to obtain the test case data of the code project under test. The test case data is validated for compliance, and based on the branch coverage requirements in the function structure dataset, the validated test case data is filtered for coverage-oriented selection to obtain the test case set of the code project to be tested.
[0010] In a preferred embodiment, the step of importing the test case set into the test tool for execution based on the test tool call interface information in the test configuration information to generate an initial test report for the code project under test includes: Based on the test tool call interface information in the test configuration information, generate the execution environment configuration parameters of the test tool, and start the running instance of the test tool based on the execution environment configuration parameters; Based on the loading protocol of the testing tool, the test case set is formatted and converted to obtain the test task data package of the test case set, and then the test task data package is injected into the running instance; Trigger a running instance to simulate the execution of the code project under test in order to capture the raw execution log data output by the running instance; The raw execution log data is serialized and encapsulated to obtain the initial test report of the code project under test.
[0011] In a preferred embodiment, the process of identifying uncovered branch code segments in the initial test report, and combining this with the function body code and branch structure information corresponding to the uncovered branch code segments in the function structure dataset, generates targeted question statements for the code project under test, and sends them to the AI interface to obtain supplementary test case data, including: Perform anomaly detection on the initial test report to obtain the uncovered branch code segments in the initial test report; Locate the function ownership and logical location of the uncovered branch code segment in the code project under test; Based on the function's affiliation and logical location, extract the function body code corresponding to the uncovered branch code segment and the corresponding upstream and downstream branch structure information from the function structure dataset to construct the uncovered branch context data of the code project under test. The uncovered branch context data is parameterized and populated with the preset targeted question template to obtain the targeted question statements for the code project under test; Send targeted questions to the AI interface and receive supplementary test case data returned by the AI interface.
[0012] In a preferred embodiment, locating the function affiliation and logical position of the uncovered branch code segment in the code project under test includes: Obtain the line number range of the uncovered branch code segment in the initial test report, and match the line numbers in the source code file of the code project under test according to the line number range to obtain the source code file path to which the uncovered branch code segment belongs; Based on the source code file path, search for the function body code containing the code line number range in the function structure dataset, and assign the function name corresponding to the found function body code as the function to which the uncovered branch code segment belongs; The algorithm parses the start and end line numbers of the uncovered branch code segment within the function's domain, and determines the logical position corresponding to the branch condition where the start and end line numbers fall, based on the branch structure information in the function structure dataset that corresponds to the function's domain.
[0013] In a preferred embodiment, the step of importing the supplementary test cases parsed from the supplementary test case data into the testing tool according to the test case format template to generate an updated test report for the code project under test, and repeatedly executing A5 to A6 as a new initial test report until the iteration optimization threshold in the test configuration information is reached, includes: Based on the test case format template, the supplementary test case data is templated and compiled to obtain supplementary test cases for the supplementary test case data. Based on the test tool call interface protocol in the test configuration information, the supplementary test cases are imported into the test tool's execution queue; Trigger the testing tool to execute supplementary test cases and collect test execution logs and coverage data in real time to generate an updated test report for the code project under test; The updated test report will replace the current initial test report, and a new round of process for identifying uncovered branches and generating supplementary test cases will be initiated until the threshold for the number of iterations in the test configuration information is met.
[0014] To address the aforementioned issues, this invention also provides an AI-based automated full-process coverage testing system, the system comprising: The source code destructuring module is used to deconstruct and extract the obtained code project under test according to the test configuration information, and associate and store the extracted function body code, branch structure information and function call relationship to obtain the function structure dataset of the code project under test. The question generation module is used to combine the function structure dataset with the test case format template in the test configuration information into a natural language question statement for the code project under test, and send the natural language question statement to the preset AI interface; The test case adaptation module is used to extract the original test case data returned by the AI interface based on the test case format template to obtain the test case set of the code project under test. The test execution module is used to import the test case set into the test tool for execution based on the test tool call interface information in the test configuration information, so as to generate an initial test report for the code project under test; The targeted completion module is used to identify uncovered branch code segments in the initial test report, and combine the function body code and branch structure information corresponding to the uncovered branch code segments in the function structure dataset to generate targeted question statements for the code project under test, and send them to the AI interface to obtain supplementary test case data; The iterative update module is used to import the supplementary test cases parsed from the supplementary test case data into the test tool according to the test case format template, so as to generate an updated test report of the code project under test. The updated test report is then used as a new initial test report to repeatedly execute the targeted completion module to the iterative update module until the threshold of the number of iterations in the test configuration information is reached.
[0015] Compared with the prior art, the present invention has the following beneficial effects: 1. This invention systematically deconstructs and extracts the code under test, associating and storing function body code, branch structure information, and function call relationships to construct a complete function structure dataset, providing accurate data support for the entire testing process. Based on this dataset and test case format templates, natural language questions are automatically generated. Test case data is quickly obtained through an AI interface, and then adapted to form a standardized test case set. This set is directly integrated with testing tools for automated execution, achieving fully automated operation from source code parsing and test case generation to test execution. No tedious manual operations are required throughout, significantly reducing testing time and effectively improving the efficiency of AI-based coverage testing automation, making the testing process smoother and more standardized.
[0016] 2. This invention can accurately identify uncovered branch code segments in test reports, automatically generate targeted question statements by combining function structure datasets, quickly obtain supplementary test cases, and import them into testing tools for execution. Through iterative optimization, it continuously fills test coverage gaps, steadily improving the completeness and comprehensiveness of code branch coverage. The iterative optimization process can run automatically according to preset thresholds, requiring no manual intervention or repeated adjustments. It can continuously optimize test coverage and stably generate high-quality test reports, providing a reliable basis for code test evaluation. From both execution efficiency and coverage quality perspectives, it comprehensively enhances the overall effect of AI-based full-process coverage test automation, ensuring efficient and high-quality completion of testing work. Attached Figure Description
[0017] Figure 1 A flowchart illustrating an AI-based full-process coverage testing automation method according to an embodiment of the present invention; Figure 2 A functional block diagram of an AI-based full-process coverage testing automation system provided in an embodiment of the present invention; The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0018] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0019] This application provides an AI-based method for automating the entire process of coverage testing. The execution entity of this AI-based method includes, but is not limited to, at least one of the following electronic devices that can be configured to execute the method provided in this application: a server, a terminal, etc. In other words, the AI-based method for automating the entire process of coverage testing can be executed by software or hardware installed on a terminal device or a server device. The server includes, but is not limited to, a single server, a server cluster, a cloud server, or a cluster of cloud servers. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0020] Reference Figure 1 The diagram shown is a flowchart illustrating an AI-based method for automating the entire process of coverage testing according to an embodiment of the present invention. In this embodiment, the AI-based method for automating the entire process of coverage testing includes: A1. Based on the test configuration information, the obtained code project to be tested is deconstructed and extracted, and the extracted function body code, branch structure information and function call relationship are associated and stored to obtain the function structure dataset of the code project to be tested; In this embodiment of the invention, the step of deconstructing and extracting the obtained code project under test according to the test configuration information, and associating and storing the extracted function body code, branch structure information and function call relationships to obtain the function structure dataset of the code project under test, includes: Based on the code parsing rules in the test configuration information, static source code analysis is performed on the code project under test to obtain the abstract syntax tree of the code project under test, and the function nodes in the abstract syntax tree are identified and the function body code is extracted from the function nodes. The logical control statements in the function body code are decomposed into their syntactic structure to obtain the branch structure information of the function body code; Scan the function body code reference declarations in the code project under test, parse out the call dependencies between function body code, and construct the function call relationship graph of the code project under test; Using function body code as the basic storage unit and attribute labels as the basic storage unit for branch structure information and function call relationship graph, a function structure dataset of the code project under test is constructed.
[0021] The function structure dataset of the code project under test, constructed using attribute labels that are based on function body code as the basic storage unit and branch structure information and function call relationship graph as the basic storage unit, includes: Assign a unique storage identifier to the function body code, and store the function body code as the basic storage unit in the memory buffer; The branch structure information is extracted in a structured manner to obtain the branch attribute records of the code project under test, and the branch attribute records are associated and mounted as the first attribute tag of the basic storage unit. Extract the outgoing edge set starting from the function corresponding to the function body code and the incoming edge set ending at the function from the function call relationship graph, and combine the outgoing edge set and the incoming edge set into function call relationship description data; The call relationship description data is associated and mounted as the second attribute label of the basic storage unit; All basic storage units with the first and second attribute labels are aggregated and stored to obtain the function structure dataset of the code project under test.
[0022] Based on the preset code parsing rules in the test configuration information, the text content of all source code files in the code project under test is read line by line. The text content is matched and split character by character according to the preset syntax rules. The split text content is then reorganized into a tree structure according to the code syntax hierarchy. After the reorganization, the abstract syntax tree of the code project under test is obtained. All nodes of the abstract syntax tree are traversed, and the node type is determined according to the syntax features corresponding to the function definition. Nodes that meet the function definition features are selected as function nodes in the abstract syntax tree. The code fragments corresponding to the selected function nodes are extracted. The extracted code fragments are the function body code.
[0023] Based on the fixed structural characteristics of logical control statements in the code syntax, the function body code is identified segment by segment, and the conditional judgment statements, loop execution statements and jump statements contained in the function body code are identified. According to the order of statement execution and the condition satisfaction, the identified logical control statements are decomposed into different execution paths, and the branch structure information of the function body code is obtained after the decomposition.
[0024] The code iterates through the text content corresponding to all function bodies in the code project under test, identifies references to other function names in the function body code, and identifies the external call interface information declared in the function body code. Functions with direct reference relationships are associated accordingly, and the call dependencies between function bodies are sorted out according to the call direction. Based on the sorted call dependencies, functions are used as nodes and call relationships are used as lines to construct a graphical representation, resulting in the function call relationship graph of the code project under test.
[0025] Each function body code segment is generated with a unique character combination according to the preset character combination rules. This unique character combination is the unique storage identifier corresponding to the function body code. The function body code with the unique storage identifier is used as an independent basic storage unit and is written into the memory buffer in the order of the memory buffer's storage address to complete the storage.
[0026] Extract three core elements from the branch structure information corresponding to the function body code: branch number, branch level, and branch triggering conditions. Organize the extracted three core elements according to a fixed field order. After the organization is completed, the branch attribute record of the code project under test is obtained. Bind the branch attribute record to the corresponding basic storage unit in the memory buffer to complete the association and mounting of the branch attribute record as the first attribute tag of the basic storage unit.
[0027] In the function call graph, locate the function node corresponding to each function body code segment, find all the connections from that function node to other function nodes, combine these connections to form the outgoing edge set corresponding to the function, find all the connections from other function nodes to that function node, combine these connections to form the incoming edge set corresponding to the function, integrate the obtained outgoing edge set and incoming edge set according to a fixed format, and after integration, form the function call relationship description data.
[0028] The call relationship description data is bound to the corresponding basic storage unit in the memory buffer, thus completing the association and mounting of the call relationship description data as the second attribute tag of the basic storage unit.
[0029] All basic storage units in the memory buffer that have completed the association and mounting of the first attribute label and the second attribute label are centrally organized according to the order of the unique storage identifier. After the organization is completed, all basic storage units are aggregated and stored. The overall data after aggregation and storage is the function structure dataset of the code project to be tested.
[0030] The beneficial effects are that by performing structured parsing and layered extraction of the source code, the syntactic structure, branch logic, and call relationships of the code are fully preserved. At the same time, the standardized storage and association of function data are achieved through unique identifiers and attribute tags, which can clearly and completely present the function structure characteristics inside the code project, improve the accuracy and traceability of code analysis results, and provide well-structured data support for subsequent code inspection and optimization.
[0031] A2. Combine the function structure dataset with the test case format template in the test configuration information to form a natural language question statement for the code project under test, and send the natural language question statement to the preset AI interface; In this embodiment of the invention, the step of combining the function structure dataset with the test case format template in the test configuration information into a natural language question statement for the code project under test, and sending the natural language question statement to a preset AI interface, includes: Data features are extracted from the function body code, branch structure information and function call relationships in the function structure dataset to obtain the key test elements of the code project under test. Based on the test case format template in the test configuration information, semantic mapping is performed on key test elements to obtain the initial questioning framework of the code project under test; Based on a pre-defined natural language generation engine, the initial question framework is enhanced with context and the test objectives and constraints of the code project under test are incorporated to obtain the natural language question statements of the code project under test. By standardizing and encapsulating the natural language question statements using the communication protocol specified in the test configuration information, the encapsulated question statements are sent to the preset AI interface.
[0032] For each function record in the function structure dataset, the function body code is read line by line, the branch nodes formed by conditional statements and loop statements in the code are identified, the start and end positions of each branch are recorded, and the complete branch structure information is sorted out. The calling instructions appearing in the function body code are traversed to determine the name and calling position of the called function, and the calling relationship between functions is constructed. The extraction threshold is set according to the number of lines of code and the calling frequency. The branch structure information and function calling relationship of the function body code with more than 30 lines of code and a calling frequency of more than 5 times are extracted to form the key test elements of the code project to be tested.
[0033] Based on the fixed test case format template in the test configuration information, the function body code content in the key test elements is mapped to the code logic description item in the template, the branch structure information is mapped to the execution path item in the template, and the function call relationship is mapped to the call scenario item in the template. Semantic correspondence is completed by matching each field, and an initial questioning framework for the code project to be tested that is consistent with the template structure is generated.
[0034] The system invokes a pre-defined natural language generation engine, reads the contents of the initial question framework, adds professional prefixes that conform to the software testing scenario before each field, and adds execution condition descriptions related to the code project under test after each field. The system fills the corresponding positions in the initial question framework with the functional verification goals and runtime environment constraints of the code project under test, thereby completing context enhancement and information fusion and generating natural language question statements for the code project under test.
[0035] According to the communication protocol format specified in the test configuration information, the natural language question statement is placed in the message body field position specified by the protocol. The statement is padded according to the character length required by the protocol, and the padded length is uniformly the minimum message length specified by the protocol. Start and end markers specified by the protocol are added before and after the statement to complete the standardized encapsulation operation. The encapsulated question statement is sent to the preset AI interface address according to the transmission method specified by the protocol.
[0036] The beneficial effects are that by accurately extracting relevant code features and strictly matching test templates to generate question frameworks, combined with professional context enhancement and standardized encapsulation, it can fully cover the core test points of the code project under test, ensure that the generated question statements conform to the AI interface's receiving specifications, improve the accuracy and stability of the test interaction process, and at the same time, adopt clear execution standards and numerical thresholds throughout the process to ensure that the entire process can be stably reproduced and avoid execution deviations caused by ambiguous expressions.
[0037] A3. Based on the test case format template, perform adaptive extraction on the original test case data returned by the AI interface to obtain the test case set of the code project to be tested; In this embodiment of the invention, the step of performing adaptability extraction on the original test case data returned by the AI interface according to the test case format template to obtain the test case set of the code project to be tested includes: The raw test case data returned by the AI interface is parsed in a multi-level structure to obtain the test input data, expected result data and execution condition data of the raw test case data; Based on the field definition of the test case format template, the test input data, expected result data, and execution condition data are filled into the corresponding template fields to obtain the test case data of the code project under test. The test case data is validated for compliance, and based on the branch coverage requirements in the function structure dataset, the validated test case data is filtered for coverage-oriented selection to obtain the test case set of the code project to be tested.
[0038] The system reads the raw test case data returned by the AI interface and performs multi-level structured parsing using a line-by-line recognition and classification approach. First, it identifies content starting with "Test Input:", extracts and organizes all content from this identifier until the next identifier, obtaining the test input data of the raw test case data. Next, it identifies content starting with "Expected Result:", extracts and organizes all content from this identifier until the next identifier, obtaining the expected result data of the raw test case data. Finally, it identifies content starting with "Execution Condition:", extracts and organizes all content from this identifier until the end of the data, obtaining the execution condition data of the raw test case data. If a certain identifier is not identified during the parsing process, it is determined that data of that type is missing, the current parsing is stopped, and a data missing message is returned.
[0039] First, retrieve the test case format template from the test configuration information and identify the three core fields preset in the template: test input field, expected result field, and execution condition field. The test input field is used to fill in the input parameters and format required for function execution, the expected result field is used to fill in the output result and format after the function is executed normally, and the execution condition field is used to fill in the runtime environment, pre-operations, and other requirements required for function execution. Then, fill in the parsed test input data item by item into the test input field of the test case format template, fill in the expected result data into the expected result field, and fill in the execution condition data into the execution condition field. After filling in, check the consistency between the data and the field definition for each field to ensure that there are no errors, omissions, or format inconsistencies. Finally, the test case data of the code project to be tested is obtained.
[0040] The obtained test case data undergoes compliance verification. Verification includes checking whether the format of the test input data completely matches the parameter format of the function in the function structure dataset, whether the format of the expected result data completely matches the output format of the function, and whether the execution condition data meets the preset runtime environment limitations of the code project under test. The verification standard is that all three items must meet the matching requirements to pass the verification; if any item fails, it is deemed non-compliant and the test case data is directly removed. Next, the branch coverage requirement in the function structure dataset is retrieved. This requirement explicitly requires the test case set to cover all branch nodes in the function structure. During screening, the execution path corresponding to each verified test case data is checked one by one to confirm that each test case data can cover at least one branch node. Simultaneously, the number of branch nodes covered by all verified test case data is counted until all branch nodes in the function structure are covered. Screening stops, and all compliant test case data is integrated to obtain the test case set for the code project under test.
[0041] The beneficial effects are as follows: multi-level structured parsing ensures accurate extraction of the required core information from the raw data returned by the AI interface; fixed template filling ensures the standardization and completeness of test case data; invalid data is eliminated through clear compliance verification standards; and targeted filtering is performed based on branch coverage requirements to ensure that the generated test case set can fully cover all branch nodes of the code project under test, thereby improving the comprehensiveness and effectiveness of testing. At the same time, clear identification labels, verification standards and filtering rules are used throughout the process to ensure that the entire process can be stably reproduced and avoid test quality problems caused by parsing deviations, filling errors or non-standard filtering.
[0042] A4. Based on the test tool call interface information in the test configuration information, import the test case set into the test tool for execution to generate the initial test report of the code project under test; In this embodiment of the invention, the step of importing the test case set into the test tool for execution based on the test tool call interface information in the test configuration information to generate an initial test report for the code project under test includes: Based on the test tool call interface information in the test configuration information, generate the execution environment configuration parameters of the test tool, and start the running instance of the test tool based on the execution environment configuration parameters; Based on the loading protocol of the testing tool, the test case set is formatted and converted to obtain the test task data package of the test case set, and then the test task data package is injected into the running instance; Trigger a running instance to simulate the execution of the code project under test in order to capture the raw execution log data output by the running instance; The raw execution log data is serialized and encapsulated to obtain the initial test report of the code project under test.
[0043] Retrieve the test tool call interface information stored in the test configuration information. This information includes the system version requirements, memory allocation standards, port usage rules, and a list of dependent components required for the test tool to run. The system version requirement is fixed as Windows 10 Professional Edition 21H2, the memory allocation standard is 8GB, the port usage rule is to use port 8080 and not conflict with other processes, and the list of dependent components includes JDK 1.8, MySQL 8.0, and Apache Tomcat 9.0. Based on this information, corresponding execution environment configuration parameters are generated one by one. The system version parameter corresponds to Windows 10 Professional Edition 21H2, the memory parameter corresponds to 8GB, the port parameter corresponds to 8080, and the dependent component parameters correspond to JDK 1.8, MySQL 8.0, and Apache Tomcat 9.0. After all parameters are filled in, they are checked one by one to ensure that they are completely consistent with the information of the test tool's call interface. Then, the generated execution environment configuration parameters are passed to the test tool's startup program. After reading the configuration parameters, the startup program automatically installs and loads all dependent components, allocates the specified memory and port, and starts the running instance of the test tool. The criteria for successful startup are that the running instance process status shows "running" and the process ID is not empty.
[0044] The pre-defined loading protocol of the testing tool is invoked. This protocol specifies that the test case set must be converted to JSON format. The field order for each test case is fixed as test input, execution condition, and expected result. The character encoding is UTF-8, and the newline character is \n. Each test case must also have a unique identifier consisting of "test case + sequence number," starting from 1 and incrementing sequentially. Following this protocol, each test case in the test case set is formatted and converted. First, the test input, execution condition, and expected result of each test case are extracted and arranged in the fixed field order. A unique identifier is added to each test case. All converted test cases are then integrated into a single JSON file. This JSON file is the test task data package for the test case set. The data package size is controlled within 100MB; if it exceeds this size, it is split into 50MB units. Each split data package still follows the same format requirements. Then, the test task data packet is transmitted segment by segment to the running instance through the loading interface of the test tool. During the transmission, a verification is performed every 10MB of data to confirm that the data transmission is without loss or error. After the transmission is completed, the running instance returns a "received successfully" message, thus completing the injection of the test task data packet.
[0045] The test tool sends a "Start Execution" command through its control interface. This command format conforms to the test tool's communication specifications and includes the storage path and execution priority of the code project under test (set to the highest priority). Upon receiving the command, the running instance retrieves the code project under test according to the storage path specified in the command. It then simulates the execution of the code project according to each test case in the test task data package, strictly adhering to the execution conditions of each test case. Detailed records of each execution step are kept, including execution time, execution operations, intermediate output results, and any exceptions. Simultaneously, all log information output by the running instance is captured in real time. This log information covers the entire execution process of the test cases, including the execution start marker, execution details of each step, execution result marker, and exception information (if any). All captured log information is integrated chronologically to form raw execution log data. The raw execution log data must be complete and free of duplicates. Each test case's execution log corresponds to a unique identifier, one-to-one with the test case identifier in the test task data package.
[0046] The raw execution log data is serialized and encapsulated using XML format. Before encapsulation, the XML tag specifications are clearly defined. The root tag is "Initial Test Report," and the sub-tags include "Execution Overview," "Test Case Execution Details," and "Exception Records." The "Execution Overview" tag contains the total number of test cases, the number of successful executions, the number of failed executions, and the total execution time. Under the "Test Case Execution Details" tag, each test case corresponds to a sub-tag containing the test case identifier, test input, execution conditions, expected result, actual execution result, and execution time. The "Exception Records" tag contains the exception test case identifier, exception information, and the location of the exception. During encapsulation, the corresponding content from the raw execution log data is filled into each XML tag one by one, ensuring that the content of each tag is completely consistent with the raw execution log data, without omissions or tampering. After encapsulation, the XML file is syntax-checked to confirm there are no missing tags or syntax errors. The XML file is then saved; this file serves as the initial test report for the code project under test.
[0047] The beneficial effects are as follows: by establishing clear test tool configuration parameters and startup standards, the test tool instance is ensured to start stably and meet test requirements; formatted conversion and data packet injection based on a fixed loading protocol ensure that test case sets can be accurately identified and loaded by the running instance; raw execution log data is fully captured during simulated execution; and initial test reports are generated by standardized serialization encapsulation. The entire process adopts specific and reproducible execution standards and operating procedures, effectively avoiding problems such as test tool startup failure, abnormal test case loading, incomplete log capture, and report encapsulation errors. This improves the stability and standardization of the testing process and provides complete and accurate basic data for subsequent test report optimization and test result analysis.
[0048] A5. Identify the uncovered branch code segments in the initial test report, and combine the function body code and branch structure information corresponding to the uncovered branch code segments in the function structure dataset to generate targeted question statements for the code project under test, and send them to the AI interface to obtain supplementary test case data; In this embodiment of the invention, the process of identifying uncovered branch code segments in the initial test report, and combining the function body code and branch structure information corresponding to the uncovered branch code segments in the function structure dataset to generate targeted question statements for the code project under test, and sending them to the AI interface to obtain supplementary test case data, includes: Perform anomaly detection on the initial test report to obtain the uncovered branch code segments in the initial test report; Locate the function ownership and logical location of the uncovered branch code segment in the code project under test; Based on the function's affiliation and logical location, extract the function body code corresponding to the uncovered branch code segment and the corresponding upstream and downstream branch structure information from the function structure dataset to construct the uncovered branch context data of the code project under test. The uncovered branch context data is parameterized and populated with the preset targeted question template to obtain the targeted question statements for the code project under test; Send targeted questions to the AI interface and receive supplementary test case data returned by the AI interface.
[0049] The location of the uncovered branch code segment within the code project under test, including its function affiliation and logical position, includes: Obtain the line number range of the uncovered branch code segment in the initial test report, and match the line numbers in the source code file of the code project under test according to the line number range to obtain the source code file path to which the uncovered branch code segment belongs; Based on the source code file path, search for the function body code containing the code line number range in the function structure dataset, and assign the function name corresponding to the found function body code as the function to which the uncovered branch code segment belongs; The algorithm parses the start and end line numbers of the uncovered branch code segment within the function's domain, and determines the logical position corresponding to the branch condition where the start and end line numbers fall, based on the branch structure information in the function structure dataset that corresponds to the function's domain.
[0050] Read the test case execution details field from the initial test report, extract the code branch node identifiers covered during the actual execution of each test case record line by line, integrate all extracted branch node identifiers into a covered branch node set, retrieve the set of all branch node identifiers of the code project under test stored in the function structure dataset, compare the contents of the two sets, filter out the branch node identifiers that do not appear in the covered branch node set, and determine the code segments corresponding to these identifiers as the uncovered branch code segments in the initial test report. The selection criterion is that the branch node identifier does not appear in the execution record of any test case.
[0051] From the uncovered branch code segment association record in the initial test report, extract the start and end values of the code line number corresponding to the code segment to form the code line number range of the uncovered branch code segment. Traverse all source code files of the code project under test, read the mapping list of code line numbers and code content in each file, check the line number mapping list of each source code file one by one, and determine whether there is a file containing the code line number range. If it exists, record the complete storage path of the file. The judgment criterion is that the line number range of the source code file completely covers the code line number range of the uncovered branch code segment.
[0052] Based on the matched source code file paths, the function information entries stored in the function structure dataset are traversed. Each function information entry contains the source code file path, function body code, and function line number range. Function information entries whose source code file paths are completely consistent with the matched file paths are filtered out. Further checks are made on whether the function line number range of these function information entries contains the line number range of the uncovered branch code segment. The function name corresponding to the function information entry that meets the conditions is the function belonging to the uncovered branch code segment. At the same time, the complete function body code of the function information entry is extracted.
[0053] The process involves parsing the start and end line numbers of the uncovered branch code segment within the function body of the function to which it belongs, determining its relative position within the function body, retrieving the branch structure information corresponding to the function's affiliation from the function structure dataset. This information includes the line number range and logical description for each branch condition. The line number range of each branch condition is checked one by one to determine whether the start and end line numbers of the uncovered branch code segment completely fall within the line number range of a certain branch condition. The logical description corresponding to the matched branch condition is the logical position of the uncovered branch code segment. The criterion for determination is that the line number range of the uncovered branch code segment completely covers the line number range of a certain branch condition.
[0054] Based on the determined function affiliation and logical position, the complete function body code corresponding to the function affiliation is extracted from the function structure dataset. At the same time, the preceding branch structure information and the subsequent branch structure information of the logical position are extracted. The preceding branch structure information is the range of the nearest branch condition line number and the logical description before the logical position, and the subsequent branch structure information is the range of the nearest branch condition line number and the logical description after the logical position. By integrating the function body code, logical position, preceding branch structure information, and subsequent branch structure information, a structured test code project uncovered branch context data is constructed. The data structure includes function name, function body code, uncovered branch logical position, preceding branch details, and subsequent branch details.
[0055] Retrieve a preset targeted question template. The template contains fixed field placeholders: function attribution placeholder, uncovered branch logic location placeholder, function body code placeholder, and upstream and downstream branch structure information placeholder. Fill the function attribution placeholder with the function attribution placeholder from the constructed uncovered branch context data, fill the uncovered branch logic location placeholder with the uncovered branch logic location placeholder, fill the complete function body code placeholder with the function body code placeholder, and fill the upstream and downstream branch structure information placeholder with the integrated preceding and subsequent branch structure information. After filling, check the completeness of the placeholder replacement field by field to ensure that there are no omissions or incorrect replacements. The generated targeted question statement must explicitly require the supplementation of test cases that can cover the uncovered branch code segment, and the statement format must be completely consistent with the fixed structure of the targeted question template.
[0056] According to the pre-set communication protocol, the generated targeted query statements are standardized and encapsulated, and start and end identifiers and length verification fields as specified in the protocol are added. After encapsulation, the encapsulated data is sent to the pre-set AI interface address. After sending, the return channel of the AI interface is continuously monitored to receive supplementary test case data returned by the AI interface. The criteria for acceptance are that the returned data contains test input data, expected result data, and execution condition data that conform to the test case format template, and the content addresses the coverage requirements of the uncovered branch code segment. If the returned data format does not meet the requirements, the encapsulation and sending operations are re-executed until supplementary test case data that meets the requirements is received.
[0057] The beneficial effects include: accurately locating uncovered branch code segments through anomaly detection; combining line number matching with correlation queries of function structure datasets to clarify the affiliation and specific logical location of uncovered branches; constructing complete context data including upstream and downstream branches; and then initiating targeted requests to the AI interface through precise filling of targeted question templates to directly obtain supplementary test cases covering the target branch. The entire process employs clear standards for set comparison, line number matching, and field filling to ensure accurate location of uncovered branches, complete context construction, and clear question targeting, effectively improving the test coverage of the code project under test and avoiding incomplete testing due to branch omissions. At the same time, the entire process can be stably reproduced through fixed datasets and templates, providing a feasible execution solution for supplementing test cases and ensuring test completeness.
[0058] A6. According to the test case format template, import the supplementary test cases parsed from the supplementary test case data into the test tool to generate an updated test report for the code project under test. Then, use the updated test report as a new initial test report and repeat A5 to A6 until the threshold for the number of iterations in the test configuration information is reached.
[0059] In this embodiment of the invention, the step of importing the supplementary test cases parsed from the supplementary test case data into the testing tool according to the test case format template to generate an updated test report for the code project under test, and repeatedly executing A5 to A6 as a new initial test report until the iteration optimization number threshold in the test configuration information is reached, includes: Based on the test case format template, the supplementary test case data is templated and compiled to obtain supplementary test cases for the supplementary test case data. Based on the test tool call interface protocol in the test configuration information, the supplementary test cases are imported into the test tool's execution queue; Trigger the testing tool to execute supplementary test cases and collect test execution logs and coverage data in real time to generate an updated test report for the code project under test; The updated test report will replace the current initial test report, and a new round of process for identifying uncovered branches and generating supplementary test cases will be initiated until the threshold for the number of iterations in the test configuration information is met.
[0060] Retrieve the test case format template and clarify the fixed format and filling specifications for the test input field, expected result field, and execution condition field. The test input field requires the name, type, and specific value of the parameters required for function execution; the expected result field requires the type and specific content of the output result after function execution; and the execution condition field requires the required runtime environment, pre-operations, and constraints for function execution. Read the supplementary test case data returned by the AI interface, extract the test input data, expected result data, and execution condition data, and fill them into the corresponding fields of the test case format template, strictly adhering to the template's format requirements during the filling process. Adjust the data format to ensure that the content format of each field is completely consistent with the template specifications. After filling, check each field to confirm there are no missing data, format errors, or content mismatches. Complete the template compilation to generate supplementary test cases corresponding to the supplementary test case data. Each supplementary test case is assigned a unique identifier, with the identifier rule consistent with the previously generated test cases: "test case + sequence number," where the sequence number increments sequentially from the original test case sequence number.
[0061] The test tool's API call protocol, stored in the test configuration information, is retrieved. The protocol specifies the import format, transmission method, and execution queue priority for supplementary test cases. The import format is XML, the transmission method is an HTTP POST request, and the execution queue priority is set to the second highest level, lower than the highest priority of the initial test cases, ensuring that the supplementary test cases are executed only after the initial test cases have completed. The generated supplementary test cases are converted to the XML format required by the protocol, and the protocol-specified request header information is added, including the interface identifier, request timestamp, and data verification code. The data verification code is generated by concatenating characters from the supplementary test case content. An HTTP POST request is sent through the test tool's API call interface to transmit the converted supplementary test case data to the test tool. Upon receiving the request, the test tool parses the XML data, extracts the supplementary test case content, and adds it to the corresponding priority position in the execution queue. Successful import is determined by the test tool returning a "successful import" response, and the unique identifier and priority information of the supplementary test case being searchable in the execution queue.
[0062] The testing tool sends a "Execute Supplementary Test Cases" command through its control interface. This command includes a unique identifier for each supplementary test case and a timeout period set to 300 seconds. If the execution time of a single supplementary test case exceeds 300 seconds, it is considered a failure, and an exception is recorded. Upon receiving the command, the testing tool retrieves the supplementary test cases from the execution queue and simulates the execution of the code under test according to their execution conditions. During execution, it collects real-time test execution logs for each step, including execution time, execution steps, test inputs, actual outputs, and any exceptions. Simultaneously, it collects coverage data in real-time, records the branch node identifiers covered by the supplementary test cases, compares them with the branch node set in the function structure dataset, and updates the list of covered branch nodes. After execution, integrate the original data from the initial test report, the execution logs of the supplementary test cases, and the updated coverage data. According to the XML tag specifications of the initial test report, update the total number of test cases, the number of successful executions, the number of failed executions, the total execution time, and the branch coverage in the execution overview. Add execution details records for the supplementary test cases, improve exception records (if any), generate an updated test report for the code project to be tested, perform syntax validation on the generated report, and save it after confirming that there are no missing tags or data errors.
[0063] Locate the file path where the initial test report is currently stored, delete the initial test report file in that path, save the generated updated test report file to the same path, and name it the same as the original initial test report. This completes the replacement of the current initial test report with the updated test report. After the replacement, record the current iteration optimization count, which is initially set to 1 and incremented by 1 after each report replacement. Retrieve the iteration optimization count threshold from the test configuration information. This threshold is set to 5. Compare the current iteration optimization count with the threshold. If the current iteration count is less than 5, restart the uncovered branch identification process. This involves anomaly detection in the updated test report, locating the uncovered branch code segment, determining the function's ownership and logical location, constructing the uncovered branch context data, generating targeted query statements, and sending them to the AI interface to obtain supplementary test case data. Then, sequentially execute the subsequent templated compilation, import execution queue, generate updated test reports, and report replacement operations. If the current iteration count is equal to 5, stop the new round of uncovered branch identification and supplementary test case generation process. Use the current updated test report as the final test report for the code project under test. The criterion for stopping iteration is that the current iteration count is exactly equal to the iteration optimization count threshold.
[0064] The beneficial effects include ensuring that supplementary test cases conform to a unified format through templated compilation, guaranteeing the orderly execution of supplementary test cases by importing them into the execution queue using a fixed interface protocol, generating updated test reports through real-time collection of logs and coverage data, and continuously supplementing test cases for uncovered branches through iterative optimization until a preset threshold is met. This gradually improves the branch coverage of the code project under test. The entire process adopts clear format specifications, execution standards, and iteration thresholds to ensure that the entire optimization process is stably reproducible, effectively avoiding test branch omissions, improving the completeness of test reports and the accuracy of test results, and providing comprehensive and reliable support for the quality verification of the code project under test.
[0065] like Figure 2 The diagram shown is a functional block diagram of an AI-based full-process coverage testing automation system provided in an embodiment of the present invention.
[0066] The AI-based full-process coverage testing automation system 100 described in this invention can be installed in an electronic device. Depending on the functions implemented, the AI-based full-process coverage testing automation system 100 may include a source code deconstruction module 101, a question generation module 102, a test case adaptation module 103, a test execution module 104, a targeted completion module 105, and an iterative update module 106. The modules described in this invention can also be referred to as units, which are a series of computer program segments that can be executed by the processor of an electronic device and can perform a fixed function, stored in the memory of the electronic device.
[0067] In this embodiment, the functions of each module / unit are as follows: The source code destructuring module 101 is used to deconstruct and extract the obtained code project under test according to the test configuration information, and associate and store the extracted function body code, branch structure information and function call relationship to obtain the function structure dataset of the code project under test. The question generation module 102 is used to combine the function structure dataset and the test case format template in the test configuration information into a natural language question statement for the code project under test, and send the natural language question statement to the preset AI interface. The test case adaptation module 103 is used to perform adaptability extraction on the original test case data returned by the AI interface based on the test case format template, so as to obtain the test case set of the code project to be tested. The test execution module 104 is used to import the test case set into the test tool for execution based on the test tool call interface information in the test configuration information, so as to generate an initial test report of the code project under test; The targeted completion module 105 is used to identify the uncovered branch code segments in the initial test report, and combine the function body code and branch structure information corresponding to the uncovered branch code segments in the function structure dataset to generate targeted question statements for the code project under test, and send them to the AI interface to obtain supplementary test case data; The iterative update module 106 is used to import the supplementary test cases parsed from the supplementary test case data into the test tool according to the test case format template, so as to generate an updated test report of the code project under test, and use the updated test report as a new initial test report to repeatedly execute the targeted completion module to the iterative update module until the threshold of the number of iterations in the test configuration information is reached.
[0068] In the several embodiments provided by this invention, it should be understood that the disclosed methods and systems can be implemented in other ways. For example, the system embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and other division methods may be used in actual implementation.
[0069] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0070] Furthermore, the functional modules in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in the form of hardware plus software functional modules.
[0071] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0072] This application embodiment can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0073] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. An AI-based method for automating the entire process of coverage testing, characterized in that, The method includes: A1. Based on the test configuration information, the obtained code project to be tested is deconstructed and extracted, and the extracted function body code, branch structure information and function call relationship are associated and stored to obtain the function structure dataset of the code project to be tested; A2. Combine the function structure dataset with the test case format template in the test configuration information to form a natural language question statement for the code project under test, and send the natural language question statement to the preset AI interface; A3. Based on the test case format template, perform adaptive extraction on the original test case data returned by the AI interface to obtain the test case set of the code project to be tested; A4. Based on the test tool call interface information in the test configuration information, import the test case set into the test tool for execution to generate the initial test report of the code project under test; A5. Identify the uncovered branch code segments in the initial test report, and combine the function body code and branch structure information corresponding to the uncovered branch code segments in the function structure dataset to generate targeted question statements for the code project under test, and send them to the AI interface to obtain supplementary test case data; A6. According to the test case format template, import the supplementary test cases parsed from the supplementary test case data into the test tool to generate an updated test report for the code project under test. Then, use the updated test report as a new initial test report and repeat A5 to A6 until the threshold for the number of iterations in the test configuration information is reached.
2. The AI-based full-process coverage testing automation method as described in claim 1, characterized in that, The process involves deconstructing and extracting the obtained code project under test based on the test configuration information, and then associating and storing the extracted function body code, branch structure information, and function call relationships to obtain a function structure dataset of the code project under test, including: Based on the code parsing rules in the test configuration information, static source code analysis is performed on the code project under test to obtain the abstract syntax tree of the code project under test, and the function nodes in the abstract syntax tree are identified and the function body code is extracted from the function nodes. The logical control statements in the function body code are decomposed into their syntactic structure to obtain the branch structure information of the function body code; Scan the function body code reference declarations in the code project under test, parse out the call dependencies between function body code, and construct the function call relationship graph of the code project under test; Using function body code as the basic storage unit and attribute labels as the basic storage unit for branch structure information and function call relationship graph, a function structure dataset of the code project under test is constructed.
3. The AI-based full-process coverage testing automation method as described in claim 2, characterized in that, The function structure dataset of the code project under test, constructed using attribute labels that are based on function body code as the basic storage unit and branch structure information and function call relationship graph as the basic storage unit, includes: Assign a unique storage identifier to the function body code, and store the function body code as the basic storage unit in the memory buffer; The branch structure information is extracted in a structured manner to obtain the branch attribute records of the code project under test, and the branch attribute records are associated and mounted as the first attribute tag of the basic storage unit. Extract the outgoing edge set starting from the function corresponding to the function body code and the incoming edge set ending at the function from the function call relationship graph, and combine the outgoing edge set and the incoming edge set into function call relationship description data; The call relationship description data is associated and mounted as the second attribute label of the basic storage unit; All basic storage units with the first and second attribute labels are aggregated and stored to obtain the function structure dataset of the code project under test.
4. The AI-based full-process coverage testing automation method as described in claim 1, characterized in that, The step of combining the function structure dataset with the test case format template in the test configuration information into a natural language question statement for the code project under test, and sending the natural language question statement to a preset AI interface, includes: Data features are extracted from the function body code, branch structure information and function call relationships in the function structure dataset to obtain the key test elements of the code project under test. Based on the test case format template in the test configuration information, semantic mapping is performed on key test elements to obtain the initial questioning framework of the code project under test; Based on a pre-defined natural language generation engine, the initial question framework is enhanced with context and the test objectives and constraints of the code project under test are incorporated to obtain the natural language question statements of the code project under test. By standardizing and encapsulating the natural language question statements using the communication protocol specified in the test configuration information, the encapsulated question statements are sent to the preset AI interface.
5. The AI-based full-process coverage testing automation method as described in claim 1, characterized in that, Based on the test case format template, the original test case data returned by the AI interface is extracted for adaptability to obtain the test case set of the code project under test, including: The raw test case data returned by the AI interface is parsed in a multi-level structure to obtain the test input data, expected result data and execution condition data of the raw test case data; Based on the field definition of the test case format template, the test input data, expected result data, and execution condition data are filled into the corresponding template fields to obtain the test case data of the code project under test. The test case data is validated for compliance, and based on the branch coverage requirements in the function structure dataset, the validated test case data is filtered for coverage-oriented selection to obtain the test case set of the code project to be tested.
6. The AI-based full-process coverage testing automation method as described in claim 1, characterized in that, The step involves importing the test case set into the test tool for execution based on the test tool call interface information in the test configuration information, in order to generate an initial test report for the code project under test, including: Based on the test tool call interface information in the test configuration information, generate the execution environment configuration parameters of the test tool, and start the running instance of the test tool based on the execution environment configuration parameters; Based on the loading protocol of the testing tool, the test case set is formatted and converted to obtain the test task data package of the test case set, and then the test task data package is injected into the running instance; Trigger a running instance to simulate the execution of the code project under test in order to capture the raw execution log data output by the running instance; The raw execution log data is serialized and encapsulated to obtain the initial test report of the code project under test.
7. The AI-based full-process coverage testing automation method as described in claim 1, characterized in that, The process involves identifying uncovered branch code segments in the initial test report and, in conjunction with the corresponding function body code and branch structure information from the function structure dataset, generating targeted question statements for the code project under test. These statements are then sent to the AI interface to obtain supplementary test case data, including: Perform anomaly detection on the initial test report to obtain the uncovered branch code segments in the initial test report; Locate the function ownership and logical location of the uncovered branch code segment in the code project under test; Based on the function's affiliation and logical location, extract the function body code corresponding to the uncovered branch code segment and the corresponding upstream and downstream branch structure information from the function structure dataset to construct the uncovered branch context data of the code project under test. The uncovered branch context data is parameterized and populated with the preset targeted question template to obtain the targeted question statements for the code project under test; Send targeted questions to the AI interface and receive supplementary test case data returned by the AI interface.
8. The AI-based full-process coverage testing automation method as described in claim 7, characterized in that, The location of the uncovered branch code segment within the code project under test, including its function affiliation and logical position, includes: Obtain the line number range of the uncovered branch code segment in the initial test report, and match the line numbers in the source code file of the code project under test according to the line number range to obtain the source code file path to which the uncovered branch code segment belongs; Based on the source code file path, search for the function body code containing the code line number range in the function structure dataset, and assign the function name corresponding to the found function body code as the function to which the uncovered branch code segment belongs; The algorithm parses the start and end line numbers of the uncovered branch code segment within the function's domain, and determines the logical position corresponding to the branch condition where the start and end line numbers fall, based on the branch structure information in the function structure dataset that corresponds to the function's domain.
9. The AI-based full-process coverage testing automation method as described in claim 1, characterized in that, The process involves importing supplementary test cases parsed from the supplementary test case data into the testing tool according to the test case format template to generate an updated test report for the code project under test. This updated test report is then used as a new initial test report, and A5 to A6 are executed repeatedly until the iteration optimization threshold in the test configuration information is reached. This includes: Based on the test case format template, the supplementary test case data is templated and compiled to obtain supplementary test cases for the supplementary test case data. Based on the test tool call interface protocol in the test configuration information, the supplementary test cases are imported into the test tool's execution queue; Trigger the testing tool to execute supplementary test cases and collect test execution logs and coverage data in real time to generate an updated test report for the code project under test; The updated test report will replace the current initial test report, and a new round of process for identifying uncovered branches and generating supplementary test cases will be initiated until the threshold for the number of iterations in the test configuration information is met.
10. An AI-based full-process coverage testing automation system, characterized in that, The system is used to implement the AI-based full-process coverage testing automation method as described in claim 1, the system comprising: The source code destructuring module is used to deconstruct and extract the obtained code project under test according to the test configuration information, and associate and store the extracted function body code, branch structure information and function call relationship to obtain the function structure dataset of the code project under test. The question generation module is used to combine the function structure dataset with the test case format template in the test configuration information into a natural language question statement for the code project under test, and send the natural language question statement to the preset AI interface; The test case adaptation module is used to extract the original test case data returned by the AI interface based on the test case format template to obtain the test case set of the code project under test. The test execution module is used to import the test case set into the test tool for execution based on the test tool call interface information in the test configuration information, so as to generate an initial test report for the code project under test; The targeted completion module is used to identify uncovered branch code segments in the initial test report, and combine the function body code and branch structure information corresponding to the uncovered branch code segments in the function structure dataset to generate targeted question statements for the code project under test, and send them to the AI interface to obtain supplementary test case data; The iterative update module is used to import the supplementary test cases parsed from the supplementary test case data into the test tool according to the test case format template, so as to generate an updated test report of the code project under test. The updated test report is then used as a new initial test report to repeatedly execute the targeted completion module to the iterative update module until the threshold of the number of iterations in the test configuration information is reached.