56
Fault Localisation CS453, Shin Yoo

09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Fault LocalisationCS453, Shin Yoo

Page 2: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Fault Localisation

Debugging process

Page 3: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Fault Localisation

• Hard for humans: we increasingly have to work on and with large code base written by others.

• Hard for machines: automated repair techniques rely heavily on automated fault localisation.

Page 4: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Fault Localisation• Machines are bad at semantic

reasoning (yet).

• We need to convert the fault localisation problem into something quantitative, something less than the full semantic.

• How do we reason about the location of a fault, using available information?

• What are the available information?

Page 5: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Fault Localisation• Here, we consider four different techniques.

• Delta debugging (a slightly different approach, but highly relevant)

• Information Retrieval Technique

• Spectrum Based Fault Localisation

• Mutation Based Fault Localisation

• For a complete overview:

• W. E. Wong, R. Gao, Y. Li, R. Abreu, and F. Wotawa. A survey on software fault localization. IEEE Transactions on Software Engineering, 42(8):707, August 2016.

Page 6: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Delta Debugging: Motivating Example

Motivating example

Displaying this HTML causes the Mozilla browser to crash. Why?

Rendering this HTML on AwesomeWebKit version 42.42 crashes the browser. How do you find why?

Page 7: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

DD: A Simple SolutionMotivating example

Displaying this HTML causes the Mozilla browser to crash. Why?

1. Erase a line. 2. See if it still crashes. 3. If it does, proceed by erasing another line. 4. If it does not, undo and erase another line.

Page 8: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

DD: Advanced SolutionMotivating example

Displaying this HTML causes the Mozilla browser to crash. Why?

• Binary deletion on entire input. • Delete first half, second half, first quarter.. • Best case: O(log n)

Page 9: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

DD: Advanced SolutionMotivating example

Displaying this HTML causes the Mozilla browser to crash. Why?• What if the failure is due to some interaction between

the first and the second part? • Deleting first half: pass, deleting second half: pass, the

entire input: fail

Page 10: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

DD: Recursive BSDD(P, {i1, . . . , in})(1) if i == 1 then return i1(2) P1 = P + ({i1, . . . , in/2})(3) P2 = P + ({in/2+1, . . . , in})(4) if R1 == Fail(5) return DD(P, {i1, . . . , in/2})(6) else if R2 == Fail(7) return DD(P, {in/2+1, . . . , in})(8) else(9) return DD(P2, {i1, . . . , in/2}) +

