CN111625444A - Method and device for positioning program error based on spectrum method - Google Patents

Method and device for positioning program error based on spectrum method Download PDF

Info

Publication number
CN111625444A
CN111625444A CN202010279143.6A CN202010279143A CN111625444A CN 111625444 A CN111625444 A CN 111625444A CN 202010279143 A CN202010279143 A CN 202010279143A CN 111625444 A CN111625444 A CN 111625444A
Authority
CN
China
Prior art keywords
program
information
code
frequency spectrum
suspicious
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010279143.6A
Other languages
Chinese (zh)
Other versions
CN111625444B (en
Inventor
李梓劼
张震宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Institute of Software of CAS
Original Assignee
Institute of Software of CAS
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Institute of Software of CAS filed Critical Institute of Software of CAS
Priority to CN202010279143.6A priority Critical patent/CN111625444B/en
Publication of CN111625444A publication Critical patent/CN111625444A/en
Application granted granted Critical
Publication of CN111625444B publication Critical patent/CN111625444B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to a method and a device for positioning program errors based on a spectrum method. The method comprises the following steps: collecting code coverage information of an error program to be detected, and extracting a key quadruple needed by a spectrum method from the code coverage information; collecting static information of an error program to be detected; analyzing the collected code coverage information and static information to generate a program frequency spectrum, and inserting a code block representing a code missing position into the program frequency spectrum; calculating the suspicious degree of each code block by using a suspicious degree calculation formula based on a probability model according to the key quadruple, and adjusting the suspicious degree according to the structural information of the program; and performing descending arrangement on the program frequency spectrum according to the size of the suspicious degree to obtain a suspicious position list of the code missing errors. The invention adds code missing sites among code blocks in a program frequency spectrum, and combines with program static information, thereby being capable of positioning code missing errors, controlling a processing flow by using scripts and analyzing data of batch experiments.

Description

Method and device for positioning program error based on spectrum method
Technical Field
The invention is based on a frequency spectrum method widely used in the error positioning field, realizes error positioning of the code missing problem, and belongs to the technical field of software testing.
Background
The software test is a project for positioning and correcting program errors and is a link which consumes most manpower and material resources in the modern software project; error localization is one of the most difficult steps throughout the software testing. In order to improve the efficiency of error localization, researchers have proposed various error localization methods. Among them, the spectrum method based on coverage is one of the most widely used and most efficient methods. The method comprises the following steps of obtaining a test result of each test case in the software unit test process, calculating suspicious values of each program entity according to a probability model by combining coverage information of the program entity in each test case, representing the association degree of error entities and errors, and then performing descending order arrangement according to the numerical value of the suspicious values to provide a suspicious program entity list for program testers. Program entities include classes, functions, basic blocks, statements, constant-value-reference chains, and so on, depending on the granularity. Coverage information, i.e., the behavior of a program entity under a particular test case, and the success or failure of that test case.
Given an erroneous program P, assume P ═ P<S1,S2,S3,...,Sn>The corresponding test case T ═ { T1, T2, …, tm }. Wherein Sn refers to a program entity, and tm refers to a unit test case. In the software testing process, the key quadruple of the program entity, namely the information whether the key quadruple is covered under each success or failure case, can be acquired through instrumentation and recorded as
Figure BDA0002445904200000011
Wherein, for the ith program entity,
Figure BDA0002445904200000012
for the number of times the entity was successfully used for execution,
Figure BDA0002445904200000013
for the number of times the failed use case is executed,
Figure BDA0002445904200000014
for the number of times the use case is not covered,
Figure BDA0002445904200000015
the number of times the case is uncovered for a failure. It is generally believed that the first and second electrodes,
Figure BDA0002445904200000016
the higher is
Figure BDA0002445904200000017
The lower the probability that the corresponding program entity is erroneous. According to various heuristic strategies, researchers can calculate and calculate the suspicious value of each program entity by using the variable to construct an error suspicious degree calculation formula, such as Tarrantula (the algorithm is named by inventor, and Chinese name is temporarily absent), so as to represent the association degree of the statement and the error. And performing descending order arrangement on the suspicious degrees calculated by the calculation to obtain a suspicious statement block ranking table. And searching the position of the error sentence from top to bottom in the ranking table, wherein the ratio of the position to the total number of rows is the efficiency of the error ranking.
There are many error positioning methods based on frequency spectrum, and related research is continuously carried out. However, the spectrum method can only locate errors existing in a program, and a tool for locating code missing errors is not available. In actual Java engineering, the code missing error accounts for a large proportion, so it is valuable to develop an error locating tool that can locate the code missing.
Disclosure of Invention
The technical problems solved by the invention are as follows: the method and the device for positioning the program errors based on the spectrum coverage are provided, the capability of positioning the code missing errors is increased on the basis of the traditional spectrum method, and a corresponding experimental result analysis tool is provided.
The technical scheme adopted by the invention is as follows:
a method for positioning program errors based on a spectrum method comprises the following steps:
collecting code coverage information of an error program to be detected, and extracting a key quadruple needed by a spectrum method from the code coverage information;
collecting static information of an error program to be detected;
analyzing the collected code coverage information and static information to generate a program frequency spectrum, and inserting a code block representing a code missing position into the program frequency spectrum;
calculating the suspicious degree of each code block by using a suspicious degree calculation formula based on a probability model according to the key quadruple, and adjusting the suspicious degree according to the structural information of the program;
and performing descending arrangement on the program frequency spectrum according to the size of the suspicious degree to obtain a suspicious position list of the code missing errors.
Further, the collecting code coverage information of the program with the error to be detected includes: and performing plug-in processing on the error program to be tested, then performing batch automatic testing, and acquiring code coverage information of the program to be tested according to output information of the plug-in program.
Further, the static information includes: firstly, code basic unit names and test case function names of a program are used for carrying out positioning work by a frequency spectrum method by combining key quadruple information covered by codes and test case execution results; second, branch structure information, basic block information, variable name information of the program are used for the calculation section.
Further, the analyzing the collected code coverage information and static information to generate a program spectrum, and inserting a code block indicating a code missing position into the program spectrum includes:
generating program frequency spectrum information according to the code basic unit name, the test case function name and the key quadruple covered by the code in the static information;
according to the branch structure information and basic block information in the static information, a code block indicating a code missing position is inserted in the program spectrum.
Further, the adjusting the suspicious degree according to the structural information of the program includes: modifying the suspicious degree of the code block where the conditional expression is located by utilizing the branch structure information; carrying out smoothing operation on the suspicious degree of the frequency spectrum list; and modifying the suspicious degree of each code block by using the variable information.
A program error positioning device based on a frequency spectrum method comprises a code coverage information acquisition module, a program information acquisition and storage module, an information input integration module, a calculation module and a result analysis module;
code coverage information acquisition module: performing plug-in processing on an error program to be tested, then performing batch automatic testing, and acquiring code coverage rate information of the program to be tested according to output information of the plug-in program; extracting a key quadruple required by a spectrum method from the code coverage rate information, namely: the number of correct test case coverage, the number of failed test case coverage, the number of correct test case non-coverage and the number of failed test case non-coverage when the code is executed. The program will save the information of the key quadruple.
The program information acquisition and storage module comprises: the experiment platform collects the static information of the error program to be detected so as to assist the error positioning work. The static information includes: firstly, the code basic unit name and each test case function name of the program are used for carrying out positioning work by a frequency spectrum method by combining key four-tuple information covered by the code and a test case execution result. Second, the branch structure information of the program, basic block information, variable information used, is used in the calculation part of the experiment.
The information input integration module: the collected program static information and code coverage information are analyzed. And generating program spectrum information according to the code basic unit name, the test case function name and the key quadruple covered by the code in the static information. Then, a code block indicating a code missing position is inserted into the program spectrum based on the branch structure information and basic block information in the static information. In this platform, the granularity used by the basic unit of code is a line of code.
A calculation module: and processing the program static information and the code coverage information by using a probability model-based suspicious degree calculation formula, and calculating to obtain suspicious values of all code blocks. Then, using the collected program information, the suspect values are re-modified: modifying the suspicious value of the code block where the conditional expression is located by utilizing the branch structure information; carrying out smoothing operation on suspicious values of the frequency spectrum list; and modifying the suspicious value of each code block by using the variable information.
A result analysis module: and according to the size of the suspicious value, performing descending arrangement on the program frequency spectrum to obtain a suspicious position list of the code missing errors. The experimental platform feeds back to the list of the suspicious positions of the user in the form of a csv list. If the wrong location of the program to be tested is provided, the experimental results can be further analyzed. The ratio of the sorting position corresponding to the error position to the total list length is the positioning efficiency of the error positioning experiment. The experimental platform can compare and analyze the positioning efficiency of the method and the traditional spectrum method. The user may obtain a comprehensive report of several versions of the program under test.
Optionally, the method for locating the program error based on the spectrum method of the present invention includes the following specific steps:
(1) for the Java program error version to be detected, tools such as ant and javac are used for compiling the source code, and then a GZoltar tool is used for carrying out instrumentation. And (4) running the test case of the program by using a JUnit tool, and judging whether an error is generated according to an output result. And generating frequency spectrum information according to the printing result of the inserted code, and storing the frequency spectrum information in the csv file.
(2) The execution information of the program is stored in matrix.txt, and the execution result of the program is stored in a matrix form; the matrix stores information of whether the code block is covered in the test case and whether the test case passes. Respectively storing a code block and a test case of the program in corresponding csv files, and recording basic information of the code block and the test case; in combination with matrix.txt, the program generates spectrum information, records the position of each code block and the key quadruple, and stores the position and the key quadruple in spectra.csv.
(3) The user can decide the data flow of error positioning. More than ten widely used error localization formulas are built into the platform and the user can use self-defined formulas. The platform provides default values for each parameter used in the error positioning process, and the user can also specify the parameters by himself. The control of the data flow is finished by using a simple control script and is easy to master.
(4) And calculating the suspicious values of the code blocks according to the key four-tuple information of the code blocks and combining information such as the branch structure, the variable distribution and the like of the program, and performing descending order arrangement to obtain a suspicious statement list of the current error version.
(5) The user may further analyze the results of the mis-localized experiment. And searching the position of the error in the suspicious code block list, wherein the ratio of the ordinal number of the error to the length of the code block list is the positioning efficiency of the experiment. In batch experiments, a user can transversely compare experimental data, compare the positioning efficiency of the same algorithm on different programs to be tested, and also compare the positioning effect difference of different algorithms.
Compared with the prior art, the invention has the advantages that:
(1) the positioning range is expanded: on the basis of the existing code blocks of the frequency spectrum method positioning program, the positioning capability of the missing code errors is increased, and the method is more suitable for actual engineering;
(2) the positioning capability is enhanced: compared with the traditional spectrum method, the positioning efficiency of the code is improved;
(3) the calculation flow can be edited: in the experiment, the calculation formula of the suspicious degree and the specific calculation process can be modified in the control script without modifying the code structure, so that the experiment flexibility is improved;
(4) intermediate data retention: in the experiment, information such as frequency spectrum information, program static information and the like is stored locally, so that the experiment is convenient to reproduce, and the repeated calculation amount is reduced.
Drawings
FIG. 1 is a diagram of an experimental tool system;
FIG. 2 is a block diagram of a code coverage information collection module;
FIG. 3 is a diagram of a program information acquisition and storage module;
FIG. 4 is a diagram of an information input integration module;
FIG. 5 is a diagram of a computing module architecture;
FIG. 6 shows the output of a sample program.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below.
As shown in FIG. 1, the platform of the present invention performs error location work on Java programs based on the Ubuntu 18.04LTS operating system. The platform uses the csv file to store the intermediate information and final results of the error localization. More specifically, the following modules are included: the system comprises a code coverage information acquisition module, a program information acquisition and storage module, an information input integration module, a calculation module and a result analysis module.
(1) And for the Java project under the Ubuntu environment, ant and Java are used for compiling to obtain an executable Java file. Then, the GZoltar tool is used for inserting java byte codes. Then, each unit test case of the program to be tested is run by using the JUnit. Then, a print file (gzollar. exec) of the instrumented code is read, coverage information of each code block under the unit test case is obtained through analysis, and the information is written into a storage file.
(2) The positioning tool collects the static information of the program to be tested and stores the static information in combination with the dynamic analysis result. The storage information comprises a code basic unit name of a program, a function name of each unit test case, and key four-tuple information covered by the code obtained by insertion and a test case execution result, and is used for positioning work by a frequency spectrum method. This information is stored in the spectra _ GZoltar folder, in the csv file corresponding to the program name, e.g., Lang _01. csv. Second, other information used in the computational portion of the experiment includes the branch structure information of the program, basic block information, and variable information used. This information is stored in folders such as variable, block, branch, etc., in csv files corresponding to program names, such as variable/Lang _01. csv.
(3) The user can edit the control script by himself to control the experimental flow of error positioning. Several error programs and error versions for completing information acquisition can be selected for each error location. The suspicious degree calculation formula for sorting can be selected by the user, and the user can write the suspicious degree calculation formula by himself. After reading the program code block list of the wrong version, the program adds a spectrum item representing the missing error of the code according to the program basic block information, and confirms the key quadruple inserted into the spectrum item according to the spectrum items near the missing position.
(4) And reading the key quadruple information stored in the storage file, calculating the suspicious value of each code block according to a specified suspicious degree calculation formula in the control script, and judging the possibility that each program unit contains errors. And then, adjusting the suspicious degree of the program according to the structural information of the program. And readjusting the suspicious degree of each conditional statement by using the information of the branch structure in the program. The degree of suspicion of program neighbors (elements containing code blocks and insertion sites) is smoothed. And readjusting the suspicious degree of each code block according to the related variable information of each code structure of the program. And sorting according to the descending order of the suspicious degrees by using the finally obtained suspicious degrees, and returning a suspicious list in a csv form as an output result.
(5) Based on the output, the tool can further analyze the experimental results. The ratio of the sorting position corresponding to the error position to the total list length is the positioning efficiency of the error positioning experiment. The experimental platform can compare and analyze the positioning efficiency of the method and the traditional spectrum method. The user may obtain a comprehensive report of several versions of the program under test.
The implementation process is specifically implemented as follows:
1. code coverage information acquisition module
The implementation process of the module is shown in fig. 2:
(1) and compiling the Java program to be tested to obtain a byte code file.
(2) Inserting the generated byte code file by using a GZoltar tool, and adding printing sentences by taking the sentences as granularity in a program;
(3) executing a unit test case of the program, covering the condition of the unit test case of the printing code by the instrumentation statement, judging whether the unit test case passes or not, and storing the printing result of the instrumentation statement in a gzoltar.
(4) Analyzing the gzoltar.exec file, combining with a function unit test function file test.csv, and generating a program spectrum file spectrum _ GZoltar/program.csv. And for each code block, reading the plug-in output file, and obtaining the sum of the number of covered failure test cases, namely the number of covered failure cases of the code block. Other elements in the quadruple are accumulated by a similar method.
2. Program information acquisition and storage module
The implementation process of the module is shown in FIG. 3:
(1) the program related static information is stored in the csv file named program name. The static information used by the standard computing process comprises program branch information, program basic block information and program variable information which are respectively stored in the folders of branch, block, variable and the like. In the Csv file, one column is the code block name, and the other columns are the properties corresponding to the code block.
(2) The code overlay information is saved in a csv file named program name. Wherein the first column is the code block name, followed by four columns for the corresponding quadruple information. Taking a spectrum in the Lang program as an example, the first item of { org.apache.common.lang 3.math $ number utilis # < clinit > ():34,1,0,168,1} is the position of the code block in the program, the second item "1" means that the number of successful test cases covered by the code is 1, the third item "0" means that the number of failed test cases covered by the code is 0, and the last two items are the number of successful and failed test cases not covered by the code. Other code coverage information may be parsed in the same way.
3. Information input integration module
The implementation process of the module is shown in fig. 4:
(1) and reading the control script and determining the specific data processing flow of the error positioning work.
(2) And reading the program static information and the code coverage information of the program to be tested from the storage file, and constructing a program frequency spectrum used for calculation.
(3) In order to realize the capability of locating the code missing error, a frequency spectrum item representing the code missing error is added in a program frequency spectrum. For example, "org.apache.common.lang.3. medium $ number utilis # < clinit > (): 34" and "org.apache.common.lang.3. medium $ number utilis # < clinit > (): 36" are two adjacent code blocks in the program, and the tool inserts an item "org.apache.common.lang.3. medium $ number utilis # < clinit > ():34- > 36" in the spectrum list, indicating the code missing site between the two code blocks. In the present program location tool, only code miss errors within the function are considered.
4. Computing module
The implementation process of the module is shown in FIG. 5:
(1) and calculating the suspicious value of each frequency spectrum in the frequency spectrum item list according to the suspicious degree calculation formula selected in the control script.
(2) And analyzing suspicious values of the coverage information corresponding to the True branch and the False branch in each conditional branch according to the branch structure information of the program, and assigning the suspicious value of the code block corresponding to the conditional expression to be the maximum value of the original code block, the True branch and the False branch.
(3) And arranging the spectrum items in sequence, then carrying out smoothing operation on the suspicious values of the spectrum items, and taking the smoothed result as the suspicious values of the spectrum items. Wherein the smoothing operation refers to calculating a weighted square mean.
(4) For each spectral item, its variable information is read from the static information. For the code block, the variable information is the variable name contained in the line code; for the missing site, the variable information is the variable name contained in its adjacent code block. And calculating the minimum value with a constant alpha according to the sum of the occurrence times of the variable information corresponding to each frequency spectrum, then multiplying the minimum value by a constant beta, adding the constant beta and the constant gamma to obtain a weight coefficient, and multiplying the suspicious value by the weight coefficient to obtain the suspicious value considering the importance of the variable. For example, a set of statements, where the suspicious value is {0.2, 0.3, 0.1}, the sum of the occurrence times of the variable information is {2, 1, 4}, α is 3, β is 0.1, and γ is 0.7, the minimum value is {2, 1, 3}, the minimum value is multiplied by β to obtain {0.2, 0.1, 0.3}, the sum is added to γ to obtain a weighting coefficient of {0.9, 0.8, 1.0}, and the suspicious value is multiplied by the weighting coefficient to obtain a final result of {0.18, 0.24, 0.1 }.
(5) And outputting the suspicious value and the code block information, and returning the suspicious value and the code block information to the user in a csv form.
5. Result analysis module
After the program to be tested is positioned by errors, a list ordered by the suspicion degree can be obtained, and the list comprises code blocks and code missing sites. Fig. 6 is a list of suspicions of the first error version of the program Lang to be tested; due to the large program size, only the top number of the list of suspiciousness is shown in the figure.
In the evaluation experiment, in order to evaluate the effectiveness of the method, an experiment was performed using a sample program that determines the true error location. After the error positioning is carried out on the program, the real error position is provided, and the error positioning work can be evaluated. The ratio of the ranking of the real errors in the suspicious degree list to the length of the list is the positioning efficiency of the current error positioning. The experimental tool can compare the positioning efficiency of the experimental method and the pure spectrum method and determine the difference of the positioning efficiency.
After error positioning is carried out on a plurality of programs to be tested and versions, transverse comparison can be carried out. The tool can classify the experimental results according to the criteria of the type, the error type and the like of the program to be tested and compare the positioning efficiency difference of different experiments; the tool can also compare the positioning efficiency of different experimental methods for the same batch of procedures.
Table 1 shows the experimental effect of the method on real errors in actual engineering. The column names Ochiai, Barinel, etc. are classical error localization formulas and the row names Closure, Chart, etc. are laboratory software names. The EXAM is the percentage of the ranking of the checked error positions in the total code amount in the experiment; the smaller the value of the EXAM, the better the positioning effect. avg (impr) represents the average performance improvement brought about by using the method, compared with the conventional spectrum method, in each version of the program.
TABLE 1 results of the experiments
Figure BDA0002445904200000081
Based on the same inventive concept, another embodiment of the present invention provides an electronic device (computer, server, smartphone, etc.) comprising a memory storing a computer program configured to be executed by the processor and a processor, the computer program comprising instructions for performing the steps of the inventive method.
Based on the same inventive concept, another embodiment of the present invention provides a computer-readable storage medium (e.g., ROM/RAM, magnetic disk, optical disk) storing a computer program, which when executed by a computer, performs the steps of the inventive method.
The above examples are for the purpose of describing the present invention only and are not intended to limit the scope of the present invention. The scope of the invention is indicated by the appended claims, and all such equivalent changes and modifications as do not depart from the spirit and principle of the invention are intended to be covered by the scope of the invention.

Claims (10)

1. A method for locating program errors based on a spectrum method is characterized by comprising the following steps:
collecting code coverage information of an error program to be detected, and extracting a key quadruple needed by a spectrum method from the code coverage information;
collecting static information of an error program to be detected;
analyzing the collected code coverage information and static information to generate a program frequency spectrum, and inserting a code block representing a code missing position into the program frequency spectrum;
calculating the suspicious degree of each code block by using a suspicious degree calculation formula based on a probability model according to the key quadruple, and adjusting the suspicious degree according to the structural information of the program;
and performing descending arrangement on the program frequency spectrum according to the size of the suspicious degree to obtain a suspicious position list of the code missing errors.
2. The method of claim 1, wherein collecting code coverage information for the faulty program under test comprises:
and performing plug-in processing on the error program to be tested, then performing batch automatic testing, and acquiring code coverage information of the program to be tested according to output information of the plug-in program.
3. The method of claim 1, wherein the static information comprises: firstly, code basic unit names and test case function names of a program are used for carrying out positioning work by a frequency spectrum method by combining key quadruple information covered by codes and test case execution results; second, branch structure information, basic block information, variable name information of the program are used for the calculation section.
4. The method of claim 1, wherein analyzing the collected code coverage information and static information to generate a program spectrum and inserting a code block indicating a missing position of a code into the program spectrum, comprises:
generating program frequency spectrum information according to the code basic unit name, the test case function name and the key quadruple covered by the code in the static information;
according to the branch structure information and basic block information in the static information, a code block indicating a code missing position is inserted in the program spectrum.
5. The method of claim 1, wherein the adjusting the suspicion degree according to the structural information of the program comprises: modifying the suspicious degree of the code block where the conditional expression is located by utilizing the branch structure information; carrying out smoothing operation on the suspicious degree of the frequency spectrum list; and modifying the suspicious degree of each code block by using the variable information.
6. The method of claim 5, wherein the adjusting the suspicion degree according to the structural information of the program comprises:
analyzing the suspicious degree of the coverage information corresponding to the True branch and the False branch in each conditional branch according to the branch structure information of the program, and assigning the suspicious degree of the code block corresponding to the conditional expression to be the maximum value of the original code block, the True branch and the False branch;
arranging the frequency spectrum items in sequence, then carrying out smoothing operation on the suspicion degree of the frequency spectrum items, and taking the smoothed result as the suspicion degree of the frequency spectrum items;
for each frequency spectrum item, reading variable information from static information; for the code block, the variable information is the variable name contained in the line code; for the missing site, the variable information is the variable name contained in the adjacent code block; and obtaining a weight coefficient according to the sum of the occurrence times of the variable information corresponding to each frequency spectrum, and multiplying the suspicious value by the weight coefficient to obtain the suspicious value considering the importance of the variable and obtain the suspicious value considering the importance of the variable.
7. The method of claim 1, wherein the suspicious degree calculation formula and the specific calculation procedure are modified in the control script without modifying the code structure.
8. A spectral-based program error location apparatus, comprising:
the code coverage information acquisition module is used for acquiring code coverage information of the error program to be detected and extracting a key quadruple needed by a frequency spectrum method from the code coverage information;
the program information acquisition and storage module is used for acquiring the static information of the error program to be detected;
the information input integration module is used for analyzing the collected code coverage information and static information to generate a program frequency spectrum and inserting a code block representing a code missing position into the program frequency spectrum;
the calculation module is used for calculating the suspicion degree of each code block by using a suspicion degree calculation formula based on a probability model according to the key quadruple information and adjusting the suspicion degree according to the structural information of the program;
and the result analysis module is used for performing descending order arrangement on the program frequency spectrum according to the size of the suspicious degree to obtain a suspicious position list of the code missing errors.
9. An electronic apparatus, comprising a memory and a processor, the memory storing a computer program configured to be executed by the processor, the computer program comprising instructions for performing the method of any of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program which, when executed by a computer, implements the method of any one of claims 1 to 7.
CN202010279143.6A 2020-04-10 2020-04-10 Method and device for positioning program error based on spectrum method Active CN111625444B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010279143.6A CN111625444B (en) 2020-04-10 2020-04-10 Method and device for positioning program error based on spectrum method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010279143.6A CN111625444B (en) 2020-04-10 2020-04-10 Method and device for positioning program error based on spectrum method

Publications (2)

Publication Number Publication Date
CN111625444A true CN111625444A (en) 2020-09-04
CN111625444B CN111625444B (en) 2021-09-17

Family

ID=72259628

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010279143.6A Active CN111625444B (en) 2020-04-10 2020-04-10 Method and device for positioning program error based on spectrum method

Country Status (1)

Country Link
CN (1) CN111625444B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112711537A (en) * 2020-12-31 2021-04-27 武汉船舶通信研究所(中国船舶重工集团公司第七二二研究所) Software defect positioning method and device, electronic equipment and storage medium
CN113282485A (en) * 2021-04-25 2021-08-20 南京大学 Program automatic restoration method based on self-adaptive search

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104008051A (en) * 2014-05-16 2014-08-27 南京邮电大学 Method for positioning software defects by redundancy removing and optimizing of frequency spectrum information
CN104317707A (en) * 2014-10-15 2015-01-28 中国科学院软件研究所 Program structure influence sensing based software error positioning method
CN105468530A (en) * 2015-12-22 2016-04-06 武汉工程大学 Program error detection method and system based on finite-state machine
CN106445801A (en) * 2016-04-27 2017-02-22 南京慕测信息科技有限公司 Method for positioning software defects on basis of frequency spectrum positioning and visualization
CN106776283A (en) * 2016-11-24 2017-05-31 浙江理工大学 A kind of program error localization method based on conditional probability
CN109165159A (en) * 2018-08-10 2019-01-08 北京理工大学 A kind of more defect positioning methods based on program frequency spectrum
US20190258564A1 (en) * 2018-02-19 2019-08-22 Harness, Inc. Service regression detection using real-time anomaly detection of application performance metrics
US20190324887A1 (en) * 2018-04-18 2019-10-24 The Mathworks, Inc. Run-time or compile-time error solutions for locating missing program elements in a programming environment

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104008051A (en) * 2014-05-16 2014-08-27 南京邮电大学 Method for positioning software defects by redundancy removing and optimizing of frequency spectrum information
CN104317707A (en) * 2014-10-15 2015-01-28 中国科学院软件研究所 Program structure influence sensing based software error positioning method
CN105468530A (en) * 2015-12-22 2016-04-06 武汉工程大学 Program error detection method and system based on finite-state machine
CN106445801A (en) * 2016-04-27 2017-02-22 南京慕测信息科技有限公司 Method for positioning software defects on basis of frequency spectrum positioning and visualization
CN106776283A (en) * 2016-11-24 2017-05-31 浙江理工大学 A kind of program error localization method based on conditional probability
US20190258564A1 (en) * 2018-02-19 2019-08-22 Harness, Inc. Service regression detection using real-time anomaly detection of application performance metrics
US20190324887A1 (en) * 2018-04-18 2019-10-24 The Mathworks, Inc. Run-time or compile-time error solutions for locating missing program elements in a programming environment
CN109165159A (en) * 2018-08-10 2019-01-08 北京理工大学 A kind of more defect positioning methods based on program frequency spectrum

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
ZIJIE LI: "MURE: aking Use of MUtations to REfine Spectrum-Based Fault Localization", 《IEEE 2018 IEEE INTERNATIONAL CONFERENCE ON SOFTWARE QUALITY, RELIABILITY AND SECURITY COMPANION》 *
张震宇 等: "程序覆盖进行错误自动定位方法的在线实验平台", 《小型微型计算机系统》 *
涂径玄: "基于覆盖分析的自动化错误定位关键技术研究", 《CNKI博士学位论文全文库》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112711537A (en) * 2020-12-31 2021-04-27 武汉船舶通信研究所(中国船舶重工集团公司第七二二研究所) Software defect positioning method and device, electronic equipment and storage medium
CN112711537B (en) * 2020-12-31 2022-08-12 武汉船舶通信研究所(中国船舶重工集团公司第七二二研究所) Software defect positioning method and device, electronic equipment and storage medium
CN113282485A (en) * 2021-04-25 2021-08-20 南京大学 Program automatic restoration method based on self-adaptive search
CN113282485B (en) * 2021-04-25 2023-11-03 南京大学 Program automatic repairing method based on self-adaptive search

Also Published As

Publication number Publication date
CN111625444B (en) 2021-09-17

Similar Documents

Publication Publication Date Title
Fang et al. Similarity-based test case prioritization using ordered sequences of program entities
Elbaum et al. Carving differential unit test cases from system test cases
CN111400724B (en) Operating system vulnerability detection method, system and medium based on code similarity analysis
US20060212852A1 (en) Methods, systems and computer program products for detecting memory leaks
Haran et al. Applying classification techniques to remotely-collected program execution data
CN111625444B (en) Method and device for positioning program error based on spectrum method
Kouroshfar Studying the effect of co-change dispersion on software quality
Sherriff et al. Empirical software change impact analysis using singular value decomposition
CN104239219A (en) Software defect positioning technology on-line evaluating and experimenting platform and method based on coverage
GB2378534A (en) SQL execution analysis
CN111679984A (en) Performance analysis method and device
Aman et al. A doc2vec-based assessment of comments and its application to change-prone method analysis
Pheng et al. Dynamic data structure analysis for Java programs
Weninger et al. Detection of suspicious time windows in memory monitoring
Tan et al. E-sc4r: Explaining software clustering for remodularisation
CN113672506A (en) Dynamic proportion test case sequencing selection method and system based on machine learning
CN111880957A (en) Program error positioning method based on random forest model
Ahmad et al. Identifying randomness related flaky tests through divergence and execution tracing
CN114490413A (en) Test data preparation method and device, storage medium and electronic equipment
Cankur et al. Comparative evaluation of call graph generation by profiling tools
CN115599621A (en) Micro-service abnormity diagnosis method, device, equipment and storage medium
Miranskyy et al. An iterative, multi-level, and scalable approach to comparing execution traces
CN115422092B (en) Software bug positioning method based on multi-method fusion
Sun et al. CARIAL: Cost-aware software reliability improvement with active learning
CN115203057B (en) Low code test automation method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant