An artificial intelligence-based method for automatic detection and repair of code defects
By adjusting the repair strategy based on the historical recognition data of the recognition model, the problem of insufficient reliability in the code defect detection and repair process in the existing technology is solved, and the repair efficiency and reliability are improved. In particular, the repair effect of code defects in the recognition deviation business logic is significantly improved.
Patent Information
- Application Number
- CN202510918813.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-04
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2045-07-04
AI Technical Summary
Existing technologies ignore differentiated repair strategies in the process of code defect detection and repair, resulting in insufficient reliability in code defect identification in certain business scenarios. In particular, null pointer exceptions, pointer exceptions, and branch logic defects cannot be effectively identified, and the repair efficiency is low.
Determine the recognition deviation through the historical recognition data of the recognition model, adjust the repair strategy according to the recognition deviation business logic, use test cases to verify the processing, and optimize the repair processing strategy to improve reliability and efficiency.
It realizes the adjustment of repair strategies according to the degree of identification deviation, improves the reliability and repair efficiency of code defect detection, and ensures the reliability and accuracy of repair processing.
Smart Images

Figure CN120407371B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of test management, and in particular relates to an artificial intelligence-based automatic code defect detection and repair method. Background Art
[0002] In the existing technical solutions, when identifying and processing code defects, testers are often required to construct test cases to identify and process code defects. Since this relies entirely on the testing experience of the testers, it is inevitable that the accuracy of identifying and processing code defects cannot meet the requirements. Various software defects often appear after the software code is launched, making it difficult for the software system's operating reliability to meet the requirements.
[0003] To solve the above technical problems, the invention patent application CN202510250627.0, "A software automatic testing method and device based on artificial intelligence," automatically constructs test cases based on artificial intelligence, thereby improving the comprehensiveness and accuracy of code defect identification. However, the existing technical solutions have the following technical problems:
[0004] In the process of detecting and repairing code defects, the existing technical solutions ignore the generation of differentiated repair processing strategies based on the detection results. Specifically, in some business scenarios, due to the deviation of the training data of the artificial intelligence model, the reliability of identifying code defects in some data processing business logic is difficult to meet the requirements, which may lead to the above-mentioned code defects in the data processing business logic, such as null pointer exceptions, pointer exceptions, and branch logic defects. Code defects cannot be effectively identified, which makes the automatic repair of the code take too long and cannot effectively solve the code defect problem. Therefore, how to identify the deviation business logic in the code in advance to improve the reliability of code defect detection and repair processing has become a technical problem that needs to be solved urgently.
[0005] To solve the above technical problems, the present application provides an artificial intelligence-based method for automatic detection and repair of code defects. Summary of the Invention
[0006] To achieve the purpose of the present invention, the present invention adopts the following technical solutions:
[0007] Specifically, this application provides an artificial intelligence-based method for automatically detecting and repairing code defects, which specifically includes:
[0008] S1 determines, using historical recognition data of an artificial intelligence-based code defect recognition model, recognition deviations of the recognition model in data processing business logic of different software codes, and determines recognition deviation business logic in the data processing business logic based on the recognition deviations;
[0009] S2 detects and processes the software code defects based on the recognition model to obtain code defects. When the recognition reliability of the code defects of the recognition model meets the requirements based on the overlap data between the code defects and different recognition deviation business logics, the next step is entered;
[0010] S3 determines the verification processing strategy and optimization target for the software code corresponding to the different identification deviation business logics before the code defect is repaired, based on the identification deviation conditions of the different identification deviation business logics and the constituent data of the code defect in the corresponding software code;
[0011] S4 determines the repair target in the code defect based on the verification results, and determines the optimization adjustment method of the verification processing strategy of the target to be optimized in the next code repair processing based on the operating data of the target to be optimized in different repair processing times and the changes in the repair target in different repair processing times.
[0012] The beneficial effects of the present invention are:
[0013] Based on the overlapping data between code defects and different identification deviation business logics, it is determined whether the recognition reliability of the code defects of the identification model meets the requirements, thereby fully considering the differences in the reliability of the identification processing results of code defects caused by the differences in the degree of overlap with the identification deviation business logic, thereby avoiding the original direct repair processing of the software code, and the emergence of technical problems such as the slow efficiency of the repair processing due to unreliable code defect detection results. It also lays the foundation for further determining differentiated verification processing strategies and ensures the reliability of the repair processing.
[0014] Based on the running data of the target to be optimized in different repair processing times and the changes in the repair target in different repair processing times, the optimization adjustment method of the verification processing strategy of the target to be optimized in the next code repair processing is determined. Not only is it based on the changes in the running results of the target to be optimized, an accurate assessment of the probability of whether there is a software defect in the target to be optimized is achieved, but also based on the changes in the repair target, an accurate assessment of the reliability of the repair result is achieved. Furthermore, from the two perspectives of the probability of defect existence and the reliability of the repair processing, the optimization adjustment method of the verification processing strategy of the target to be optimized in the next code repair processing is determined, thereby improving the efficiency and reliability of the repair processing.
[0015] A further technical solution is that the identification deviation situation in the data processing business logic includes the number of identification deviations of code defects in the data processing business logic.
[0016] A further technical solution is that the data processing business logic is divided according to the type of data processing function called.
[0017] A further technical solution is that the function types include mathematical operation functions, conditional branch control functions, text processing functions, date and time functions, and aggregate statistical functions.
[0018] A further technical solution is that the method for determining the identification deviation business logic in the data processing business logic is:
[0019] Determining the number of recognition deviations of the data processing business logic based on recognition deviations of the recognition model in the data processing business logic of different software codes;
[0020] Based on the number of identification deviations, it is determined whether the data processing business logic is identification deviation business logic.
[0021] A further technical solution is that the method for determining the verification processing strategy of the target to be optimized before the next step of repairing the code defects is:
[0022] Using the operating data of different targets to be optimized in different repair processing times, determining whether the operating results in different repair processing times are inconsistent or whether there are targets to be optimized that are inconsistent with the target operating results, and using such targets as operating result deviation targets;
[0023] According to the changes of the repair targets in different repair processing times, the number of new repair targets after the last repair processing of different repair processing times is determined, and the number is used as the number of new targets;
[0024] Based on the number of newly added targets and the number of running result deviation targets for different repair processing times, a verification processing strategy for the target to be optimized before performing the next step of repairing the code defects is determined.
[0025] Other features and advantages will be described in the following description. The objectives and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description and drawings.
[0026] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The above and other features and advantages of the present invention will become more apparent by describing in detail exemplary embodiments thereof with reference to the accompanying drawings.
[0028] Figure 1It is a flowchart of an artificial intelligence-based method for automatic detection and repair of code defects;
[0029] Figure 2 It is a flow chart of a method for determining identification deviation business logic in data processing business logic;
[0030] Figure 3 It is a flow chart for determining whether the recognition processing reliability of the recognition model meets the requirements;
[0031] Figure 4 It is a flowchart of a method for determining a verification processing strategy for a target to be optimized before proceeding to the next step of repairing code defects. DETAILED DESCRIPTION
[0032] To help those skilled in the art better understand the technical solutions in this specification, the following will provide a clear and complete description of the technical solutions in the embodiments of this specification, in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this specification without creative work should fall within the scope of protection of this specification.
[0033] In this application, by identifying the recognition deviation business logic in the recognition model, and then through the running results of the recognition model in the automatic repair processing of the software code, the verification processing strategy of the recognition deviation business logic during the next repair processing is determined, so that the test case can be used in time for verification and adjustment processing, thereby improving the efficiency of the repair processing.
[0034] The target to be optimized is a target software code having inconsistent locations of code defects in different recognition processing times.
[0035] The running results of different repair processing times are inconsistent or there are targets to be optimized that are inconsistent with the target running results, and they are used as running result deviation targets. According to the changes in the repair targets in different repair processing times, the number of new repair targets added after the last repair processing of different repair processing times is determined, and it is used as the number of new targets. When there are new repair targets in different repair processing times, at this time, in order to improve the reliability of the repair processing, all targets to be optimized and the target software code that has not been verified by the test case method before the code defect is repaired are verified by the test case method.
[0036] When there are not all newly added repair targets in different repair processing times, the running result deviation targets are verified through test cases, and other targets to be optimized are still verified through multiple identification processing before the target software code is repaired.
[0037] In one embodiment:
[0038] For the recognition model in the data processing business logic corresponding to the text processing function, if its recognition times in history are relatively high, if the recognition deviation times in the text processing function accounts for more than 0.6 of the historical recognition processing times, then the text processing function will be used as the recognition deviation business logic. When using the recognition model to identify and process code defects in the software code used for the risk control model, if all the code defects fall into the text processing function in large numbers, in a possible embodiment, if 1 / 4 of the code defects fall into the text processing function, then it can be determined that there is a risk of recognition deviation, that is, the recognition reliability does not meet the requirements.
[0039] When the recognition reliability does not meet the requirements, at this time, since the number of code defects in the text processing function is large and the number of recognition deviations is large, on this basis, if the number of code defects in the software code block including the text processing function is small, through multiple recognitions, that is, using the recognition model to perform multiple code defect recognitions on the software code block including the text processing function, when the code defects in different recognition processing times are inconsistent, the software code block is determined to be the target to be optimized, and the software code block is divided according to independent sub-functions, and each sub-function is divided into a software code block.
[0040] Repair code defects that do not belong to the target to be optimized. Specifically, manual repair or automatic repair using recognition models can be used. When the number of repair processes is more than 5 times, code defects exist in different repair processes, and there are new repair targets compared to the previous repair processes, then the test data can be directly used to repair the code defects of the target to be optimized.
[0041] like Figure 1 As shown, this application provides an artificial intelligence-based method for automatic detection and repair of code defects, which specifically includes:
[0042] S1 determines, using historical recognition data of an artificial intelligence-based code defect recognition model, recognition deviations of the recognition model in data processing business logic of different software codes, and determines recognition deviation business logic in the data processing business logic based on the recognition deviations;
[0043] Furthermore, the identification deviation situation in the data processing business logic includes the number of identification deviations of code defects in the data processing business logic.
[0044] It should be noted that the AI-based code defect recognition model can input common code defects, software codes with code defects, and repair methods into the RNN algorithm-based neural network model for training and processing, thereby realizing that based on the input amount of software code, the neural network model can automatically locate the location of code defects and output repair suggestions.
[0045] It should also be noted that the data processing business logic is divided according to the type of data processing function called.
[0046] It is understandable that the function types include mathematical operation functions, conditional branch control functions, text processing functions, date and time functions, and aggregate statistics functions.
[0047] Specifically, such as Figure 2 As shown, the method for determining the identification deviation business logic in the data processing business logic is:
[0048] Determining the number of recognition deviations of the data processing business logic based on recognition deviations of the recognition model in the data processing business logic of different software codes;
[0049] Based on the number of identification deviations, it is determined whether the data processing business logic is identification deviation business logic.
[0050] It should be noted that the number of identification deviations is the number of times that the identified code defects are inconsistent with the actual code defects.
[0051] It can be understood that when the number of identification deviations is greater than the preset deviation threshold or the proportion of the number of identification deviations in the historical identification times in the data processing business logic does not meet the requirements, that is, it is greater than 0.6, then the data processing business logic is determined to be an identification deviation business logic.
[0052] Optionally, the method for determining the identification deviation business logic in the data processing business logic is:
[0053] Determining the number of recognition deviations of the data processing business logic based on recognition deviations of the recognition model in the data processing business logic of different software codes;
[0054] Based on the number of identification deviations, determining a software code having an identification deviation and using the software code as an identification deviation code;
[0055] Whether the data processing business logic is identification deviation business logic is determined according to the number of existing identification deviation codes.
[0056] It can be understood that when the number of identification deviation codes is greater than a preset deviation code number threshold, the data processing business logic is determined to be the identification deviation business logic.
[0057] S2 detects and processes the software code defects based on the recognition model to obtain code defects. When the recognition reliability of the code defects of the recognition model meets the requirements based on the overlap data between the code defects and different recognition deviation business logics, the next step is entered;
[0058] Specifically, such as Figure 3 As shown, determining whether the recognition processing reliability of the recognition model meets the requirements specifically includes:
[0059] Determining distribution data of code defects in different identification deviation business logics based on the overlap data between the code defects and different identification deviation business logics;
[0060] Based on the distribution data, determining a code defect in the identification deviation business logic and treating it as a coincident code defect;
[0061] Whether the recognition processing reliability of the recognition model meets the requirements is determined through the distribution data of the overlapping code defects in the code defects of the software code.
[0062] It can be understood that when the proportion of the overlapping code defects in the code defects of the software code does not meet the requirements, that is, it is greater than 0.2, then a large number of code defects are distributed in the recognition deviation business logic to determine that the recognition processing reliability of the recognition model does not meet the requirements.
[0063] It should be noted that when the recognition processing reliability of the recognition model does not meet the requirements, test cases are constructed for the software codes corresponding to different recognition deviation business logics, and when the test cases are used to determine that there are no abnormalities in the software codes corresponding to the recognition deviation business logics, the recognition model is used to repair the code defects of the software code, that is, the code defects of the software code other than the recognition deviation business logic are repaired.
[0064] It is understood that determining whether the recognition processing reliability of the recognition model meets the requirements specifically includes:
[0065] S21 determines distribution data of the code defects in the different identification deviation business logics based on the overlap data between the code defects and the different identification deviation business logics, determines the code defects in the identification deviation business logics based on the distribution data, and uses them as overlapped code defects, and determines the number of overlapped code defects in the software codes corresponding to the different identification deviation business logics;
[0066] Optionally, in the above steps, if the number of code defects is small, that is, less than a preset threshold, it can be directly determined that the recognition processing reliability of the recognition model meets the requirements.
[0067] In addition, in the above steps, if the number of code defects is not less than the preset threshold, it is necessary to further determine whether the number of overlapping code defects meets the requirements. When the number of overlapping code defects is greater than the preset defect number threshold or the proportion of overlapping code defects in the code defects is greater than the preset overlapping defect proportion threshold, it can be directly determined that the recognition processing reliability of the recognition model does not meet the requirements.
[0068] It should also be further explained that when the number of overlapping code defects meets the requirements, it is necessary to further determine that the number of overlapping code defects in the corresponding software code does not meet the requirements of the identification deviation business logic. It can be understood that when there is an identification deviation business logic that the number of overlapping code defects in the corresponding software code is greater than the preset defect number threshold, it can be directly determined that the recognition processing reliability of the recognition model does not meet the requirements. In other cases, proceed to the next step.
[0069] S22: The software code corresponding to the identification deviation business logic having the overlapped code defect is used as the overlapped deviation software code, and the ratio of the overlapped deviation software code to the software code corresponding to the identification deviation business logic is used to determine the ratio of the number of identification deviations.
[0070] It can be understood that when the number of overlapping deviation software codes does not meet the requirements, that is, when the number of software codes corresponding to the identification deviation business logic with overlapping code defects is large, that is, greater than the preset threshold, it can be directly determined that the recognition processing reliability of the recognition model does not meet the requirements.
[0071] It can also be understood that when the number of software codes corresponding to the identification deviation business logic with overlapping code defects is small, it is necessary to determine the proportion of the overlapping deviation software code in the number of software codes corresponding to the identification deviation business logic, and determine the proportion of the number of identification deviations. At this time, if the proportion of the number of identification deviations is greater than the preset deviation proportion threshold, it can also be determined that the recognition processing reliability of the recognition model does not meet the requirements.
[0072] S23 determines whether the recognition processing reliability of the recognition model meets the requirements through the distribution data of the overlapping code defects in the code defects of the software code, the number of overlapping code defects in the software code corresponding to different recognition deviation business logics, and the proportion of the number of recognition deviations.
[0073] It can be understood that in a possible embodiment, the defect ratio is determined by the average ratio of the number of overlapping code defects in the code defects of the software code and the number of identification deviations, and the identification processing deviation value is determined according to the product of the defect ratio and the average number of overlapping code defects in the software code corresponding to different identification deviation business logics.
[0074] When the recognition processing deviation value is greater than a preset recognition deviation threshold, wherein the preset recognition deviation threshold is determined according to the number of software codes corresponding to the recognition deviation business logic in the software code, wherein the more software codes corresponding to the recognition deviation business logic in the software code, the smaller the preset recognition deviation threshold, then it is determined that the recognition processing reliability of the recognition model does not meet the requirements.
[0075] S3 determines the verification processing strategy and optimization target for the software code corresponding to the different identification deviation business logics before the code defect is repaired, based on the identification deviation conditions of the different identification deviation business logics and the constituent data of the code defect in the corresponding software code;
[0076] Furthermore, the method for determining the verification processing strategy of the software code corresponding to the identification deviation business logic before repairing the code defect is as follows:
[0077] Based on the identification deviation of the identification deviation business logic, determine the proportion of the number of identification deviations of the identification deviation business logic in the historical identification number of times in the data processing business logic, and use it as the deviation identification proportion;
[0078] Using the software code corresponding to the deviation identification business logic as the target software code, and determining the number of code defects in the target software code based on the constituent data of the code defects in the target software code;
[0079] Based on the deviation identification ratio and the number of code defects, a verification processing strategy for the software code corresponding to the identified deviation business logic before the code defects are repaired is determined.
[0080] It can be understood that when the deviation identification ratio is greater than the preset ratio threshold, in a possible embodiment, the preset ratio threshold is determined according to the number of identification deviation business logics, wherein the more the number of identification deviation business logics, the greater the identification deviation ratio. In a possible embodiment, it is set to 0.7. Regardless of the number of code defects, it is necessary to implement verification processing of the target software code before repairing the code defects by constructing test cases.
[0081] It should also be noted that when the deviation identification ratio is not greater than the preset ratio threshold, only when the number of code defects of the target software code in the software code is greater than the preset defect number ratio threshold, in a possible embodiment, when it is above 0.05, it is necessary to implement verification processing of the target software code before the code defects are repaired by constructing test cases, and when the number of code defects of the target software code in the software code is not greater than the preset defect number ratio threshold, it is only necessary to perform verification processing of the target software code before the code defects are repaired through multiple identification processing.
[0082] It can be understood that the multiple recognition processing method is to obtain the recognition result by using the recognition model to perform recognition processing for a fixed preset number of times, wherein the recognition result includes the location and number of code defects in different recognition processing times.
[0083] Furthermore, the target to be optimized is a target software code having inconsistent locations of code defects in different identification processing times.
[0084] S4 determines the repair target in the code defect based on the verification results, and determines the optimization adjustment method of the verification processing strategy of the target to be optimized in the next code repair processing based on the operating data of the target to be optimized in different repair processing times and the changes in the repair target in different repair processing times.
[0085] Furthermore, when a test case is used to implement verification processing of the target software code before repairing the code defects, the code defects can be repaired directly by manual means when problems exist.
[0086] It should be noted that the repair target is to remove code defects other than the software code corresponding to the identification deviation business logic and the software code corresponding to the identification deviation business logic that is not the target to be optimized.
[0087] Specifically, such as Figure 4 As shown, the method for determining the verification processing strategy of the target to be optimized before the next step of repairing the code defects is:
[0088] Using the operating data of different targets to be optimized in different repair processing times, determining whether the operating results in different repair processing times are inconsistent or whether there are targets to be optimized that are inconsistent with the target operating results, and using such targets as operating result deviation targets;
[0089] According to the changes of the repair targets in different repair processing times, the number of new repair targets after the last repair processing of different repair processing times is determined, and the number is used as the number of new targets;
[0090] Based on the number of newly added targets and the number of running result deviation targets for different repair processing times, a verification processing strategy for the target to be optimized before performing the next step of repairing the code defects is determined.
[0091] It should be noted that the newly added repair targets are those that were not repair targets in the last repair process, but are repair targets in the current repair process;
[0092] Specifically, the repair target in the different repair processing times is the repair target whose running processing result after the last repair processing is inconsistent with the target processing result. It can be understood that the target running result is the program running result expected to be output by the software code corresponding to the repair target, which can be specifically determined by manual input or the result of automatic recognition of the code logic flow chart by the model.
[0093] Furthermore, based on the number of newly added targets and the number of target deviations from the running results for different repair processing times, a verification processing strategy for the target to be optimized before the next step of repairing the code defect is determined, specifically including:
[0094] When the number of repair processing times is not greater than the preset repair processing times threshold, the optimization adjustment of the verification processing strategy of the target to be optimized before the next step of repairing the code defect is temporarily not performed, and no verification processing is required;
[0095] When the number of repair processing times is greater than the preset repair processing times threshold, and when there are newly added repair targets in different repair processing times, in order to improve the reliability of the repair processing, all targets to be optimized and target software codes that have not been verified by the test case method before the code defect is repaired are verified by the test case method;
[0096] When there are unequal new repair targets in different repair processing times, the number of new targets for different repair processing times is obtained. When the number of new targets is greater than a preset target number threshold and the number of repair processing times is greater than a preset processing number threshold, all targets to be optimized and target software codes that have not been verified by means of test cases before the repair of code defects are verified by means of test cases.
[0097] When the number of newly added targets is greater than the preset target number threshold and the number of repair processing times is not greater than the preset processing number threshold, then if the number of running result deviation targets does not meet the requirements, that is, it is greater than the preset number threshold, at this time, for all targets to be optimized and target software codes that have not been verified by test cases before the repair of code defects, they are all verified by test cases;
[0098] If the number of running result deviation targets meets the requirements, the running result deviation targets are verified and processed through test cases. Other targets to be optimized are still verified and processed by multiple identification processes before the target software code is repaired. If the identification results are still inconsistent, verification is performed through test cases.
[0099] Optionally, the method for determining the verification processing strategy of the target to be optimized before the next step of repairing the code defect is:
[0100] S41 determines, based on the changes in the repair targets at different repair processing times, the number of newly added repair targets after the last repair processing at different repair processing times, and uses the number of newly added targets as the number of newly added targets; and determines, based on the number of times that different repair targets belong to the newly added repair targets, the frequently changed repair targets in the software code;
[0101] It should be noted that, in the above steps, if it is determined that the number of repair processing times is not greater than the preset repair processing times threshold, then the optimization adjustment of the verification processing strategy of the target to be optimized before the next step of repairing the code defect is temporarily not performed, and no verification processing is required;
[0102] In addition, if the number of repair processing times is greater than the preset repair processing times threshold, when there are newly added repair targets in different repair processing times, in order to improve the reliability of the repair processing, all targets to be optimized and target software codes that have not been verified by the test case method before the code defect is repaired are verified by the test case method;
[0103] In addition, it can be understood that if there are not all newly added repair targets in different repair processing times, the number of newly added targets for different repair processing times is obtained. When the number of newly added targets is greater than the preset target number threshold and the number of repair processing times is greater than the preset processing number threshold, all targets to be optimized and the target software code that has not been verified by the test case method before the code defect is repaired are verified by the test case method.
[0104] If the number of newly added targets is greater than the preset target number threshold and the number of repair processing times is not greater than the preset processing number threshold, it is also necessary to determine whether the number of frequently changing repair targets in the software code meets the requirements. Specifically, when there are more than 3 frequently changing repair targets, all targets to be optimized and target software codes that have not been verified by test cases before the repair of code defects are directly verified by test cases. In other cases, proceed to the next step.
[0105] It should be noted that the frequently changed repair targets are repair targets that are newly added more than twice.
[0106] S42 uses the operation data of different targets to be optimized in different repair processing times to determine whether the operation results in different repair processing times are inconsistent or whether there are targets to be optimized that are inconsistent with the target operation results, and uses them as operation result deviation targets. According to whether the operation results of the operation result deviation targets in the most recent preset repair times are consistent with the target processing results, the operation result deviation targets are divided into suspected defective targets and normal targets;
[0107] It can be understood that the suspected defect target is the operation result deviation target where the operation results in the most recent preset repair times are inconsistent with the target processing results, and is specifically determined based on whether the most recent 5 operation results are consistent with the target processing results.
[0108] In addition, it should be noted that in the above steps, if the number of suspected defect targets does not meet the requirements, that is, the number of suspected defect targets is greater than the threshold value of the number of suspected defect targets, it means that the number of suspected defect targets is large. Therefore, on this basis, all targets to be optimized and the target software codes that have not been verified by test cases before the code defects are repaired are directly verified by test cases.
[0109] It can also be understood that if the number of running result deviation targets does not meet the requirements, that is, it is greater than the preset number threshold, then all targets to be optimized and target software codes that have not been verified by test cases before the code defects are repaired are verified by test cases. In other cases, proceed to the next step.
[0110] S43 determines a verification processing strategy for the target to be optimized before performing the next step of repairing code defects based on the number of frequently changed repair targets in the software code and the number of suspected defect targets and normal targets in the running result deviation targets.
[0111] In a possible embodiment, the optimization requirement value is determined according to the ratio of the sum of the number of frequently changing repair targets and the number of operation result deviation targets to the number of normal targets among the operation result deviation targets.
[0112] It can be understood that when the optimization requirement value is greater than the preset optimization requirement threshold, all targets to be optimized and target software codes that have not been verified by test cases before the code defects are repaired are verified by test cases. In other cases, the operation result deviation targets and frequently changed repair targets are verified by test cases. Other targets to be optimized still use multiple identification processes to verify the target software code before the code defects are repaired.
[0113] The various embodiments in this specification are described in a progressive manner. Similar portions between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from the other embodiments. In particular, the device, apparatus, and non-volatile computer storage medium embodiments are generally similar to the method embodiments, so their descriptions are relatively simplified. For relevant details, refer to the descriptions of the method embodiments.
[0114] The above description of specific embodiments of the present specification has been made. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0115] The foregoing is merely one or more embodiments of this specification and is not intended to limit this specification. It will be apparent to those skilled in the art that various modifications and variations may be made to one or more embodiments of this specification. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of one or more embodiments of this specification shall be included within the scope of protection of this specification.
Claims
1. A method for automatic detection and repair of code defects based on artificial intelligence, characterized in that: Specifically include: Using historical recognition data of an artificial intelligence-based code defect recognition model, determine recognition deviations of the recognition model in data processing business logic of different software codes, and determine recognition deviation business logic in the data processing business logic based on the recognition deviations; Detecting and processing software code defects based on the recognition model to obtain code defects, and determining whether the recognition reliability of the recognition model meets the requirements based on the overlap data between the code defects and different recognition deviation business logics, then proceeding to the next step; Determine the verification and processing strategy and optimization targets for the software codes corresponding to the different identification deviation business logics before the code defects are repaired, based on the identification deviation conditions of the different identification deviation business logics and the constituent data of the code defects in the corresponding software codes; Determine the repair target for the code defect based on the verification results, and determine the optimization adjustment method for the verification processing strategy of the target to be optimized in the next code repair process based on the operating data of the target to be optimized during different repair processing times and the changes in the repair target during different repair processing times; Determining whether the recognition processing reliability of the recognition model meets the requirements specifically includes: Determining distribution data of code defects in different identification deviation business logics based on the overlap data between the code defects and different identification deviation business logics; Based on the distribution data, determining a code defect in the identification deviation business logic and treating it as a coincident code defect; determining whether the recognition processing reliability of the recognition model meets the requirements based on the distribution data of the overlapping code defects in the code defects of the software code; When the proportion of the number of the overlapping code defects in the code defects of the software code does not meet the requirement, determining that the recognition processing reliability of the recognition model does not meet the requirement; The method for determining the verification processing strategy of the target to be optimized before the next step of repairing the code defect is as follows: Using the operating data of different targets to be optimized in different repair processing times, determining whether the operating results in different repair processing times are inconsistent or whether there are targets to be optimized that are inconsistent with the target operating results, and using such targets as operating result deviation targets; According to the changes of the repair targets in different repair processing times, the number of new repair targets after the last repair processing of different repair processing times is determined, and the number is used as the number of new targets; Based on the number of newly added targets and the number of running result deviation targets for different repair processing times, a verification processing strategy for the target to be optimized before performing the next step of repairing the code defects is determined.
2. The method for automatic detection and repair of code defects based on artificial intelligence according to claim 1, characterized in that: The identification deviation situation in the data processing business logic includes the number of identification deviations of code defects in the data processing business logic.
3. The method for automatic detection and repair of code defects based on artificial intelligence according to claim 1, characterized in that: The data processing business logic is divided according to the type of data processing function called.
4. The method for automatic detection and repair of code defects based on artificial intelligence according to claim 1, characterized in that: The method for determining the identification deviation business logic in the data processing business logic is: Determining the number of recognition deviations of the data processing business logic based on recognition deviations of the recognition model in the data processing business logic of different software codes; Based on the number of identification deviations, it is determined whether the data processing business logic is identification deviation business logic.
5. The method for automatic detection and repair of code defects based on artificial intelligence according to claim 4, characterized in that: The number of identification deviations is the number of times that the identified code defects are inconsistent with the actual code defects.
6. The method for automatic detection and repair of code defects based on artificial intelligence according to claim 1, characterized in that: The newly added repair target is a repair target that was not a repair target during the last repair process, but is a repair target during the current number of repair processes.
7. The method for automatic detection and repair of code defects based on artificial intelligence according to claim 1, characterized in that: Based on the number of newly added targets and the number of target deviations from the running results for different repair processing times, a verification processing strategy for the target to be optimized before the next step of repairing the code defect is determined, specifically including: When there are new repair targets in different repair processing times, all targets to be optimized and target software codes that have not been verified by test cases before the code defects are repaired are verified by test cases.
Citation Information
Patent Citations
Automatic software testing method and device based on artificial intelligence
CN119829467A
Code defect prediction method, readable storage medium and computer program product
CN119396689A
Software efficient testing method and system based on artificial intelligence
CN119396719A