DD(P1, {in/2+1, . . . , in})<latexit sha1_base64="8HwrFydmJNsrPrxfg0B8HLYURjY=">AAAD23icjVJNj9MwEHUTPpbw1YUjF4sGqWhXJckFOFRaQYXgFhBlV2pK5LhOaq3jRLaDqKzcOCGu/Diu+0twmsC2211pR3I8efPmzdiepGRUKs/707PsGzdv3d6749y9d//Bw/7+oy+yqAQmU1ywQpwkSBJGOZkqqhg5KQVBecLIcXL6tokffyNC0oJ/VquSzHOUcZpSjJSB4v3eWZSQjHKNWFYIqpZ57UTG5ygnejKptRsewkjT2DcbWxRKHkIa86h2a22Y/3MVStpEmqol4dql47FvOA0kiKpEA8UGqR03NDscwxAewKHbanfSNNb8RVAb9edR1BCDbWITPfDrTfo/cltbu5/W4mP4DlFWOxBuNDCZDM9Ps1ux7lQIk6RVCq6hdFVLm2qXJMfB1Y2Y47Yc/5ol+MKJzOf8Hbqf7kHj/sAbeWuDu47fOQPQWRj3z6JFgauccIUZknLme6WaayQUxYwY/UqSEuFTlJGZcZtZkXO9HsYaPjPIAqaFMIsruEY3MzTKpVzliWHmSC3lxVgDXhabVSp9NdeUl5UiHLeF0opBVcBmsuGCCoIVWxkHYXNyiiFeIoGwMvO/XYVlzaX4F69g15kGo9cj/2MwOHrT3c4eeAKegiHwwUtwBN6DEEwBtj5YhfXdWtlf7R/2T/tXS7V6Xc5jsGX277+7hzTx</latexit><latexit sha1_base64="8HwrFydmJNsrPrxfg0B8HLYURjY=">AAAD23icjVJNj9MwEHUTPpbw1YUjF4sGqWhXJckFOFRaQYXgFhBlV2pK5LhOaq3jRLaDqKzcOCGu/Diu+0twmsC2211pR3I8efPmzdiepGRUKs/707PsGzdv3d6749y9d//Bw/7+oy+yqAQmU1ywQpwkSBJGOZkqqhg5KQVBecLIcXL6tokffyNC0oJ/VquSzHOUcZpSjJSB4v3eWZSQjHKNWFYIqpZ57UTG5ygnejKptRsewkjT2DcbWxRKHkIa86h2a22Y/3MVStpEmqol4dql47FvOA0kiKpEA8UGqR03NDscwxAewKHbanfSNNb8RVAb9edR1BCDbWITPfDrTfo/cltbu5/W4mP4DlFWOxBuNDCZDM9Ps1ux7lQIk6RVCq6hdFVLm2qXJMfB1Y2Y47Yc/5ol+MKJzOf8Hbqf7kHj/sAbeWuDu47fOQPQWRj3z6JFgauccIUZknLme6WaayQUxYwY/UqSEuFTlJGZcZtZkXO9HsYaPjPIAqaFMIsruEY3MzTKpVzliWHmSC3lxVgDXhabVSp9NdeUl5UiHLeF0opBVcBmsuGCCoIVWxkHYXNyiiFeIoGwMvO/XYVlzaX4F69g15kGo9cj/2MwOHrT3c4eeAKegiHwwUtwBN6DEEwBtj5YhfXdWtlf7R/2T/tXS7V6Xc5jsGX277+7hzTx</latexit><latexit sha1_base64="8HwrFydmJNsrPrxfg0B8HLYURjY=">AAAD23icjVJNj9MwEHUTPpbw1YUjF4sGqWhXJckFOFRaQYXgFhBlV2pK5LhOaq3jRLaDqKzcOCGu/Diu+0twmsC2211pR3I8efPmzdiepGRUKs/707PsGzdv3d6749y9d//Bw/7+oy+yqAQmU1ywQpwkSBJGOZkqqhg5KQVBecLIcXL6tokffyNC0oJ/VquSzHOUcZpSjJSB4v3eWZSQjHKNWFYIqpZ57UTG5ygnejKptRsewkjT2DcbWxRKHkIa86h2a22Y/3MVStpEmqol4dql47FvOA0kiKpEA8UGqR03NDscwxAewKHbanfSNNb8RVAb9edR1BCDbWITPfDrTfo/cltbu5/W4mP4DlFWOxBuNDCZDM9Ps1ux7lQIk6RVCq6hdFVLm2qXJMfB1Y2Y47Yc/5ol+MKJzOf8Hbqf7kHj/sAbeWuDu47fOQPQWRj3z6JFgauccIUZknLme6WaayQUxYwY/UqSEuFTlJGZcZtZkXO9HsYaPjPIAqaFMIsruEY3MzTKpVzliWHmSC3lxVgDXhabVSp9NdeUl5UiHLeF0opBVcBmsuGCCoIVWxkHYXNyiiFeIoGwMvO/XYVlzaX4F69g15kGo9cj/2MwOHrT3c4eeAKegiHwwUtwBN6DEEwBtj5YhfXdWtlf7R/2T/tXS7V6Xc5jsGX277+7hzTx</latexit><latexit sha1_base64="8HwrFydmJNsrPrxfg0B8HLYURjY=">AAAD23icjVJNj9MwEHUTPpbw1YUjF4sGqWhXJckFOFRaQYXgFhBlV2pK5LhOaq3jRLaDqKzcOCGu/Diu+0twmsC2211pR3I8efPmzdiepGRUKs/707PsGzdv3d6749y9d//Bw/7+oy+yqAQmU1ywQpwkSBJGOZkqqhg5KQVBecLIcXL6tokffyNC0oJ/VquSzHOUcZpSjJSB4v3eWZSQjHKNWFYIqpZ57UTG5ygnejKptRsewkjT2DcbWxRKHkIa86h2a22Y/3MVStpEmqol4dql47FvOA0kiKpEA8UGqR03NDscwxAewKHbanfSNNb8RVAb9edR1BCDbWITPfDrTfo/cltbu5/W4mP4DlFWOxBuNDCZDM9Ps1ux7lQIk6RVCq6hdFVLm2qXJMfB1Y2Y47Yc/5ol+MKJzOf8Hbqf7kHj/sAbeWuDu47fOQPQWRj3z6JFgauccIUZknLme6WaayQUxYwY/UqSEuFTlJGZcZtZkXO9HsYaPjPIAqaFMIsruEY3MzTKpVzliWHmSC3lxVgDXhabVSp9NdeUl5UiHLeF0opBVcBmsuGCCoIVWxkHYXNyiiFeIoGwMvO/XYVlzaX4F69g15kGo9cj/2MwOHrT3c4eeAKegiHwwUtwBN6DEEwBtj5YhfXdWtlf7R/2T/tXS7V6Xc5jsGX277+7hzTx</latexit>

Page 11: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Hierarchical Delta Debugging

• If the exact “half” boundary does not aline with syntactic boundaries, the process simply breaks.

• HDD: operate on nodes of a hierarchical tree representation, rather than linear representation

• For exampl, HDD tries deleting half the functions in a source file, instead of deleting half the lines.

