27.03.2014 Views

SEKE 2012 Proceedings - Knowledge Systems Institute

SEKE 2012 Proceedings - Knowledge Systems Institute

SEKE 2012 Proceedings - Knowledge Systems Institute

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Algorithm 1 RegressionTesting<br />

Input:<br />

P : original program<br />

T : test suite for P<br />

E: a set of executions<br />

C: a set of changed classes<br />

Declare:<br />

m: amethod<br />

t: a test case<br />

IS: a ranked list of potentially impacted methods<br />

EXE: a set of methods executed by a test case<br />

Use:<br />

CIA(C): returns a ranked list of methods potentially impacted by the set of<br />

changed classes C.<br />

TCA(t): returns a set of methods covered by test case t.<br />

Output:<br />

A set of ordering test cases T ′<br />

1: IS = CIA(C)<br />

2: for each m in IS do<br />

3: for each test case t in T do<br />

4: if TCA(t) ∩ m == ∅ then<br />

5: continue<br />

6: end if<br />

7: T ′ = T ′ ∪ t<br />

8: T = T − t<br />

9: EXE = TCA(t) ∩ IS<br />

10: if EXE ≠ ∅ then<br />

11: IS = IS − EXE<br />

12: end if<br />

13: end for<br />

14: end for<br />

15: return T ′<br />

gorithm checks whether the test case t traverses m, if not,<br />

continues to the next test case (Lines 4-6). If t traverses<br />

m, this test case is added to the new test suite T ′ (Line 7).<br />

Then, the methods in IS traversed by this test case are removed<br />

(Lines 9-12) because they have been covered by this<br />

test case. When all the methods in IS are processed, the w-<br />

hole regression testing process is finished. And the new test<br />

suite T ′ will traverse all the methods in the impact set, and<br />

the test cases in T ′<br />

are ordered according to the possibility<br />

of the methods to be impacted. Thus, our approach directly<br />

generates a new ordering test suite. In Algorithm 1, there<br />

are two loops to scan the set of test cases and the impact set.<br />

So the time to our approach is O(|T |×|M|), where |T | is<br />

the size of the test suite, and |M| is the size of the impact<br />

set. However, in most cases, the time of our approach is<br />

less because the two loops may end at an earlier time when<br />

some test cases can cover all the methods in the impact set.<br />

We also give an example to exemplify our regression<br />

testing approach. The test coverage information of the<br />

above example program is assumed as Table 3. There are<br />

six test cases to coverage these 10 methods. The √ in row<br />

T and column M means that the test case can cover the<br />

method. Then, we use the results in Table 2 and Table 3<br />

to generate an ordered test suite. According to Algorithm<br />

1, we should first select the test case which covers the<br />

method with highest IF value in the new test suite. As<br />

M2,M3,M5 have the highest IF value and the test case<br />

T 1 covers these methods, we should first select T 1 into the<br />

new test suite. Then we see which methods in the impact set<br />

T 1<br />

T 2<br />

T 3<br />

T 4<br />

T 5<br />

T 6<br />

Table 3. Test coverage information<br />

M1 M2<br />

√<br />

M3<br />

√<br />

M4 M5<br />

√<br />

M6<br />

√<br />

M7 M8 M9 M10<br />

√<br />

√ √ √ √ √ √<br />

√ √ √<br />

√<br />

√<br />

√ √ √ √<br />

√<br />

√<br />

can be covered by this test case. As a result, these methods<br />

{M2,M3,M5,M6,M10} are covered by T 1, and should<br />

be removed from the impact set. At this time, we check the<br />

method with the second highest IF value, we identify the<br />

M1 method, and find T 2 can cover this method. Thus T 2<br />

is added as the second test case in the new test suite. Similarly,<br />

we again remove all the methods in the impact set<br />

covered by this test case. After this, we select T 3 into the<br />

new test suite, and find that there is no method in the impact<br />

set. The whole regression testing process is finished. Ultimately,<br />

we finish the process in three loops and three test<br />

cases are generated in the new test suite, in which T 1 has<br />

the highest prioritization to be run, then T 2, and followed<br />

by T 3.<br />

4 Initial Empirical Study<br />

4.1 Setup<br />

We use the Java Hierarchical Slicing and Applications<br />

(JHSA) program as our research subject. JHSA is a tool<br />

developed in our group, and used to construct hierarchical<br />

dependence graphs from package level to statement level<br />

[9]. We extracted six versions (V 0 to V 5 )ofJHSA from its<br />

CV S repository, along with a test suite used to test the software.<br />

There are about 13 classes, 121 methods for JHSA.<br />

The test suite contains 72 test cases, which provide 80%<br />

method coverage of the program. In addition, to perform<br />

our study, we require fault data, and we utilized mutation<br />

faults [3] to study the test case prioritization. The average<br />

number of mutation faults of the program is 30.<br />

In our study we use three measures to evaluate the proposed<br />

regression testing approach. They are the percentage<br />

of faults that the new test suite can identify (PF), the percentage<br />

of test cases selected from original test suite (PTS)<br />

and the weighted average of the percentage of faults detected<br />

(AP F D) during the execution of the test suite, which is<br />

defined as follows:<br />

AP F D =1− TF 1+TF 2 +...+TF m<br />

nm<br />

+ 1<br />

2n<br />

In this Formula, n is the number of test cases, m is the<br />

number of faults revealed by T , and TF i is the first test<br />

case which reveals fault F i . The AP F D is a commonly<br />

used metric to evaluate the regression test suite prioritization<br />

[4]. And higher AP F D values imply better fault detection<br />

rates.<br />

455

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!