improving spectrum based fault localisation techniquesspectrum based fault localisation 2. program...

39
BENEVOL`2015 - December 4, 2015 Gulsher Laghari, Alessandro Murgia and Serge Demeyer Improving Spectrum Based Fault Localisation Techniques

Upload: others

Post on 29-Feb-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

BENEVOL`2015 - December 4, 2015Gulsher Laghari, Alessandro Murgia and Serge Demeyer

Improving Spectrum Based Fault Localisation Techniques

Overview

2

3

Fault Localisation an important step in the Debugging

Fault localisation

4

Fault localisation

Which Classes to look at?

5

Fault localisation

Which Methods to look at?

6

Fault localisation

Which Statements to look at?

7

Spectrum Based Fault Localisation

Faulty Program

Ranked list of program elements

1. Input 2. Process 3. Output

1Run Tests and Collect traces

Test code

2Build Program

Spectrum

3Rank Program

Elements

8

Spectrum Based Fault Localisation

Ranked list of program elements

Spectrum Based Fault Localisation

1. Trace Collection

Unit Under Test (UUT)

9

Spectrum Based Fault Localisation

1. Trace Collection

Unit Under Test (UUT)

Statement

10

Spectrum Based Fault Localisation

1. Trace Collection

Unit Under Test (UUT)

Block

11

Spectrum Based Fault Localisation

1. Trace Collection

Unit Under Test (UUT)

Method

12

Spectrum Based Fault Localisation

2. Program Spectrum

UUTi = (ef, ep, nf, np)

ef = number of failing test cases that execute the UUT

ep = number of passing test cases that execute the UUT

nf = number of failing test cases that do not execute the UUT

np = number of passing test cases that do not execute the UUT

13

Spectrum Based Fault Localisation

Test Coverage Matrix

UUTFailing Test Cases Passing Test Cases Program Spectrum

T1 … Tm Tm+1 … Tn ef ep nf np

UUT1 X1,1 … X1,m X1,m+1 … X1,n

… … … … … … …

UUTN XN,1 … XN,m XN,m+1 … XN,n

2. Program Spectrum

14

Spectrum Based Fault Localisation

UUTFailing Test Cases Passing Test Cases Program Spectrum

T1 … Tm Tm+1 … Tn ef ep nf np

UUT1 X1,1 … X1,m X1,m+1 … X1,n

… … … … … … …

UUTN XN,1 … XN,m XN,m+1 … XN,n

2. Program Spectrum

15

Test Coverage Matrix

Spectrum Based Fault Localisation

mX

i=1

Xi,j

UUTFailing Test Cases Passing Test Cases Program Spectrum

T1 … Tm Tm+1 … Tn ef ep nf np

UUT1 X1,1 … X1,m X1,m+1 … X1,n m - ef

… … … … … … …

UUTN XN,1 … XN,m XN,m+1 … XN,n

2. Program Spectrum

16

Test Coverage Matrix

Spectrum Based Fault Localisation

mX

i=1

Xi,j

nX

i=m+1

Xi,j

UUTFailing Test Cases Passing Test Cases Program Spectrum

T1 … Tm Tm+1 … Tn ef ep nf np

UUT1 X1,1 … X1,m X1,m+1 … X1,n m - ef (n-m) - ep

… … … … … … …

UUTN XN,1 … XN,m XN,m+1 … XN,n

2. Program Spectrum

17

Test Coverage Matrix

Spectrum Based Fault Localisation

3. RankingSuspiciousness of UUT

UUTFailing Test Cases Passing Test Cases Program Spectrum

Suspiciousness

T1 … Tm Tm+1 … Tn ef ep nf np

UUT1 X1,1 … X1,m X1,m+1 … X1,n [0,1]

… … … … … … …

UUTN XN,1 … XN,m XN,m+1 … XN,n

18

Spectrum Based Fault Localisation

Suspiciousness of UUT

UUTFailing Test Cases Passing Test Cases Program Spectrum

Suspiciousness

T1 … Tm Tm+1 … Tn ef ep nf np

UUT1 1 1 1 0 0 0 1

… … … … … … …

UUTN XN,1 … XN,m XN,m+1 … XN,n

