Search

CN-121996541-A - Intelligent repair method, system and equipment for automatic test cases

CN121996541ACN 121996541 ACN121996541 ACN 121996541ACN-121996541-A

Abstract

The invention discloses an intelligent repair method, system and equipment for an automatic test case, which specifically comprise the steps of screening a target automatic test case set according to repair task configuration parameters, detecting boundary condition coverage holes through a symbol execution technology based on the target automatic test case set, identifying uninitialized variable risk points through a data flow analysis technology to obtain a defect identification result, inputting the defect identification result into an AI repair engine to generate a repair scheme, inputting the repair scheme into a repair confidence score model and a repair influence evaluation model, performing risk evaluation and screening on the repair scheme to obtain a recommended repair scheme, verifying the test case subjected to repair of the recommended repair scheme in an isolation environment, and outputting a repair report if the verification is passed. The invention realizes the intelligent repair of the automatic test case, improves the repair efficiency and accuracy, and enhances the flexibility of the repair process.

Inventors

  • LIU LIANG

Assignees

  • 广州三七极耀网络科技有限公司

Dates

Publication Date
20260508
Application Date
20251225

Claims (10)

  1. 1. An intelligent repair method for an automatic test case is characterized by comprising the following steps: receiving repair task configuration parameters, and screening out a target automatic test case set according to the repair task configuration parameters; Detecting boundary condition coverage holes through a symbol execution technology based on a target automation test case set, and identifying uninitialized variable risk points by combining a data flow analysis technology to obtain a defect identification result; inputting the defect identification result to an AI repair engine to generate a repair scheme; inputting the repair scheme into a repair confidence scoring model and a repair influence evaluating model, and performing risk evaluation and screening on the repair scheme to obtain a recommended repair scheme; and verifying the test case after the recommended repair scheme is repaired in the isolation environment, and outputting a repair report if the test case passes the verification.
  2. 2. The method of claim 1, wherein the receiving repair task configuration parameters and screening the set of target automated test cases according to the repair task configuration parameters specifically comprises: receiving repair task configuration parameters input by a user through a configuration interface, and analyzing and extracting a target range definition rule and a task execution strategy from the repair task configuration parameters; according to the target range definition rule, screening out the identification of the target automatic test case and the corresponding source code file thereof by inquiring the test case management database; Binding the identification of the target automation test case and the corresponding source code file with the task execution strategy to generate a target automation test case set.
  3. 3. The method of claim 1, wherein the detecting boundary condition coverage holes by a symbolic execution technique based on the target automation test case set, and identifying uninitialized variable risk points in combination with a data flow analysis technique, to obtain a defect identification result specifically comprises: constructing a symbol execution path tree of a source code file based on a target automation test case set, marking program input as symbol values, collecting path constraints, deducing boundary condition values which are not covered in an original case by using a constraint solver, and generating boundary condition coverage vulnerability information; Constructing a control flow graph of a source code file based on a target automation test case set, and identifying the undefined code position of the variable on at least one path before use by analyzing the definition state and the use state of the variable in the control flow graph to establish a definition-use chain, so as to generate uninitialized variable risk point information; And fusing boundary condition coverage vulnerability information and uninitialized variable risk point information, and outputting a defect identification result.
  4. 4. The method of claim 1, wherein inputting the defect recognition result to an AI repair engine generates a repair plan, specifically comprising: analyzing the defect type, the defect position and the defect description information based on the defect identification result; Extracting a context code segment containing a defect point from the source code file according to the defect position; the defect type, the defect description information and the context code segments are assembled into a structural prompt facing the AI repair model according to a preset template; inputting the structured prompt into an AI repair model for reasoning to obtain a plurality of candidate repair schemes aiming at the defects; each candidate repair scheme is analyzed and formatted, specific code modification content and natural language description corresponding to each candidate repair scheme are extracted, and a repair scheme set is generated.
  5. 5. The method according to claim 1, wherein the inputting the repair plan into the repair confidence score model and the repair impact assessment model performs risk assessment and screening on the repair plan to obtain the recommended repair plan, specifically includes: extracting semantic consistency features, historical pattern matching features and code change conciseness features of each repair scheme, and inputting the semantic consistency features, the historical pattern matching features and the code change conciseness features into a pre-trained repair confidence scoring model to obtain repair confidence scores corresponding to each repair scheme; Analyzing the dependency relationship of the modification codes contained in each repair scheme through a pre-trained repair influence assessment model, constructing a code change influence propagation diagram, identifying the affected internal associated use cases and external public components, and generating a repair influence risk rating corresponding to each repair scheme by combining the influence breadth and the risk rating; And filtering and sequencing the multiple repair schemes according to a preset decision rule by combining the repair confidence score and the repair influence risk rating to obtain a recommended repair scheme.
  6. 6. The method according to claim 1, wherein the verifying the test case after the recommended repair scheme repair is performed in the isolated environment, and outputting the repair report if the test case passes the verification, specifically includes: repairing the source code file of the target automatic test case set based on the recommended repairing scheme to obtain a repaired test case; the method comprises the steps of executing a repaired test case in an isolation environment, monitoring an execution process and a result, and obtaining a verification result, wherein the verification result comprises a test assertion result, an execution integrity result and an environment side effect checking result; and judging whether the repair passes the verification or not according to the verification result, and outputting a repair report if the repair passes the verification.
  7. 7. The method of claim 6, wherein the method further comprises: Acquiring repair process data, and constructing and forming a reinforcement learning experience tuple according to defect characteristics of the repair process data, the adopted repair scheme characteristics, the model evaluation score and the verification result; Calculating a reward value according to the verification result and the attribute of the repair scheme, and storing the reinforcement learning experience tuple and the reward value into an experience playback pool; Sampling data from an experience playback pool, training a strategy network in an AI repair engine by using a strategy gradient algorithm, and optimizing decision parameters of the strategy network; taking the verified repair cases in the experience playback pool as labeling samples, and performing supervision fine adjustment on the repair confidence scoring model and the repair influence assessment model.
  8. 8. The method according to any one of claims 1 to 7, further comprising: identifying non-code error phenomenon and environmental context characteristics thereof in the repairing process, and encoding the non-code error phenomenon and the environmental context characteristics into a structured error event; based on the structured error event and the historical operation and maintenance knowledge, constructing an environmental problem knowledge graph containing error phenomenon nodes, potential root cause nodes and solution nodes; When a new non-code error occurs, matching and multi-step reasoning are carried out in the knowledge graph of the environmental problem, and a potential root cause list and a corresponding solution suggestion are generated; and feeding back and updating the confidence weight of the related relation edge in the environmental problem knowledge graph according to the verification and confirmation result of each potential root in the potential root list.
  9. 9. An automated test case intelligent repair system, the system comprising: the case screening module is used for receiving the repair task configuration parameters, and screening out a target automatic test case set according to the repair task configuration parameters; The defect identification module is used for detecting boundary condition coverage holes through a symbol execution technology based on the target automation test case set, and identifying uninitialized variable risk points by combining a data flow analysis technology to obtain a defect identification result; The repair scheme module is used for inputting the defect identification result to the AI repair engine to generate a repair scheme; The scheme screening module is used for inputting the repair scheme into the repair confidence scoring model and the repair influence assessment model, and carrying out risk assessment and screening on the repair scheme to obtain a recommended repair scheme; And the scheme verification module is used for verifying the test cases after the recommended repair scheme repair is executed in the isolation environment, and outputting a repair report if the test cases pass the verification.
  10. 10. A computer device comprising a memory and a processor and a computer program stored on the memory, which when executed on the processor implements the automated test case intelligent repair method of any of claims 1 to 8.

