Method for assisting in quickly positioning software problem
By building a code structure tree and tracking modification records, combined with automated scripts and static and dynamic analysis, the problem of low software BUG location efficiency is solved, rapid location and automatic verification are achieved, a closed-loop process is formed, and software problem repair efficiency and user satisfaction are improved. .
Patent Information
- Application Number
- CN202410683350.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2024-09-20
AI Technical Summary
When a bug occurs in the software, it is difficult to quickly locate the file and specific code location of the problem with the existing technology, resulting in low efficiency and the inability to realize automatic verification and automatic processing of batch problems. The positioning accuracy relies on manual experience, and the reproducibility of the results is poor, which cannot be satisfied. User's service response requirements.
Build a structural tree of software code, track code modification submission records, calculate the correlation score between modification submission records and problems, use automated scripts to gradually roll back and verify the occurrence of problems, and combine code structure with static and dynamic analysis technology to achieve rapid positioning and automatic verification. Form a closed-loop locate-fix-verify process.
It realizes automatic identification and location of software problems, significantly reduces manual analysis workload, improves location efficiency, shortens the problem repair cycle, and improves software quality and user satisfaction.
Smart Images

Figure CN118672899A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a method for assisting in quickly locating software problems. Background Art
[0002] When a software bug occurs, it takes a lot of time to locate the problem, and it is difficult to quickly locate the file and specific code location where the problem occurs. Relying on manual experience to analyze logs to locate the problem is inefficient and cannot meet the needs of rapid location. It is impossible to automatically identify the code related to the problem, and manual debugging and analysis are required step by step. It is impossible to quickly locate the specific line of code or function where the problem is located, and the location granularity is insufficient. It is impossible to automatically verify the repair of the problem, and the verification results need to be manually confirmed. It is impossible to form a closed-loop location-repair-verification process, and the inspection effect is questionable. The accuracy of positioning depends on personal experience, and the reproducibility of the results is poor. The problem solving cycle is long and cannot meet the user's service response requirements. Code debugging and analysis mostly rely on manual work, and the degree of automation is low. It is impossible to achieve automatic processing of batch software problems, and the efficiency is still low. It is difficult to analyze the correlation between problems between software versions, and problem correlation is difficult to find. Summary of the invention
[0003] In view of this, the present invention provides a method for assisting in quickly locating software problems, comprising:
[0004] Step 1, construct a structure tree of the software code, the structure tree includes module nodes, file name nodes, class nodes, function nodes, and stores dependencies between codes;
[0005] Step 2: Track the software code modification submission record, mark the association between the modification submission record and the corresponding code structure tree node, and for each code modification submission record, calculate its correlation score with the software problem;
[0006] Step 3, obtain a list of software problems, including the occurrence time, problem description, and information about the module in which the problem is located; locate the relevant area in the code structure tree according to the module information of the software problem;
[0007] Step 4: Filter out the code modification submission records in the area during the time period when the software problem occurred, gradually roll back the code submissions in the modification records, and use automated scripts to verify the occurrence of software problems; for each software problem, calculate the similarity score between its problem description vector and the description vectors of each case in the historical problem case library, so as to accelerate the analysis and location of new problems;
[0008] Step 5, when the software problem disappears, record the corresponding code modification submission record and determine the problem-related code; in the problem-related code, continue to quickly locate the specific problem function; after fixing the problem code, use the automated script to re-verify the disappearance of the software problem; based on the verification results, automatically close the software problem ticket.
[0009] In particular, the code structure tree is automatically constructed by parsing the reference relationship in the code, and for the code that needs to be compiled, the reference relationship of the modules in the code is obtained through compilation.
[0010] In particular, the code modification submission record includes submission time, submitter, modification content and modification file; and for each code modification submission record, its correlation score CS(P, C) with the software problem is calculated, and the formula is as follows:
[0011]
[0012] Where P = (P 1 , P 2 , ..., P n ) is a weighted vector representing the area that the software problem may involve;
[0013] C=(C 1 , C 2 , ..., C n ) is a weighted vector representing the modified area corresponding to the code modification submission record;
[0014] w P and w C are the weight coefficients of P and C vectors respectively; N P and N C are the weights of each component of P and C respectively; filter out the code modification submission records with the highest CS(P,C) values and give priority to verifying and locating software problems.
[0015] In particular, the software problem information also includes the first occurrence time, severity, priority, and function; and for each software problem, calculate its problem description vector and the description vector of each case in the historical problem case library And calculate the similarity score between the two The formula is as follows:.
[0016]
[0017] Among them, u=(u 1 ,u 2 , ..., u n ) is the keyword vector of the problem to be located; v = (v 1 , v 2, ..., v n ) is the keyword vector of the historical problem case; w i is the weight of each word i; f i,j is the frequency of word i in case j; l is the normalization parameter; according to Sort the scores from high to low, find the cases most relevant to the new problem from the historical case library, and learn from their analysis ideas and solutions to accelerate the analysis and positioning of the new problem.
[0018] In particular, the automation script includes steps for replicating a software problem.
[0019] In particular, the automation script automatically runs software functions by simulating user operations.
[0020] In particular, the steps of gradually rolling back modification records and verifying the occurrence of problems are recursively executed until the problem-related code is determined.
[0021] In particular, the problem-related code is matched according to the regular expression.
[0022] Specifically, this includes revalidation of software issues that were automatically closed to ensure that the issue has disappeared.
[0023] Beneficial effects:
[0024] By constructing a code structure tree and tracking association with modification records through the technical solution of the present invention, automatic identification and positioning of codes related to software problems are achieved.
[0025] By adopting the automated test script through the technical solution of the present invention, automatic verification of the occurrence and disappearance of problems is achieved, thus avoiding the complexity of manual confirmation.
[0026] By adopting the gradual rollback positioning method through the technical solution of the present invention, the scope of problem-related codes can be effectively narrowed, thereby improving positioning efficiency.
[0027] The technical solution of the present invention can quickly locate the specific problem function, greatly reducing the workload of manual root cause analysis.
[0028] The technical solution of the present invention realizes a fully automatic closed-loop process from software problem location to automatic verification, and the whole process has a high degree of automation.
[0029] The technical solution of the present invention can significantly reduce the manual participation in code location and testing, and improve the efficiency of software defect management.
[0030] The technical solution of the present invention realizes automatic closing after problem repair verification, ensuring that each software problem ticket is responded to and resolved.
[0031] By combining the technical solution of the present invention with code structure and static and dynamic analysis techniques, in-depth positioning and analysis of software problems are achieved.
[0032] The technical solution of the present invention greatly shortens the period from problem occurrence to repair, effectively improving software quality and user satisfaction. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 The present invention proposes an overall flow chart of a method for assisting in quickly locating software problems. DETAILED DESCRIPTION
[0034] The present invention is described in detail below with reference to the accompanying drawings and embodiments.
[0035] The technical solution of the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments:
[0036] The present invention proposes a method for assisting in quickly locating software problems. Figure 1 The overall flow chart of the present invention is shown. Figure 1 As shown, the present invention comprises the following steps:
[0037] Step 1: Construct a structure tree of the software code. By parsing the module definition, class definition, function definition and file inclusion relationship in the code, a structure tree of the code file is constructed. The structure tree includes module nodes, file name nodes, class nodes and function nodes, and stores the dependencies between the codes.
[0038] Download the entire software code base to obtain the code baseline. Use the code parsing tool to parse the module definition statements in the code and extract all module names.
[0039] Parse the class definition statement, extract the class name, the methods contained, the file where it is located, the parent class and other information, parse the function definition statement, extract the function name, the file where it is located, the input and output parameters and other information. According to the file inclusion relationship, determine the corresponding relationship between the file name and the contained class and function. Organize the module name, class information, function information and file name information extracted above into a structure tree with code dependency as the pointer. The structure tree includes multiple types of nodes such as module nodes, file name nodes, class nodes and function nodes. Through the pointing relationship between the nodes, the logical structure and dependency of the code file are stored. The constructed code structure tree is stored in the database for incremental update and query. The code structure tree is automatically constructed by parsing the reference relationship in the code. For the code that needs to be compiled, the reference relationship of the module in the code is obtained by compiling.
[0040] Step 2, track the modification submission records of the software code. Receive the submission records of the code repository, and mark the association between each submission record and the corresponding code structure tree node of the modification. The submission record includes the submission time, submitter, modification content and modified file. Receive the submission record generated by each code submission in the code repository, and the submission record contains information such as the submission time, submitter, and the list of changed files submitted this time. The code modification submission record includes the submission time, submitter, modification content and modified file; and, for each code modification submission record, calculate its correlation score CS(P, C) with the software problem, the formula is as follows:
[0041]
[0042] Where P = (P 1 , P 2 , ..., P n ) is a weighted vector representing the area that the software problem may involve;
[0043] C=(C 1 , C 2 , ..., C n ) is a weighted vector representing the modified area corresponding to the code modification submission record;
[0044] w P and w C are the weight coefficients of P and C vectors respectively; N P and N C are the weights of each component of P and C respectively; filter out the code modification submission records with the highest CS(P,C) values and give priority to verifying and locating software problems.
[0045] Analyze the submitted change file list one by one, extract the specific code content of this submission and modification, and obtain the code change points submitted this time by comparing the file diff.
[0046] Associate the submitted code change point with the corresponding node in the code structure tree. For example, if the Changed function belongs to the FileA file, then associate this submission with the FileA file name node and the Changed function node.
[0047] Continue to traverse and process the code change points of all files, and complete the association mark between this submission record and the code structure tree node.
[0048] At the same time, if a code change point adds or deletes a class, function, etc., the node content of the code structure tree needs to be updated synchronously.
[0049] Store all code submission records and their association with the code structure tree in the database for subsequent use in locating code submissions.
[0050] Step 3. Get the software problem list, traverse the code submission records, and filter the classes, files, and modules involved in the code submissions during the two release compilation time periods. Add version and time period information, and record the historical modification time and version information of all files. After all information is classified, screened, and filtered, it is stored in the software problem list. The software problem includes information such as the time of occurrence, problem description, module, severity, priority, etc. The software problem information also includes the first occurrence time, severity, priority, and function; and for each software problem, calculate its problem description vector and the description vector of each case in the historical problem case library And calculate the similarity score between the two The formula is as follows:
[0051] Among them, u=(u 1 ,u 2 , ..., u n ) is the keyword vector of the problem to be located; v = (v 1 , v 2 , ..., v n ) is the keyword vector of the historical problem case; w i is the weight of each word i; f i,j is the frequency of word i in case j; l is the normalization parameter; according to Sort the scores from high to low, find the cases most relevant to the new problem from the historical case library, and learn from their analysis ideas and solutions to accelerate the analysis and positioning of the new problem.
[0052] Step 4: Filter out the code modification submission records in the area during the time period when the software problem occurred, gradually roll back the code submissions in the modification records, and use automated scripts to verify the occurrence of software problems; for each software problem, calculate the similarity score between its problem description vector and the description vectors of each case in the historical problem case library, so as to accelerate the analysis and location of new problems; first locate the relevant area in the code structure tree based on the module information of the software problem. Search for the node area that matches the software problem module in the structure tree. Extract the names of the relevant functional modules mentioned in the problem description from the software problem sheet. Search for the module node that matches the module name in the code structure tree.
[0053] Starting from the matched module node, the code area related to the module function is determined through the parent-child node pointing relationship of the code structure tree.
[0054] The relevant area includes the parent module node traversed upwards, and the child modules, file names, classes, and function nodes traversed downwards. If the relevant module is not explicitly mentioned in the software issue ticket, the relevant module or code area can be determined based on the functional points, operation flow, and other information in the problem description, and the located code area related to the software problem can be recorded, including the module, file name, class, and function node information in the area.
[0055] Filter out relevant code modification records. In the code area located in step 4, filter out the code modification submission records within the time period when the software problem occurred. Obtain the time range when the problem first occurred based on the software issue ticket, such as ±1 day from the first report time. In the code area related to the software problem that has been located in step 4, filter out the code submission records whose modification time falls within the above-mentioned problem occurrence time range. Since multiple submission records may contain modifications to the same code, the modification records need to be deduplicated in order of submission time. If the number of modification records is still relatively large after filtering based on the first occurrence time range, the scope can be further narrowed based on the code execution process. If necessary, the problem-related code can be matched based on regular expressions.
[0056] For problems involving the UI, you can analyze the code flow triggered by the problem based on the logs and locate the relevant code entry. For logical problems, you can use static analysis to locate the relevant code range using the key variables of the problem as the entry point. After the above multi-dimensional analysis and screening, determine the code modification records directly related to the software problem.
[0057] Roll back the modification records step by step to verify the problem. Select the modification records obtained in step 4, and gradually roll back the code submissions starting from the latest one. On each submitted version, use the automated script to run the software and try to reproduce the software problem. Select the modification submission records filtered in step 4, and sort them from the latest one according to the submission time. In the version control system, gradually roll back to the code version corresponding to each submission. The steps of gradually rolling back the modification records and verifying the problem are recursively executed until the problem-related code is determined.
[0058] On each version, use automated test scripts to run software functions and try to reproduce related software problems. Automated test scripts must include detailed operation steps and be able to accurately reproduce the software problem repeatedly. If a version can reproduce the problem, but the previous version does not have the problem, record this version number.
[0059] Step 5: When the software problem disappears, record the corresponding code modification submission record and determine the problem-related code; in the problem-related code, continue to quickly locate the specific problem function; after fixing the problem code, use the automated script to re-verify the disappearance of the software problem; based on the verification results, automatically close the software problem ticket. First, record the problem-related code. When the software problem disappears on a certain version, record the code difference between this version and the previous version to determine the code modification related to the software problem.
[0060] Diff the version in which the software problem disappears recorded in step 5 with the previous version to extract the code changes between the two versions. The code changes between the two versions are the modification submission records directly related to the software problem. Record the specific changed functions, changed classes, and other information in this code modification record.
[0061] Quickly locate the specific problem function. In the problem-related code, quickly identify the specific function that caused the software problem through code execution analysis and other methods. Load the extracted problem-related code modification information to locate the specific modified functions, classes, methods and other code units. Through code execution path analysis, statement coverage analysis and other methods, quickly identify the specific code location that is most likely to cause the problem. For suspicious code, inject logs and breakpoints, and further narrow the scope of the problem code through multiple runs of automated testing. Finally, identify the specific code function that caused the software problem.
[0062] Repair the problem code. Repair the code of the corresponding problem function. According to the positioning results of the previous step, repair the problem function code. The repair method may include modifying the code logic, exception handling, parameter verification, etc. After the repair, a new version of the problem function code is generated.
[0063] Automatically verify that the problem has disappeared, and use the automated script to re-run the software on the repaired version to verify whether the software problem has been solved. Run the relevant automated test script again on the repaired new code version for verification. 2) Confirm whether the software problem reappears in the test script. 3) Repeat multiple runs to verify the consistency of the test results. 4) If the problem has disappeared, record the test pass result.
[0064] Close the software issue. If the verification is passed, the corresponding software issue ticket will be automatically closed, completing the entire process.
[0065] In summary, the above are only preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
[0066] It is obvious to those skilled in the art that the embodiments of the present invention are not limited to the details of the above exemplary embodiments, and that the embodiments of the present invention can be implemented in other specific forms without departing from the spirit or basic features of the embodiments of the present invention. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the embodiments of the present invention is limited by the attached claims rather than the above description, so it is intended to include all changes that fall within the meaning and scope of the equivalent elements of the claims in the embodiments of the present invention. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units, modules or devices stated in the system, device or terminal claims can also be implemented by the same unit, module or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.
[0067] Finally, it should be noted that the above implementation modes are only used to illustrate the technical solutions of the embodiments of the present invention and are not intended to limit them. Although the embodiments of the present invention have been described in detail with reference to the above preferred implementation modes, those skilled in the art should understand that the technical solutions of the embodiments of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for assisting in quickly locating software problems, characterized in that: include: Step 1, construct a structure tree of the software code, the structure tree includes module nodes, file name nodes, class nodes, function nodes, and stores dependencies between codes; Step 2: Track the software code modification submission record, mark the association between the modification submission record and the corresponding code structure tree node, and for each code modification submission record, calculate its correlation score with the software problem; Step 3, obtain a list of software problems, including the occurrence time, problem description, and information about the module in which the problem is located; Locate the relevant area in the code structure tree based on the module information of the software problem; Step 4: Filter out the code modification submission records in the area during the time period when the software problem occurred, gradually roll back the code submissions in the modification records, and use automated scripts to verify the occurrence of the software problem; For each software problem, the similarity score between its problem description vector and the description vectors of each case in the historical problem case library is calculated to accelerate the analysis and location of new problems. Step 5: When the software problem disappears, record the corresponding code modification submission record and determine the problem-related code; Continue to quickly locate specific problem functions within the problem-related code; after fixing the problem code, use automated scripts to re-verify that the software problem has disappeared; based on the verification results, automatically close the software problem ticket.
2. The method according to claim 1, characterized in that The code structure tree is automatically constructed by parsing the reference relationship in the code. For the code that needs to be compiled, the reference relationship of the modules in the code is obtained through compilation.
3. The method according to claim 1, characterized in that The code modification submission record includes submission time, submitter, modification content and modification file; and for each code modification submission record, the correlation score CS(P, C) with the software problem is calculated, and the formula is as follows: Where P = (P1, P2, ..., P n ) is a weighted vector representing the area that the software problem may involve; C = (C1, C2, ..., C n ) is a weighted vector representing the modified area corresponding to the code modification submission record; w P and w C are the weight coefficients of P and C vectors respectively; N P and N C are the weights of each component of P and C respectively; filter out the code modification submission records with the highest CS(P,C) values and give priority to verifying and locating software problems.
4. The method according to claim 1, characterized in that The software problem information also includes the first occurrence time, severity, priority, and function; and for each software problem, calculate its problem description vector and the description vector of each case in the historical problem case library And calculate the similarity score between the two The formula is as follows:. Among them, u=(u1,u2,...,u n ) is the keyword vector of the problem to be located; v = (v1, v2, ..., v n ) is the keyword vector of the historical problem case; w i is the weight of each word i; f i,j is the frequency of word i in case j; l is the normalization parameter; according to Sort the scores from high to low, find the cases most relevant to the new problem from the historical case library, and learn from their analysis ideas and solutions to accelerate the analysis and positioning of the new problem.
5. The method according to claim 1, characterized in that The automation script includes steps for replicating a software problem.
6. The method according to claim 5, characterized in that The automation script automatically runs software functions by simulating user operations.
7. The method according to claim 1, characterized in that The steps of gradually rolling back the modification records and verifying the occurrence of the problem are recursively executed until the problem-related code is determined.
8. The method according to claim 1, characterized in that Match the problem-related codes according to the regular expression.
9. The method according to claim 1, characterized in that This also includes revalidation of software issues that were automatically closed to ensure that the issue has disappeared.
Citation Information
Cited By
Database test case generation method and device, server and storage medium
CN120196555A
Database test case generation method, device, server and storage medium
CN120196555B