3. Ranking

19

Spectrum Based Fault Localisation

Suspiciousness of UUT

UUTFailing Test Cases Passing Test Cases Program Spectrum

Suspiciousness

T1 … Tm Tm+1 … Tn ef ep nf np

UUT1 0 0 0 X1,m+1 … X1,n 0

… … … … … … …

UUTN XN,1 … XN,m XN,m+1 … XN,n

3. Ranking

20

Spectrum Based Fault Localisation

Suspiciousness of UUT

UUTFailing Test Cases Passing Test Cases Program Spectrum

Suspiciousness

T1 … Tm Tm+1 … Tn ef ep nf np

UUT1 1 … 0 1 … 0 0 < S < 1

… … … … … … …

UUTN XN,1 … XN,m XN,m+1 … XN,n

3. Ranking

21

Spectrum Based Fault Localisation

Suspiciousness of UUT

UUTFailing Test Cases Passing Test Cases Program Spectrum

Suspiciousness

T1 … Tm Tm+1 … Tn ef ep nf np

UUT1 1 … 0 1 … 0

… … … … … … …

UUTN XN,1 … XN,m XN,m+1 … XN,n

3. Ranking

22

Similarity Coefficient

Spectrum Based Fault Localisation (The Problem)

Context: when the UUT is a method

23

public void method(){…………methodA()methodB()if(condition){return

}…………methodC()…………

}

Fault(wrong condition)

Spectrum Based Fault Localisation (The Problem)

Context: when the UUT is a method

24

public void method(){…………methodA()methodB()if(condition){return

}…………methodC()…………

}

Spectrum Based Fault Localisation (The Problem)

Context: when the UUT is a method

25

public void method(){…………methodA()methodB()if(condition){return

}…………methodC()…………

}

Spectrum Based Fault Localisation (The Problem)

Context: when the UUT is a method

26

public void method(){…………methodA()methodB()if(condition){return

}…………methodC()…………

}

Spectrum Based Fault Localisation (The Problem)

Context: when the UUT is a method

Program

method method methodCoverage

27

Spectrum Based Fault Localisation (The Problem)

Context: when the UUT is a method

Program

method method methodCoverage

28

Spectrum Based Fault Localisation (The Solution)

Context: when the UUT is a method

29

MethodCall Sequences

MethodCoverage

public void method(){…………methodA()methodB()if(condition){

return}…………methodC()…………

}

Program

methodmethod

methodC

method

Spectrum Based Fault Localisation (The Solution)

Context: when the UUT is a method

30

methodB methodA

Program

method

method method method

method

method method method

method

method method method

Spectrum Based Fault Localisation (The Solution)

Context: when the UUT is a method

31

Program

method

method method method

method

method method method

method

method method method

Context: when the UUT is a method

Spectrum Based Fault Localisation (The Solution)

32

Program

method

method method method

method

method method method

method

method method method

Context: when the UUT is a method

Spectrum Based Fault Localisation (The Solution)

33

Frequent Call Sequences (Closed Itemset mining algorithm)

Intuition

A method whose call sequences differ in failing and passing test cases is more suspicious

Spectrum Based Fault Localisation (The Solution)

Context: when the UUT is a method

34

35

Project* # of versions LOC # of faults

NanoXML 4 7646 16

JMeter 2 43400 3

Experimental Setup 1/2

• One fault at a time

• Single failing and all passing test cases

* Downloaded from Software-artifact Infrastructure Repository (http://sir.unl.edu)

36

Ranked list of program elements

Evaluation metric

Wasted effort

Experimental Setup 2/2

Results and Discussion - 1/2

Average Wasted effortCall Sequence

methodCoverage method

mean 9.3 22.2

Std. Dev 11.1 14.9

Total 354 rankings

0 50 100 150 200 250 300 350

010

2030

4050

60

Ranking

wast

ed e

ffort

−Call Sequence methodCoverage method

37

Ranking

wast

ed e

ffort

0 100 300 354177 (50%)

016

.530

604

16.5

−Call Sequence methodCoverage method

Results and Discussion - 2/2

Total 354 rankings

38

Summary

39