A method for enhancing fault location performance using a PageRank algorithm
Patent Information
- Application Number
- CN202211258448.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-14
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2042-10-14
AI Technical Summary
[0004]本发明目的在于提供一种利用PageRank算法增强故障定位性能的方法,解决目前存在的基于变异的故障定位方法不能满足精确故障定位的问题,进而降低软件故障定位的查找成本,提高软件故障定位的准确性,从而更好地为开发人员进行软件调试提供帮助
[0089] This invention utilizes the PageRank algorithm to enhance the performance of fault location, significantly improving the quantity and accuracy of software fault location. It employs mutation analysis technology to generate initial suspicious values for statements, uses the PageRank algorithm to calculate the defect scores of statements, and uses the defect scores to weight the initial suspicious values of statements, thus solving the statement binding problem in traditional fault location methods. This simultaneously improves both the quantity and accuracy of fault location, further enhancing the efficiency of software testing.
Smart Images

Figure CN116244170B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of software testing technology, and in particular relates to a method for enhancing fault location performance using the PageRank algorithm. Background Technology
[0002] Software testing is a crucial stage in the software development process, improving product quality and better meeting user needs. Software fault location, an intermediate step in software testing, refers to locating the elements in the program that cause execution failure, allowing developers to determine the cause and fix the fault. Accurate software fault location is costly due to the large number of program elements and potential causes of failure. Early fault location relied primarily on manual searching, with developers using experience to insert breakpoints or print logs to locate potential sources of failure. In recent years, as software has grown in scale and functionality, traditional manual fault location methods have become increasingly time-consuming and labor-intensive. Therefore, many researchers are now dedicated to exploring efficient semi-automated or automated software fault location techniques.
[0003] Currently, relatively mature software fault localization technologies include spectrum-based fault localization, mutation-based fault localization, and machine learning-based fault localization. Among them, mutation-based fault localization (MBFL) performs well in locating both artificial and real-world faults, accurately pinpointing the location of the fault and assisting developers. MBFL utilizes mutation testing to measure the impact of program elements on execution results. By comparing the behavioral differences before and after mutation, it distinguishes faulty statements from normal statements, thus more effectively detecting the fault location. However, traditional mutation-based fault localization techniques suffer from limitations in their methodology, such as the problem of binding multiple statements with the same suspicious value, which seriously hinders developers' fault localization efforts. Especially when performing fault localization on large-scale software, traditional mutation-based fault localization techniques can no longer meet the needs of testers and developers. Summary of the Invention
[0004] The purpose of this invention is to provide a method for enhancing fault location performance using the PageRank algorithm, which solves the problem that existing mutation-based fault location methods cannot meet the requirements for accurate fault location, thereby reducing the search cost of software fault location, improving the accuracy of software fault location, and thus better assisting developers in software debugging.
[0005] To achieve the above objectives, this invention proposes a method for enhancing fault location performance using the PageRank algorithm. The method includes the following steps:
[0006] 1) Collection of program statement coverage information and test case execution results: Run the test suite on the program to collect coverage information for each program method and the results of test case execution. Based on the test case execution results, divide the test cases into two sets: the set of passed test cases T. p and the set of failed test cases T f ;
[0007] 2) Generation of suspected mutant values: The mutation operator in the PIT tool is used to mutate the program, generating mutants and mutation reports. Based on the execution results of test cases on the mutants, the test cases are divided into two sets: the set T of test cases that kill the mutants. k and the set of test cases T that did not kill the mutants n The following four calculated parameters are generated using the set of test cases:
[0008] a np =|T n ∩T p |
[0009] a kp =|T k ∩T p |
[0010] a nf =|T n ∩T f |
[0011] a kf =|T k ∩T f |
[0012] In the formula a np a represents the number of test cases that passed without killing the mutant. kp a represents the number of test cases that passed and killed the mutant. nf a represents the number of test cases that failed and did not kill the mutant. kf This represents the number of test cases that failed and killed the mutant. Then, the suspicion value of the mutant is calculated using the Ochiai formula from spectrum-based fault location techniques, as follows:
[0013]
[0014] In the formula, Susp(m) represents the suspected value of the variant;
[0015] 3) Generation of initial suspicious value for the statement: The initial suspicious value of the statement is calculated using the suspicious value of the variant generated in step 2) and the Metallaxis method. The calculation formula is as follows:
[0016] Susp_Metallaxis(e i )=Max(Susp(m1),Susp(m2),…,Susp(mk))
[0017] In the formula, Susp_Metallaxis(e i ) represents the statement e i The initial suspicious value;
[0018] 4) Construction of the test case coverage graph: Using the program statement coverage information collected in step 1), a coverage graph between test cases and methods is constructed. The coverage graph G = (V, E) represents the coverage relationship between test cases and program statements and consists of r nodes;
[0019] 5) Generation of the transition matrix: The coverage graph generated in step 4) is used to convert the transition matrix P of test cases and program statements. r×r The element P in the matrix ij This represents the probability that node j is connected to node i;
[0020] 6) Generation of statement defect scores: Using the transition matrix generated in step 5) and the PageRank algorithm, the statement defect score is calculated. This score represents the correlation between the statement and the test case execution failure. The calculation formula is as follows:
[0021]
[0022] Vector in the formula The defect score represents the statement, k represents the number of iterations, P represents the transition matrix, and the damping coefficient d = 0.7. (Vector) The transpose matrix represents the number of nodes in the covered graph. The vector initial value is set to
[0023] 7) Generation of weighted suspicious value for statements: The weighted suspicious value is calculated using the initial suspicious value and defect score of the statements generated in steps 3) and 6). The calculation formula is as follows:
[0024] Susp_weighted(e i =Susp_Metallaxis(e i )+Fei
[0025] In the formula Susp_weighted(e i ) represents the weighted suspicious value of the statement, Susp_Metallaxis(e i ) represents the initial suspicious value of the statement calculated in step 3), and Fei represents the vector generated in step 6). Chinese statement ei Defect rating;
[0026] 8) Generation of the statement sorting list: Sort the weighted suspicious values of the statements generated in step 7) in descending order, and provide the sorted list of statements to the developers for fault location.
[0027] Furthermore, the specific steps of step 1) above are as follows:
[0028] Step 1)-1: Initial state;
[0029] Steps 1)-2: Execute the test case set in the program;
[0030] Steps 1)-3: Use the Gzoltar tool to collect the coverage information of program statements and the execution results of test cases;
[0031] Steps 1)-4: Store the statement coverage information and test case execution results into the spectrum matrix. "1" indicates that the statement is covered by the corresponding test case, and "0" indicates that the statement is not covered.
[0032] Steps 1)-5: Divide the test cases into two sets based on their execution results: the set of test cases that passed, T. p and the set of failed test cases T f ;
[0033] Steps 1)-6: The collection of program statement coverage information and test case execution results is complete;
[0034] Furthermore, the specific steps of step 2) above are as follows:
[0035] Step 2)-1: Initial state;
[0036] Step 2)-2: Use the mutation operator in the PIT tool to mutate the program and generate mutants;
[0037] Steps 2)-3: Re-execute the test suite on the mutant to generate a mutation report;
[0038] Steps 2)-4: Based on the mutation report, analyze the execution results of the test cases on the mutants, and divide the test cases into two sets according to the execution results: the set T of test cases that kill the mutants. k and the set of test cases T that did not kill the mutants n ;
[0039] Step 2)-5: Using the test case sets from Step 1)-5 and Step 2)-4, generate the following four parameters for calculating the variant:
[0040] a np =|T n ∩Tp |
[0041] a kp =|T k ∩T p |
[0042] a nf =|T n ∩T f |
[0043] a kf =|T k ∩T f |
[0044] In the formula a np a represents the number of test cases that passed without killing the mutant. kp a represents the number of test cases that passed and killed the mutant. nf a represents the number of test cases that failed and did not kill the mutant. kf This indicates the number of test cases that failed and killed the mutant.
[0045] Steps 2)-6: Calculate the suspicious value of the variant using the Ochiai formula in spectrum-based fault location technology and the parameters from Step 2)-5. The calculation formula is as follows:
[0046]
[0047] In the formula, Susp(m) represents the suspected value of the variant;
[0048] Steps 2)-7: The calculation of the suspicious values of the variants is complete;
[0049] Furthermore, the specific steps of step 3) above are as follows:
[0050] Step 3)-1: Initial state;
[0051] Step 3)-2: Calculate the initial suspicious value of the statement using the calculation formula of the Metallaxis method and the variant suspicious value generated in Step 2). The calculation formula is as follows:
[0052] Susp_Metallaxis(e i )=Max(Susp(m1),Susp(m2),…,Susp(mk))
[0053] In the formula, Susp_Metallaxis(e i ) represents the statement e i The initial suspicious value;
[0054] Step 3)-3: Sort the statements in descending order based on the initial suspicious values and output them in a list;
[0055] Steps 3)-4: The initial suspicious values for the statement have been generated;
[0056] Furthermore, the specific steps of step 4) above are as follows:
[0057] Step 4)-1: Initial state;
[0058] Step 4)-2: Simulate the test cases and statements as nodes to construct a coverage graph G = (V, E), consisting of r nodes;
[0059] Step 4)-3: Based on the spectrum matrix generated in step 1), if the coverage information is 1, then construct a bidirectional edge between the statement and the test case;
[0060] Step 4)-4: The test case coverage diagram is complete;
[0061] Furthermore, the specific steps of step 5) above are as follows:
[0062] Step 5)-1: Initial state;
[0063] Step 5)-2: Analyze the test case coverage graph G = (V, E) generated in step 4);
[0064] Step 5)-3: Calculate the transition probability between test case node j and statement node i in the coverage diagram. The calculation formula is as follows:
[0065]
[0066] In the formula P ij This represents the probability that node j points to node i, and Out Bound Link Number of Node j represents the out-degree of node j;
[0067] Step 5)-4: Generate the transition matrix P using the transition probabilities generated in Step 5)-3. r×r ;
[0068] Step 5)-5: The transition matrix has been generated.
[0069] Furthermore, the specific steps of step 6) above are as follows:
[0070] Step 6)-1: Initial state;
[0071] Step 6)-2: Calculate the defect score of the statement using the transition matrix generated in Step 5) and the PageRank algorithm. This score represents the correlation between the statement and the test case execution failure. The calculation formula is as follows:
[0072]
[0073] Vector in the formula The vector represents the defect score of the statement, k represents the number of iterations, P represents the transition matrix, the damping coefficient d = 0.7, and the vector. The transpose matrix represents the number of nodes in the covered graph. The vector initial value is set to
[0074] Step 6)-3: Output the defect score of the statement to the initial suspicious value sorting list generated in step 3) for subsequent operations;
[0075] Step 6)-4: The defect score for the statement has been generated.
[0076] Furthermore, the specific steps of step 7) above are as follows:
[0077] Step 7)-1: Initial state;
[0078] Step 7)-2: Calculate the weighted suspicion value using the initial suspicion value and defect score of the statements generated in Steps 3) and 6). The calculation formula is as follows:
[0079] Susp_weighted(e i =Susp_Metallaxis(e i )+Fei
[0080] In the formula Susp_weighted(e i ) represents the weighted suspicious value of the statement, Susp_Metallaxis(e i ) represents the initial suspicious value of the statement calculated in step 3), and Fei represents the vector generated in step 6). Chinese statement e i Defect rating;
[0081] Step 7)-3: Output the weighted suspicious values of the statement in a list;
[0082] Step 7)-4: The weighted suspicious value of the statement has been generated;
[0083] Furthermore, the specific steps of step 8) above are as follows:
[0084] Step 8)-1: Initial state;
[0085] Step 8)-2: Sort the statements generated in step 7) in descending order of weighted suspicious values and update the sort list;
[0086] Step 8)-3: Provide the developers with a list of weighted suspicious values for the statements, sorted in descending order;
[0087] Step 8)-4: Developers search for faults in the list one by one to locate the faults;
[0088] Step 8)-5: The statement sorting list has been generated.
[0089] This invention utilizes the PageRank algorithm to enhance the performance of fault location, significantly improving the quantity and accuracy of software fault location. It employs mutation analysis technology to generate initial suspicious values for statements, uses the PageRank algorithm to calculate the defect scores of statements, and uses the defect scores to weight the initial suspicious values of statements, thus solving the statement binding problem in traditional fault location methods. This simultaneously improves both the quantity and accuracy of fault location, further enhancing the efficiency of software testing. Attached Figure Description
[0090] Figure 1 This is a flowchart illustrating a method for enhancing fault location performance using the PageRank algorithm, according to an embodiment of the present invention.
[0091] Figure 2 for Figure 1 A flowchart for collecting program statement coverage information and test case execution results.
[0092] Figure 3 for Figure 1 A flowchart for generating suspicious values for variants.
[0093] Figure 4 for Figure 1 A flowchart for generating initial suspicious values in Chinese statements.
[0094] Figure 5 for Figure 1 The flowchart for constructing the test case coverage graph.
[0095] Figure 6 for Figure 1 The flowchart for generating the transition matrix.
[0096] Figure 7 for Figure 1 A flowchart for generating sentence defect scores.
[0097] Figure 8 for Figure 1 A flowchart for generating weighted suspicious values in Chinese statements.
[0098] Figure 9 for Figure 1 A flowchart for generating a sorted list of statements. Detailed Implementation
[0099] To better understand the technical content of the present invention, specific embodiments are described below in conjunction with the accompanying drawings.
[0100] Figure 1 This is a flowchart illustrating a method for enhancing fault location performance using the PageRank algorithm, according to an embodiment of the present invention.
[0101] A method for enhancing fault location performance using the PageRank algorithm includes the following steps:
[0102] Step 1 involves collecting program statement coverage information and test case execution results. The test suite is run on the program to collect coverage information for each program method and the results of test case execution. Based on the test case execution results, the test cases are divided into two sets: the set of passed test cases T. p and the set of failed test cases T f ;
[0103] Step 2: Generating Mutant Suspicious Values. Utilize the mutation operator in the PIT tool to mutate the program, generating mutants and mutation reports. Based on the execution results of test cases on the mutants, divide the test cases into two sets: a set T of test cases that kill the mutants. k and the set of test cases T that did not kill the mutants n The following four calculated parameters are generated using the set of test cases: a np a represents the number of test cases that passed without killing the mutant. kp a represents the number of test cases that passed and killed the mutant. nf a represents the number of test cases that failed and did not kill the mutant. kf This represents the number of test cases that failed and killed the mutant. Then, the suspicion value of the mutant is calculated using the Ochiai formula in spectrum-based fault location techniques.
[0104] Step 3: Generation of initial suspicious values for statements. The initial suspicious values for statements are calculated using the suspicious values of variants and the Metallaxis method.
[0105] Step 4: Constructing the test case coverage graph. Using the collected program statement coverage information, construct a coverage graph between test cases and methods. The coverage graph G = (V, E) represents the coverage relationship between test cases and program statements, and consists of r nodes.
[0106] Step 5: Generation of the transition matrix. The test case coverage diagram is transformed into a transition matrix P between test cases and program statements. r×r The element P in the matrix ij This represents the probability that node j is connected to node i;
[0107] Step 6: Generation of Statement Defect Scores. The defect score for each statement is calculated using the transition matrix and the PageRank algorithm. This score represents the correlation between the statement and the test case execution failure. The statement defect score is represented as a vector. The vector initial value is set to
[0108] Step 7: Generation of weighted suspicious value for statement. The weighted suspicious value is calculated using the initial suspicious value of the statement and the defect score.
[0109] Step 8 generates a sorted list of statements. The generated statements are sorted in descending order by their weighted suspicious values, and the sorted list of statements is provided to developers for fault location.
[0110] Figure 2 This is a flowchart for collecting program statement coverage information and test case execution results. A test suite is run on the program to collect coverage information for each program method and the results of test case execution. Based on the test case execution results, the test cases are divided into two sets: the set T of passed test cases. p and the set of failed test cases T f The specific steps are as follows:
[0111] Step 1: Initial state; Step 2: Execute the test case set in the program; Step 3: Use the Gzoltar tool to collect the statement coverage information and test case execution results; Step 4: Store the statement coverage information and test case execution results in a spectrum matrix, where "1" indicates that the statement is covered by the corresponding test case, and "0" indicates that the statement is not covered; Step 5: Divide the test cases into two sets based on the test case execution results: the set of passed test cases T. p and the set of failed test cases T f Step 6: The collection of program statement coverage information and test case execution results is complete.
[0112] Figure 3 This document presents a flowchart for generating suspicious mutant values. It utilizes the mutation operator in the PIT tool to mutate the program, generating mutants and mutation reports. Based on the execution results of test cases on the mutants, the test cases are divided into two sets: a set T of test cases that kill the mutants. k and the set of test cases T that did not kill the mutants n The following four calculated parameters are generated using the set of test cases: a np a represents the number of test cases that passed without killing the mutant. kp a represents the number of test cases that passed and killed the mutant. nf a represents the number of test cases that failed and did not kill the mutant.kf This represents the number of test cases that failed and killed the mutant. Then, the suspicion value of the mutant is calculated using the Ochiai formula in spectrum-based fault location techniques. The specific steps are as follows:
[0113] Step 1: Initial state; Step 2: Use the mutation operator in the PIT tool to mutate the program and generate mutants; Step 3: Re-execute the test suite on the mutants to generate a mutation report; Step 4: Based on the mutation report, analyze the execution results of the test cases on the mutants, and divide the test cases into two sets based on the execution results: the set T of test cases that kill the mutants. k and the set of test cases T that did not kill the mutants n Step 5: Use the test case set to generate the following four parameters for calculating the variant: a np a represents the number of test cases that passed without killing the mutant. kp a represents the number of test cases that passed and killed the mutant. nf a represents the number of test cases that failed and did not kill the mutant. kf Step 6: Calculate the suspicious value of the mutant using the Ochiai formula and parameters in spectrum-based fault location technology; Step 7: The suspicious value of the mutant is calculated.
[0114] Figure 4 A flowchart for generating initial suspicious values for a statement. The initial suspicious values for a statement are calculated using the suspicious values of variants and the Metallaxis method. The specific steps are as follows:
[0115] Step 1: Initial state; Step 2: Calculate the initial suspicious value of the statement using the calculation formula of the Metallaxis method and the suspicious value of the variant; Step 3: Sort the statements in descending order according to the initial suspicious value and output them in a list; Step 4: The initial suspicious value of the statement is generated.
[0116] Figure 5 This is a flowchart for constructing a test case coverage graph. The coverage graph between test cases and methods is constructed using the collected program statement coverage information. The coverage graph G = (V, E) represents the coverage relationship between test cases and program statements and consists of r nodes. The specific steps are as follows:
[0117] Step 1: Initial state; Step 2: Simulate test cases and statements as nodes to construct a coverage graph G = (V, E), consisting of r nodes; Step 3: Based on the spectrum matrix, if the coverage information is 1, construct a bidirectional edge between the statement and the test case; Step 4: The test case coverage graph is now complete.
[0118] Figure 6This is a flowchart for generating the transition matrix. The test case coverage diagram is transformed into a transition matrix P between test cases and program statements. r×r The element P in the matrix ij This represents the probability that node j is connected to node i. The specific steps are as follows:
[0119] Step 1: Initial state; Step 2: Analyze the test case coverage graph G = (V, E); Step 3: Calculate the transition probability P between test case node j and statement node i in the coverage graph. ij Step 4: Generate the transition matrix P using the generated transition probabilities. r×r Step 5: The transition matrix has been generated.
[0120] Figure 7 A flowchart for generating statement defect scores. The defect score for each statement is calculated using the transition matrix and the PageRank algorithm. This score represents the correlation between the statement and the test case execution failure. The statement defect score is represented as a vector. The vector initial value is set to The specific steps are as follows:
[0121] Step 1: Initial state; Step 2: Calculate the defect score of the statement using the transition matrix and PageRank algorithm. This score represents the correlation between the statement and the test case execution failure, expressed as a vector. This indicates the defect score of the statement. The vector initial value is set to Step 3: Output the defect score of the statement in the initial suspicious value sorting list for subsequent operations; Step 4: The defect score of the statement is generated.
[0122] Figure 8 A flowchart for generating weighted suspicion values for statements. The weighted suspicion value is calculated using the initial suspicion value and defect score of the statement. The specific steps are as follows:
[0123] Step 1: Initial state; Step 2: Calculate the weighted suspicion value Susp_weighted(e) using the initial suspicion value and defect score of the statement. i Step 3: Output the weighted suspicious values of the statement in the list; Step 4: The weighted suspicious values of the statement are generated.
[0124] Figure 9 The flowchart illustrates the generation of the statement sorting list. The generated statements are sorted in descending order by their weighted suspicious values, and the sorted list is provided to developers for fault localization. The specific steps are as follows:
[0125] Step 1: Initial state; Step 2: Sort the generated statements in descending order of weighted suspicious values and update the sorting list; Step 3: Provide the list of statements sorted in descending order of weighted suspicious values to the developers; Step 4: Developers search for faults in the list one by one to locate the faults; Step 5: The statement sorting list is generated.
[0126] In summary, this invention solves the statement binding problem in traditional fault location methods, which not only significantly improves the accuracy of software fault location, but also enables the location of more software faults, improves the accuracy of software testing, and better meets customer needs.
Claims
1. A method for enhancing fault location performance using the PageRank algorithm, characterized in that, The PageRank algorithm is used to calculate the correlation between statements and test cases, generating defect scores for the statements. Initial suspicious values of the statements are weighted using mutation analysis, and a list generated from these weighted suspicious values is used for software fault localization. This method includes the following steps: 1) Collection of program statement coverage information and test case execution results: Run the test suite on the program to collect coverage information for each program method and the results of test case execution. Based on the test case execution results, divide the test cases into two sets: the set of passed test cases T. p and the set of failed test cases T f ; 2) Generation of suspected mutant values: The mutation operator in the PIT tool is used to mutate the program, generating mutants and mutation reports. Based on the execution results of the test cases on the mutants, the test cases are divided into two sets: the set T of test cases that kill the mutants. k and the set of test cases T that did not kill the mutants n The following four calculation parameters are generated using the set of test cases: a np =|T n ∩T p | a kp =|T k ∩T p | a nf =|T n ∩T f | a kf =|T k ∩T f | In the formula a np a represents the number of test cases that passed without killing the mutant. kp a represents the number of test cases that passed and killed the mutant. nf a represents the number of test cases that failed and did not kill the mutant. kf This represents the number of test cases that failed and killed the mutant; the suspicion value of the mutant is calculated using the Ochiai formula in spectrum-based fault location techniques, as follows: In the formula, Susp(m) represents the suspected value of the variant; 3) Generation of initial suspicious value for the statement: The initial suspicious value of the statement is calculated using the suspicious value of the variant generated in step 2) and the Metallaxis method. The calculation formula is as follows: Susp_Metallaxis(e i )=Max(Susp(m1),Susp(m2),…,Susp(mk)) In the formula, Susp_Metallaxis(e i ) represents the statement e i The initial suspicious value; 4) Construction of test case coverage graph: Using the program statement coverage information collected in step 1), a coverage graph between test cases and methods is constructed. The coverage graph G = (V, E) represents the coverage relationship between test cases and program statements and consists of r nodes. 5) Generation of the transition matrix: The coverage graph generated in step 4) is used to convert the transition matrix P of test cases and program statements. r×r The element P in the matrix ij This represents the probability that node j is connected to node i; 6) Generation of statement defect scores: Using the transition matrix generated in step 5) and the PageRank algorithm, the statement defect score is calculated. This score represents the correlation between the statement and the test case execution failure. The calculation formula is as follows: Vector in the formula The vector represents the defect score of the statement, k represents the number of iterations, P represents the transition matrix, the damping coefficient d = 0.7, and the vector. The transpose matrix represents the number of nodes in the covered graph. The vector initial value is set to 7) Generation of weighted suspicious value for statements: The weighted suspicious value is calculated using the initial suspicious value and defect score of the statements generated in steps 3) and 6). The calculation formula is as follows: Susp_weighted(e i )=Susp_Metallaxis(e i )+Fei In the formula Susp_weighted(e i ) represents the weighted suspicious value of the statement, Susp_Metallaxis(e i ) represents the initial suspicious value of the statement calculated in step 3), and Fei represents the vector generated in step 6). Chinese statement e i Defect rating; 8) Generation of the statement sorting list: Sort the weighted suspicious values of the statements generated in step 7) in descending order, and provide the sorted list of statements to the developers for fault location.
2. The method for enhancing fault location performance using the PageRank algorithm according to claim 1, characterized in that, In step 1), the program statement coverage information and test case execution results are collected by running the test suite on the program and collecting the coverage information of each program method and the test case execution results. Based on the results of test case execution, the test cases are divided into two sets: the set of test cases that passed, T. p and the set of failed test cases T f .
3. The method for enhancing fault location performance using the PageRank algorithm according to claim 1, characterized in that, In step 2), the generation of suspected mutant values involves using the mutation operator in the PIT tool to mutate the program, generating mutants and mutation reports. Based on the execution results of the test cases on the mutants, the test cases are divided into two sets: a set T of test cases that kill the mutants. k and the set of test cases T that did not kill the mutants n The following four calculated parameters are generated using a set of test cases: a np a represents the number of test cases that passed without killing the mutant. kp a represents the number of test cases that passed and killed the mutant. nf a represents the number of test cases that failed and did not kill the mutant. kf The number of test cases that failed and killed the mutant is indicated; the suspicion value of the mutant is calculated using the Ochiai formula in spectrum-based fault location techniques.
4. The method for enhancing fault location performance using the PageRank algorithm according to claim 1, characterized in that, In step 3), the initial suspicious value of the statement is generated by using the suspicious value of the variant and the Metallaxis method to calculate the initial suspicious value of the statement.
5. The method for enhancing fault location performance using the PageRank algorithm according to claim 1, characterized in that, In step 4), the test case coverage graph is constructed by using program statement coverage information to build a coverage graph between test cases and methods. Test cases and program statements are simulated as nodes in the coverage graph. If a test case covers a statement, a bidirectional edge is constructed between the test case node and the statement node. The coverage graph G = (V, E) represents the coverage relationship between test cases and program statements and consists of r nodes.
6. The method for enhancing fault location performance using the PageRank algorithm according to claim 1, characterized in that, In step 5), the generation of the transition matrix transforms the coverage graph into a transition matrix P of test cases and program statements. r×r ; Element P in the matrix ij This represents the probability that node j is connected to node i.
7. The method for enhancing fault location performance using the PageRank algorithm according to claim 1, characterized in that, In step 6), the statement defect score is generated by calculating the statement defect score using the transition matrix and the PageRank algorithm. This score represents the correlation between the statement and the test case execution failure; vectors are used. This indicates the defect score of the statement. The vector initial value is set to 8. The method for enhancing fault location performance using the PageRank algorithm according to claim 1, characterized in that, In step 7), the weighted suspicious value of the statement is generated by calculating the weighted suspicious value using the initial suspicious value of the statement and the defect score; the Susp_weighted(e i ) indicates the weighted suspicious value of the statement.
9. The method for enhancing fault location performance using the PageRank algorithm according to claim 1, characterized in that, In step 8), the statement sorting list is generated by sorting the weighted suspicious values of the statements in descending order and providing the sorting list of statements to the developers for fault location.
Citation Information
Patent Citations
Software fault location method, device, apparatus, and readable storage medium
CN109254924A
Software defect positioning method based on frequency spectrum and neural network algorithm
CN110515826A