• Delta: a hierarchical delta debugging tool (http://delta.stage.tigris.org)

Page 12: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Information Retrieval Technique for Fault Localisation

• Intuition: if someone reports a failure, the bug report is likely to contain some words that are shared by the responsible part of the program source code.

• Then fault localisation can be formulated as a textual query (i.e., the bug report) against a large collection of documents (i.e., the set of all source code units).

Page 13: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

IR Based Fault Localisation• Strengths

• Simple and available: many existing work on IR already improved the accuracy of textual queries - we get free ride!

• Intuitive, easy to understand.

• Weaknesses

• Requires a (very good and detailed) bug report.

• There is inherent limit to accuracy, because the document to be matched (i.e., the unit of localisation) needs to be of certain size (otherwise lexical similarity becomes more random).

Page 14: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Spectrum Based Fault Localisation

• Intuition: If there is a faulty line, executing it is likely to increase the probability of a failure. Similarly, not executing the faulty line is likely to decrease the probability of a failure.

• This decision process

• requires only test results and structural coverage, but

• is essentially a statistical inference, and does not give any guarantee

• Question: how do we formalise the above intuition in a computable form?

Page 15: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Spectrum Based Fault Localisation

ef � epep + np + 1

Risk Evaluation Formula

Ranking

Program

Tests

Spectru

Higher ranking =

Fewer statements to check

Page 16: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Spectrum Based Fault Localisation

• Program Spectrum: for each structural unit (i.e. statements or branches), summarise the test result AND coverage into a tuple of the following four numbers

• ep: # of test cases that execute this unit and pass

• ef: # of test cases that execute this unit and fail

• np: # of test cases that do not execute this unit and pass

• nf: # of test cases that do not execute this unit and fail

Page 17: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Structural Test Test Test Spectrum Tarantula RankElements t1 t2 t3 ep ef np nf

s1 • 1 0 0 2 0.00 9s2 • 1 0 0 2 0.00 9s3 • 1 0 0 2 0.00 9s4 • 1 0 0 2 0.00 9s5 • 1 0 0 2 0.00 9s6 • • 1 1 0 1 0.33 4s7 (faulty) • • 0 2 1 0 1.00 1s8 • • 1 1 0 1 0.33 4s9 • • • 1 2 0 0 0.50 2

Result P F F

Spectrum Based Fault Localisation

Tarantula =

efef+nf

epep+np

+ efef+nf

Page 18: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Tarantula (Jones & Harrold, 2001)

• Originally meant as a visualization technique, later the poster child of SBFL.

Figure 1: An screen snapshot of the Tarantula system in Shaded Summary mode.

lines executed in both passed and failed test cases. In each of these modes, the brightness for each line is setto the percentage of test cases that execute the respective statement for that mode.

The final mode, Shaded Summary, is the most informative and complex mapping. It renders all executedstatements on a spectrum from red to green. The hue of a line is determined by the percentage of thenumber of failed test cases executing statement s to the total number of failed test cases in the test suiteT and the percentage of the number passed test cases executing s to the number of passed test cases in T .These percentages are used to gauge the point in the hue spectrum from red to green for which to color s.The brightness is determined by the greater of the two percentages, assuming brightness is measured on a 0to 100 scale. Specifically, the color of the line for a statement s that is executed by at least one test case isdetermined by the following equations.

hue(s) = low hue (red) + %passed(s)%passed(s)+%failed(s) ∗ hue range

bright(s) = max(% passed(s),% failed(s))

For example, for a test suite of 100 test cases, a statement s that is executed by 15 of 20 failed test casesand 40 of 80 passed test cases, and a hue range of 0 (red) to 100 (green), the hue and brightness are 40 and75, respectively.

The long, thin rectangular region located above and to the right of the code view area shows graphicallythe results of the entire test suite. A small rectangle is drawn for each test case from left-to-right and iscolor coded to its outcome—green for success and red for failure. This lets the viewer, at a glance, see the

Page 19: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

State of the Art c.a. 2010

efef + nf + ep ef

ef + 2(nf + ep)

2ef2ef + nf + ep

2efef + nf + ep

efnf + ep

1

2(

efef + nf

+ef

ef + ep)

efef + nf + ep + np

ef + np � nf � epef + nf + ep + np

ef + np

ef + nf + ep + np

2(ef + np)

2(ef + np) + ep + nf

efef + np + 2(ep + nf )

ef + np

nf + ep

efef+nf

epep+np

+ efef+nf

Over 30 formulæ in the literature: none guaranteed to perform best for all types of faults

Page 20: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Conference’17, July 2017, Washington, DC, USA

fault localisation: defect prediction can be interpreted as aimingto localise faults a priori (i.e. before testing and actual detection),whereas fault localisation simply does so post hoc.

We empirically evaluate FLUCCS using 210 real world faults fromDefects4J repository [19]. The method level localisation resultsobtained by FLUCCS have been compared to those from existingSBFL baselines, FLUCCS with different learning mechanism, aswell as FLUCCS without the additional source code metric features.FLUCCS with Genetic Programming convincingly outperformsall the other approaches, placing the faulty method at the top ofthe ranking for 106 faults out of 210. The final result shows thatsource codemetrics that are relatively easy to collect may effectivelyaugment existing SBFL techniques for higher accuracy.

The technical contribution of this paper can be summarised asfollows:

• We present FLUCCS, a fault localisation technique thatlearns to rank program elements using Genetic Program-ming, existing SBFL techniques, and source code metrics1.

• We empirically evaluate FLUCCS using 210 real worldfaults from Defects4J. FLUCCS ranks 50% of the stud-ied faults at the top, and about 82% of the studied faultswithin the top 5 of the ranking.

• We introduce a new way of computing method level SBFLscores called method level aggregation. Empirical evalua-tion of this technique applied to existing state-of-the-artSBFL formulæ shows that formulæ with method level ag-gregation can rank about 42% more faults at the top.

• We show that simple source code metrics can effectivelyaugment existing SBFL techniques for more accurate locali-sation, prompting further study of the connection betweendefect prediction and fault localisation.

The rest of the paper is organised as follows: Section 2 formu-lates fault localisation as a learning to rank problem and introducesthe features FLUCCS uses. Section 3 describes the learning algo-rithms that we use in the paper. Section 4 presents the set-up forthe empirical evaluation, the results of which are discussed in Sec-tion 5. Section 6 discusses the potential threats to validity. Section 7presents the related work and Section 8 concludes.

2 FEATURES USED BY FLUCCSFigure 1 shows the overall architecture of FLUCCS. FLUCCS ex-tracts two sets of features from a source code repository. The first isa set of SBFL scores using different SBFL formulæ: this requires testexecution on source code instrumented for structural coverage. Thesecond is a set of code and change metrics: this requires lightweightstatic analysis and version mining. In training phase, these features,along with locations of known faults, are fed into learning algo-rithms, which produce ranking models that rank the faulty methodas high as possible. In deployment phase, these learnt models takethe features from source code with unknown faults, and producerankings of methods according to their likelihood of being faulty.In this section, we describe the features used by FLUCCS, as wellas how these features are extracted and processed.

1FLUCCS and the data used for the empirical evaluation are made available at http://Redacted.For.Double.Blind.Review

2.1 SBFL ScoresSBFL formulæ take program spectrum data as input and returnrisk scores (also known as suspiciousness scores). For a structuralprogram element (such as a statement or a method), the spectrumdata consists of four variables that are aggregated from test cover-age and pass/fail results: (ep , ef ,np ,nf ): ep and ef represent thenumber of passing and failing test cases that execute the givenstructural element, respectively. Similarly, np and nf represent thenumber of passing that failing test cases that do not execute thegiven structural element. SBFL formulæ tend to assign higher riskscores to elements wigh higher ef and np values, which suggestexecuting those elements tend to result in failing test executions,while not executing them tend to result in passing test executions.

Table 1: SBFL formulæ used by FLUCCS as features

Name Formula Name Formula

ER1a⎧⎪⎨⎪⎩

−1 if nf >0

np otherwiseER1b ef −

epep+np+1

ER5a ef −ef

ep+np+1ER5b

efef +nf +ep+np

ER5c⎧⎪⎨⎪⎩

0 if ef <F

1 otherwiseGP2 2(ef +

!

ep+np )+√ep

Ochiaief

(ef +nf ) (ef +ep )GP3

"

|e2f−√ep |

Jaccardef

ef +nf +epGP13 ef (1+

12ep+ef

)

AMPLE |efF −

epP | GP19 ef

#

|ep−ef +F−P |

Hamannef +np−ep−nf

P+F Tarantula

efef +nf

efef +nf

+ep

ep+np

Dice2ef

ef +ep+nfRusselRao

efep+ef +np+nf

M1ef +npnf +ep

SørensenDice2ef

2ef +ep+nf

M2ef

ef +np+2nf +2epKulczynski1

efnf +ep

Hamming ef +np Kulczynski2 12 (

efef +nf

+ef

ef +ep)

Goodman2ef −nf −ep2ef +nf +ep

SimpleMatchingef +np

ep+ef +np+nf

Euclid!

ef +np RogersTanimotoef +np

ef +np+2nf +2ep

Wong1 ef Sokal2ef +2np

2e f +2np+nf +ep

Wong2 ef −ep Anderbergef

ef +2ep+2nf

Wong3 ef −h,h=

⎧⎪⎪⎪⎪⎨⎪⎪⎪⎪⎩

ep if ep≤22+0.1(ep−2) if 2<ep≤102.8+0.01(ep−10) if ep>10

Ochiai2ef np√

(ef +ep ) (nf +np ) (ef +np ) (ep+nf )

Zoltaref

ef +ep+nf +10000nf ep

ef

FLUCCS uses 33 SBFL formulæ to generate score metrics, whichare listed in Table 1 We include both the state-of-the-art humangenerated SBFL formulæ and GP evolved SBFL formulæ. Of these,25 formulæ have been used in combination with each other inprevious work [3, 40], while eleven formulæ have been proven tobe maximal [39].

Page 21: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Parnin & Orso, ISSTA 2011

• Title: “Are Automated Debugging Techniques Actually Helping Programmers?”

• Based on human studies, authors say “no, not really”!

• Some of the widely accepted assumptions, such as perfect bug understanding, may not hold in reality.

• BIGGEST IMPACT: “percentage will not cut it” - later studies move away from the Expense metric.

Page 22: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Yoo, 2012: Evolving Formulas

ef � epep + np + 1

Risk Evaluation Formula

Ranking

Program

Tests

Spectrum

P S

P SGP

Fitness (minimise)

e2f (2ep + 2ef + 3np)

e2f (e2f +

pnp)

. . .

Training Data

Page 23: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

The Competition

• We choose 9 formulæ from Naish et al. 2011:

• Op2 is the known best.

• Jaccard, Tarantula, Ochiai are widely studied in SE.

• Wong & AMPLE are recent additions.

Op1 =

(�1 if nf > 0

np otherwiseOp2 = ef � ep

ep + np + 1

Tarantula =

efef+nf

epep+np

+ efef+nf

Jaccard =ef

ef + nf + ep

Ochiai =efp

(ef + nf ) · (ef + ep)

AMPLE = | efef + nf

� epep + np

|

Wong1 = ef Wong2 = ef � ep

Wong3 = ef � h, h =

8><

>:

ep if ep 2

2 + 0.1(ep � 2) if 2 < ep 10

2.8 + 0.001(ep � 10) if ep > 10

Page 24: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Table 5. Comparison of mean Expense for 72 faults in evaluation sets. Rows in boldcorrespond to GP-results that perform as well as or better than any human-designedformulæ.

ID GP Op1 Op2 Ochiai AMPLE Jacc’d Tarant. Wong1 Wong2 Wong3

GP01 5.73 9.20 5.30 32.66 10.96 6.10 15.06 22.24 17.10 6.63GP02 12.04 9.67 5.72 32.60 11.91 6.63 14.92 23.45 19.49 8.92GP03 14.46 11.35 6.11 29.99 12.18 6.99 15.68 23.55 18.55 8.85GP04 7.80 9.70 4.46 30.98 8.83 5.03 13.88 22.62 14.64 6.33GP05 9.35 11.04 5.80 29.95 10.63 6.42 14.46 23.15 18.54 8.53GP06 12.15 11.11 5.87 28.02 12.51 6.79 15.35 23.12 16.70 7.01GP07 8.93 11.18 5.94 29.53 12.19 6.85 14.81 23.88 19.74 8.68GP08 6.32 10.23 6.34 30.91 11.67 7.04 16.21 23.54 19.94 9.05GP09 9.66 10.58 5.33 31.56 11.40 6.17 14.06 22.58 18.31 8.20GP10 6.31 11.55 6.31 29.83 12.51 7.16 15.79 22.99 19.74 8.56

GP11 5.83 11.07 5.83 33.52 12.12 6.69 16.77 22.05 18.16 6.96GP12 12.09 8.84 6.23 32.15 11.65 7.02 16.65 22.91 19.42 9.09GP13 5.11 9.05 5.11 31.67 10.27 5.90 15.92 22.03 17.00 6.69GP14 9.91 8.52 5.91 31.69 11.10 6.55 15.88 23.15 18.10 8.65GP15 5.62 9.54 5.59 33.02 10.23 6.19 15.16 23.85 17.17 8.44GP16 6.79 8.32 5.71 30.52 10.74 6.41 14.60 23.06 18.36 8.42GP17 7.67 11.46 6.22 33.62 12.06 6.98 16.85 22.44 17.94 8.59GP18 9.42 10.78 5.54 34.17 11.46 6.33 15.45 22.17 17.46 8.14GP19 6.42 9.01 5.11 31.28 10.18 5.78 15.03 22.84 15.26 7.79GP20 5.69 10.93 5.69 29.34 10.88 6.38 15.23 23.41 19.30 8.42

GP21 10.17 10.13 6.24 29.82 10.86 6.89 15.70 23.01 19.85 9.43GP22 7.58 8.50 5.91 28.06 10.46 6.60 13.67 23.25 18.60 8.63GP23 6.14 10.76 5.52 30.86 10.57 6.16 14.69 21.77 16.90 7.25GP24 9.18 10.15 6.21 28.74 12.53 7.10 15.76 23.41 20.16 8.35GP25 9.34 10.19 6.29 32.56 12.36 7.18 17.59 22.63 20.19 9.48GP26 6.38 11.62 6.38 32.83 12.27 7.25 18.28 23.77 16.18 7.69GP27 9.75 8.53 5.89 33.28 12.01 6.85 16.42 22.99 19.23 7.81GP28 5.56 9.18 5.25 30.02 11.18 6.15 13.52 22.86 17.17 6.85GP29 7.16 10.12 6.17 34.17 12.83 7.14 17.00 22.94 20.18 8.88GP30 10.68 9.10 5.14 30.02 10.17 5.78 14.49 22.79 17.09 8.34

of one sample X over another sample Y : the value of A is the probability that asingle subject taken randomly from groupX has higher/lower value than anothersingle case randomly taken from group Y . For A(X > Y ), the value of A closerto 1 represents a higher probability of X > Y , 0 a higher probability of X < Y ,and 0.5 no e↵ect (i.e., X = Y ).

However, the statistical interpretation of the results should be treated withcaution. There is no guarantee that the studied programs and faults are represen-tative of all possible programs and faults and, therefore, it is not clear whetherthey are legitimate samples of the entire group. On the other hand, if the costof designing risk evaluation formulæ is significantly reduced by the use of GP,the possibility of project-specific formalæ should not be entirely ruled out.

5 Results and Analysis

5.1 E↵ectiveness

Table 5 contains the mean Expense values for all 30 GP-evolved formulæ andhuman-designed formulæ in Table 73. Each row reports the mean Expense values

3 The complete results for individual faults are available from: http://www.cs.ucl.ac.uk/staff/s.yoo/evolving-sbfl.html.

Results

• Green: GP outperforms the other.

• Orange: GP exactly matches the other.

• Red: The other outperforms GP.

4 Unix tools w/ 92 faults: 20 for training, 72 for evaluation.

Op1

Op2

Och

iai

AMPL

E

Jacc

ard

Tara

ntul

a

Won

g1

Won

g2

Won

g3

⟵30

GP

Run

s⟶

Page 25: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Results

• GP completely outperforms Ochiai, Tarantula, Wong 1 & 2, and mostly outperforms AMPLE.

• Op1, Jaccard, and Wong 3 are tough to beat.

• Op2 is very good but it is not impossible to do better.

4 Unix tools w/ 92 faults: 20 for training, 72 for evaluation.

Op1

Op2

Och

iai

AMPL

E

Jacc

ard

Tara

ntul

a

Won

g1

Won

g2

Won

g3

⟵30

GP

Run

s⟶

Page 26: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Evolved FormulæTable 7. GP-evolved risk evaluation formulæ. Trivial bloats, such as nf � nf , wereremoved.

ID Refined Formula ID Refined Formula

GP01 ef (np + ef (1 +pef )) GP16

qe

32f + np

GP02 2(ef +pnp) +

pep GP17 2ef+nf

ef�np+ npp

ef� ef � e2f

GP03q

|e2f �pep| GP18 e3f + 2np

GP04q

| np

ep�np� ef | GP19 ef

p|ep � ef + nf � np|

GP05(ef+np)

pef

(ef+ep)(npnf+pep)(ep+np)

p|ep�np|

GP20 2(ef + np

ep+np)

GP06 efnp GP21p

ef +pef + np

GP07 2ef (1 + ef + 12np

) + (1 +p2)pnp GP22 e2f + ef +

pnp

GP08 e2f (2ep + 2ef + 3np) GP23pef (e2f + np

ef+

pnp + nf + np)

GP09ef

pnp

np+np+ np + ef + e3f GP24 ef +

pnp

GP10q

|ef � 1np

| GP25 e2f +pnp +

pefp

|ep�np|+ np

(ef�np)

GP11 e2f (e2f +

pnp) GP26 2e2f +

pnp

GP12p

ep + ef + np �pep GP27

np

p(npnf�ef )

ef+npnf

GP13 ef (1 +1

2ep+ef) GP28 ef (ef +

pnp + 1)

GP14 ef +pnp GP29 ef (2e2f +ef +np)+

(ef�np)pnpef

ep�np

GP15 ef +p

nf +pnp GP30

q|ef � nf�np

ef+nf|

All existing metrics have been designed by human; this paper present the firstGP-based approach to the design of risk evaluation formulæ, reformulating itas a predictive modelling based on GP. Machine learning techniques have beenalso applied to fault localisation work, but the aim was to classify failing teststogether rather than to identify the location of the fault directly [23].

Although SBFL originally started as a debugging aid for human develop-ers, the technique is increasingly used to enable other automated Search-BasedSoftware Engineering (SBSE) techniques. Goues et al. use SBFL to identify theparts of a program that needs to be automatically patched [7]. Yoo et al. useSBFL to measure the Shannon entropy of fault locality, so that the test suitecan be prioritised for faster fault localisation [25]. GP may be able to help thesetechniques by evolving SBFL techniques with a specific set of characteristics,improving the synergy between predictive modelling and SBSE even further [9].

Other approaches towards fault localisation include slicing [2], considerationof test similarity [3, 8], delta debugging [27, 28], and causal inference [4]. Whilethis paper only concerns the spectra-based approach, the positive results sug-gest that GP may be successfully employed to evolve a wider range of faultlocalisation techniques.

7 Conclusion

This paper reports the first application of Genetic Programming to evolvingrisk evaluation formulæ for Spectra-Based Fault Localisation. We use a simpletree-based GP to evolve risk evaluation formulæ that take program spectra ele-ments as terminals. Empirical evaluation based on 92 di↵erent faults from fourUnix utilities shows three important findings. First, GP-evolved formulæ canoutperform widely studied human-designed formulæ by up to 5.9 times. Second,

Page 27: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Theoretical Analysis of SBFL

• For all the gory details:

• X. Xie, T. Y. Chen, F.-C. Kuo, and B. Xu. A theoretical analysis of the risk evaluation formulas for Spectrum-Based Fault Localization. ACM Transactions on Software Engineering Methodology, 22(4):31:1– 31:40, October 2013.

• X. Xie, F.-C. Kuo, T. Y. Chen, S. Yoo, and M. Harman. Provably optimal and human-competitive results in SBSE for Spectrum Based Fault Localisation. In G. Ruhe and Y. Zhang, editors, Search Based Software Engineering, volume 8084 of Lecture Notes in Computer Science, pages 224–238. Springer Berlin Heidelberg, 2013.

Page 28: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Crash Course into Our Proof System

• Given a test suite and a formula R, a program PG = {s1, s2, ..., sn} can be divided into the following three subsets:

• SRB: set of elements that are ranked higher than the faulty element, sf

• SRF: set of elements that are tied to the faulty element, sf

• SRA: set of elements that are ranked lower than the faulty element, sf

SRB = {si 2 S|R(si) > R(sf ), 1 i n}

SRF = {si 2 S|R(si) = R(sf ), 1 i n}

SRA = {si 2 S|R(si) < R(sf ), 1 i n}

Page 29: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Crash Course into Our Proof System

• Formula R1 dominates formula R2 (R1→R2) if, for any combination of program, faulty statement, test suite, and a consistent tie-breaking scheme, E1 ≤ E2

• That is,

• Formula R1 is equivalent to formula R2 (R1↔R2) if, for any combination of program, faulty statement, test suite, and a consistent tie-breaking scheme, E1 = E2

• That is,

• Finally, R1↔R2 iff R1→R2 and R2→R1

SR1B ✓ SR2

B ^ SR2A ✓ SR1

A

SR1B = SR2

B ^ SR1F = SR2

F ^ SR1A = SR2

A

Page 30: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Crash Course into Our Proof System

Formula X Formula Y

SXB

SYB

SXF

SXA

SYA

SYF

SYB ✓ SX

B ^ SXA ✓ SY

A

To show that Y dominates X, we show that:

(assuming that we break ties in F sets consistently)

Statement Ranking

Equivalence is defined as:

X $ Y () X ! Y ^ Y ! X

Page 31: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

The Current Maximal FormulasName Formula expression

ER1’Naish1

⇢�1 if ef<FP � ep if ef=F

Naish2 ef � epep+np+1

GP13 ef (1 +1

2ep+ef)

ER5Wong1 ef

Russel & Rao efef+nf+ep+np

Binary

⇢0 if ef<F1 if ef=F

GP02 2(ef +pnp) +

pep

GP03q

|e2f �pep|

GP19 efp|ep � ef + nf � np|

Page 32: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

2014: SBFL is dead…While trying to improve it, we accidentally killed it.

S. Yoo, X. Xie, F.-C. Kuo, T. Y. Chen, and M. Harman. Human competitiveness of genetic programming in SBFL: Theoretical and empirical analysis. ACM Transactions on Software Engineering and Methodology, 26(1):4:1-4:30, 2017

Page 33: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

ef

e p

0 2 4 6 8 F

02

46

8P

1

0 1 2 3 4 5 6 7 8 ... F0.0

0.2

0.4

0.6

0.8

1.0

0 1 2 3 4 5 6 7 8 ...P

ef

e p

Ris

kVa

lue!

(ef , ep)FaultyBorder

By definition, the spectral coordinate of the faulty element should be on thefaulty border (i.e. its ef = F ).

Let P = number of passing tests, F = number of failing tests.

Then we can convert spectral tuples, (ep, ef , np, nf ), into normalised Cartesiancoordinates, (ef , np), where 0 ef F and 0 np P . Note ep = P � np,nf = F � ef .

A SBFL risk evaluation formula is a function R : IF ⇥ IP ! R.

Page 34: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

efnp

Tarantula

Page 35: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

efnp

Ochiai

Page 36: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

efnp

Jaccard

Page 37: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

efnp

Naish2

Page 38: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

efnp

gp13

Page 39: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Proofs

• S. Yoo, X. Xie, F.-C. Kuo, T. Y. Chen, and M. Harman. No pot of gold at the end of program spectrum rainbow: Greatest risk evaluation formula does not exist. Technical Report RN/14/14, University College London, 2014.

• S. Yoo, X. Xie, F.-C. Kuo, T. Y. Chen, and M. Harman. Human competitiveness of genetic programming in SBFL: Theoretical and empirical analysis. ACM Transactions on Software Engineering and Methodology, 26(1):4:1-4:30, 2017.

Page 40: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Hybrid SBFL Approaches• People are realising that a single formula is strongly

limited.

• Hybridisation

• Use multiple formulas at the same time, or

• Use SBFL formulas with some additional input features

• As we accept more diverse input, fault localisation became a learning problem, instead of a design-a-technique problem

Page 41: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Xuan & Monperrus (ICSME 2014)

• Simultaneously use 25 SBFL formulas, using the weighted-sum method.

• Use a learning-to-rank technique to train the ranking model (i.e. to optimize the weights that yield best ranks for training set faults)

Page 42: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Le et al. (ISSTA 2016)

• In addition to 35 SBFL formulas, Savant use invariant difference:

• Use Daikon to infer method invariants twice: with passing tests, and with failing test. For the faulty method, two sets of invariant will tend to be more different.

Page 43: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Sohn & Yoo (ISSTA 2017)

• A simple and naive insight: we already have a technique that claims it can tell us where the faults are - even before we test!

• 😰

• But, seriously, we present FLUCCS - Fault Localisation Using Code and Change Metrics.

DEFECTS

DEFECT PREDICTION

Page 44: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Defect Prediction and Fault Localization

A priori Fault

Localization

A posteriori Fault

Localization

Defect Prediction

Fault Localization

Defect Prediction

Fault Localization

Predictor Localizer

Page 45: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Defect prediction and Fault Localization

Defect Prediction

Fault Localization

?

Page 46: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

SBFL Features

▪ 33 SBFL formulas▪ Both human + GP▪ 25 from MULTRIC▪ 11 from formulas

have been proven to be maximal[7]

Program Spectrum SBFL Features

Page 47: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

FLUCCS: Code and Change Metrics Features

• Age: how long has the given element existed in the code base?

• Churn: how frequently has the given element been changed?

• Complexity: how complex is the given element

Page 48: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

FLUCCS

Code & Change Features

SBFL Features

Learning to Rank

(GP / SVM)

Known Faults (Training Data)

Ranking

Page 49: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

FLUCCS Results

Conference’17, July 2017, Washington, DC, USA

4.4 Evaluation MetricsWe use three metrics to analyse the performance of GP with newfeatures following existing work [3, 40]. In particular, the use ofaccuracy (acc@n) andwasted effort (we f ) conforms to the guidelinefrom Parnin and Orso [30], as these metrics are based on an absolutecount of program elements, rather than percentage values.

4.4.1 Accuracy (acc@n). acc@n counts the number of faultsthat have been localised within top n places of the ranking. Weuse 1, 3, 5 for number n, and count the number of correspondingfaults per project and also overall. When there are multiple faultyprogram elements, we assume the fault is localised if any of themare ranked within top n places.

4.4.2 Wasted Effort (we f ). we f measures the amount of effortwasted looking at non-faulty program elements. Essentially,we fcan be interpreted as the absolute count version of the traditionalExpense metric.

4.4.3 Mean Average Precision (MAP). MAP is an evaluation met-ric for ranking, used in Information Retrieval; it is the mean ofthe average precision of all faults. First, we define the precision oflocalisation at each rank i , P (i ):

P (i ) =number of faulty methods in top i ranks

i(1)

Average precision (AP) for a given ranking is the average preci-sion for faulty program elements:

AP =M!

i=1

P (i ) × isFaulty (i )number of faulty methods

(2)

Mean Average Precision (MAP) is the mean of AP values com-puted for a set of faults. We calculate MAP for faults belonging tothe same project.

Table 4: Metric values showing the effectiveness of FLUCCS

Technique Project Total acc we f MAPFaults @1 @3 @5 mean std

GPAmin

Lang 60 34 51 56 1.1833 2.3345 0.6794Time 27 11 15 19 4.2222 7.2231 0.4060Math 96 54 72 82 4.2396 16.2075 0.5884Closure 27 7 15 16 37.5185 98.1821 0.3460Overall 210 106 153 173 11.7909 45.1638 0.5050

GPAmed

Lang 60 34 49 54 1.3500 2.5088 0.6865Time 27 10 16 17 19.3704 58.6137 0.4001Math 96 55 76 82 4.3333 20.8185 0.6401Closure 27 9 14 17 92.5185 284.0684 0.3768Overall 210 108 155 170 29.3931 130.4855 0.5259

4.5 ValidationTomaximize the size of training data set and also to avoid overfittingof GP, we use ten-fold cross validation. Given the set of 210 faults,we divides fault data set into ten different sets, each comprises 21faults. These sets are used as test data sets. Each test data set ispaired with remaining faults as matching training data set.

We execute 30 runs of FLUCCS with GP, resulting in 30 differentranking models. To summarize and compare overall results, eval-uation metrics of rankings are aggregated per Defects4J project.Since acc@n is a counting metric (i.e. it is a count of faults for whicha localisation method ranks the fault at the top), we simply countthe number of faults, in a Defects4J project, for which the givenranking model placed the faulty method at the top. On the otherhand, bothwe f and MAP values can be computed for localisationof a single fault. Therefore, unlike acc@n,we f and MAP for eachDefects4J project is the average of allwe f and MAP values overthe faults belonging to the same project.

4.6 Tie-breakingRanking models generated by both FLUCCS and the eleven baselineSBFL formulæ produce ordinal scores. However, when convertingthese scores into rankings, ties often take place. To break theseties, We use max tie-breaker that ranks all tied elements with thelowest ranking. We use the rankdata function from scipy.stats,a Python module for statistical functions as well as probabilitydistribution, to implement max tie breaker.

5 RESULTS AND ANALYSIS

5.1 RQ1. EffectivenessTable 4 shows the performance of FLUCCS measured by usingevaluation metrics described in Section 4.4. For GPAmin , 106 faults(roughly 50% of all faults studied) are located at the top and 173faults (82%) are placed within the top five. For GPA

med, 108 faults

(51%) and 170 faults (80%) are placed at the top and within the topfive respectively. Although the result ofGPA

medhas a slightly better

result than GPAmin for metric acc@1, GPAmin outperforms GPAmed

for metric we f . Recall that the fitness function is the averageranking of faults in the test data sets; we f directly reflects therelative fitness (higher ranking results in lower we f ), whereasacc@1 counts specific cases of produced rankings. Consequently,improvedwe f by GPAmin can still result in worse acc@1.

The overall MAP values for both GPAmin and GPAmed

are higherthan 0.5. While acc@1 andwe f focus on the method that has thehighest rank, MAP concerns all faulty methods that consist a sin-gle Defects4J fault, communicating more complete views on therankings of constituent methods. The observed overall MAP valuesare higher than those reported in fault localisation literature [3].

The results suggest that FLUCCS is more effective at localisingfaults when compared to baseline SBFL formulæ. The right column(“Without Method Level Aggregation”) in Table 6 shows the resultsfrom the 11 baseline SBFL formulæ. The top six best performingSBFL formulæ are ER1a , ER1b , gp03, gp19, Ochiai, and Jaccard.Compared to these formulæ,GPAmin places at least 49% and at most54% more faults at the top (acc@1) than these formulæ. In terms ofwe f , GPAmin has 12.8 whilewe f values for these baseline formulæare ranged from 103.9 to 731.5. In terms of MAPmetric, MAP valuesfor all top six formulæ do not exceed 0.5, which GPAmin exceeds:the values are ranged from 0.4005 to 0.4303.

The boxplots in Figure 3 present the overall we f results fromeleven baseline SBFL formulæ as well asGPA

medand GPAmin (the y-

axis is in log scale): FLUCCS outperforms all other baseline formulæ.

We localise 108 out of 210 Defects4J faults at the top.

Page 50: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

SBFL• Strengths

• Only requires what is already there: coverage and test results

• Relatively intuitive

• Weaknesses

• Single formulas are usually limited. In fact,

• There exists a theoretical proof that no single formula works the best against all faults

• Does not work against omission faults

• Does not work well against multiple faults

Page 51: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Mutation Based Fault Localisation

• How do we use mutants to localise a fault? Mutants are injected faults themselves!!

• Consider this: what would happen if you mutate a program you know to be faulty?

Page 52: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Case 1: Mutating Correct Statements

P FEquivalent P-F+

New Fault

P+ F-Mask

Page 53: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

CASE 2: mutating Faulty Statement

P+F-(Partial) Fix

P?F?(New) Fault

P+F-Mask

P FEquivalent

Page 54: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Hypotheses

• An arbitrary mutation operator applied to a correct statement is likely to introduce a new fault

• An arbitrary mutation operator applied to a faulty statement is either likely to keep the program still faulty or, even better, (partially) fix the program

• The majority of statements in a faulty statement is correct; we detect the faulty one by observing the anomaly from our hypotheses

Page 55: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

MUSE (Moon et al., 2014)

µ(s) =1

|mut(s)|X

m2mut(s)

(|fP (s) \ pm|

|fP |� ↵ · |pP (s) \ fm|

|pP |)

Proportion of test cases that mutant m turns

from fail to pass

Proportion of test cases that mutant m turns

from pass to failAverage over all mutation applied

to statement s

↵ =f2p

|mut(P )| · |fP |· |mut(P )| · |pP |

p2f

Page 56: 09 Fault Localisation - COINSE · Fault Localisation • Here, we consider four different techniques. • Delta debugging (a slightly different approach, but highly relevant) •

Summary• Delta Debugging minimises a failure-inducing input, thereby

helping the developer to localise the corresponding part in the program.

• IR based FL queries the documents (source code files) using symptoms of the failure (bug report) as the query text.

• SBFL capsulate the intuition about test results and coverage into risk evaluation formula.

• MBFL is based on the idea that mutating an already faulty program can reveal insights about the fault (further damage or partial fix).