Description

Intelligent repair method, system and equipment for automatic test cases Technical Field The invention relates to the technical field of artificial intelligence, in particular to an intelligent repair method, system and equipment for an automatic test case. Background In the field of software development and testing, with the increasing size and the increasing complexity of software systems, automated test cases occupy an increasingly critical position in a software quality assurance system. The automatic test case can simulate user operation, test various functions of the software rapidly and repeatedly, effectively improve test efficiency, reduce manual test cost and provide powerful guarantee for stability of software quality. However, in the actual operation process, the automated test cases face a plurality of problems, and the test failure frequently occurs. On the one hand, code errors are an important factor in causing test case failures. Various code defects, such as boundary condition coverage loopholes, inevitably occur in the software development process, the loopholes cause abnormal behaviors to occur when the software processes boundary values, so that test cases which are judged by the boundary values fail, uninitialized variable risk points are not ignored, and when variables are not initialized correctly before use, program execution results are unpredictable, so that normal execution of the test cases is seriously affected. On the other hand, environmental changes can also have a significant impact on automated test cases. The dynamic performance of the software running environment, including operating system version update, library version dependency variation, hardware configuration difference, etc., may cause compatibility problems of the test cases which can normally run in the new environment, resulting in test failure. The existing test case maintenance and repair method mainly depends on manual operation and has a plurality of limitations. First, the efficiency is extremely low. The manual inspection and repair of the automatic test cases requires a lot of time, testers need to review codes line by line, analyze the reasons of test failures, manually write repair codes, and the whole process is tedious and time-consuming, so that the rapid iteration software development rhythm is difficult to meet. Second, accuracy is difficult to guarantee. The manual operation is easily influenced by subjective factors, and the situations of omission and errors are common. For example, a tester may fail to fully identify all potential code defects, or introduce new errors during the repair process, resulting in incomplete or failed repairs, thereby affecting software quality. Furthermore, there is a lack of intelligence. The existing method is difficult to automatically analyze the failure reasons of the test cases and generate a repair scheme by means of intelligent technology, the advantages of the computer in terms of data processing and pattern recognition cannot be fully exerted, and further improvement of repair efficiency and accuracy is limited. Finally, the flexibility is not sufficient. The method has the advantages that timing tasks are difficult to set according to the requirements of different users, the test case repair flow is automatically triggered, and specific test cases are difficult to accurately screen for repair, so that diversified test scenes and user individuation requirements cannot be met. Disclosure of Invention The invention aims to provide an intelligent repair method, an intelligent repair system and intelligent repair equipment for an automatic test case, which realize intelligent repair of the automatic test case, improve repair efficiency and accuracy, enhance flexibility of a repair process, meet diversified requirements of different users, and provide powerful support for software quality assurance so as to solve at least one of the problems in the prior art. In a first aspect, the present invention provides an intelligent repair method for an automated test case, where the method specifically includes: receiving repair task configuration parameters, and screening out a target automatic test case set according to the repair task configuration parameters; Detecting boundary condition coverage holes through a symbol execution technology based on a target automation test case set, and identifying uninitialized variable risk points by combining a data flow analysis technology to obtain a defect identification result; inputting the defect identification result to an AI repair engine to generate a repair scheme; inputting the repair scheme into a repair confidence scoring model and a repair influence evaluating model, and performing risk evaluation and screening on the repair scheme to obtain a recommended repair scheme; and verifying the test case after the recommended repair scheme is repaired in the isolation environment, and outputting a repair report if the test