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 2 MarkStatements function<br />

Require:<br />

block: program block to be processed;<br />

Map new→old : 1-1 line-number mapping from new to old<br />

statements for unchanged code segments;<br />

CONFIDENCE: confidence category (i.e., LC, MC, or<br />

HC).<br />

Ensure:<br />

Requirements W.R.T block will be properly labeled.<br />

1: Stmts new ← block.Statements ∩ Map new→old .Keys;<br />

2: if Stmts new ≠ ∅ then<br />

3: Stmts old ← Map new→old .MapToValues(Stmts new );<br />

4: if Stmts old .Confidence ≺ CONFIDENCE then<br />

5: Mark all s ∈ Stmts with CONFIDENCE;<br />

6: end if<br />

7: else<br />

8: for all block pre ∈ block.P reBlocks do<br />

9: MarkStatements(block pre , Map new→old , MC);<br />

10: end for<br />

11: for all blcok succ ∈ block.SuccBlocks do<br />

12: MarkStatements(block succ , Map new→old , MC);<br />

13: end for<br />

14: end if<br />

ranging from δ.line nb to δ.line ne (Lines 13-15).<br />

During the requirements labeling phase, all requirements<br />

from Reqs state are initially assigned to the lowest confidence<br />

category LC (Line 19). If test cases can cover those statements<br />

in affected blocks Blocks old and Blocks new , they can be<br />

aware of changes and further reveal potential faults with<br />

high probability. In CATESR, for blocks in Blocks old collected<br />

from Version i , their statements are also in Reqs state<br />

as partial requirements, will be reassigned to the highest<br />

confidence category HC (Lines 20-22). However, for blocks<br />

in Blocks new collected from Version i+1 , their statements<br />

may not exist in the older version Version i . To label these<br />

requirements, we design a recursive function MarkStatements<br />

(Algorithm 2) (Lines 23-25). When calling MarkStatements<br />

for the first time, the statements in Version i will be marked<br />

with the highest confidence category HC. If no such statements<br />

exist, the algorithm will recursively check such statements in<br />

predecessors and successors of current block, and mark them<br />

with a lower confidence category MC.<br />

2) Test Cases Classification Module (M 2 ): We use this<br />

module to classify test cases into proper categories. Test<br />

cases in the same category can at most cover the same level<br />

of requirements’ confidence. After performing M 1 , all test<br />

requirements are labeled by a confidence category (i.e., HC,<br />

MC, orLC). Then, based on the total order relation given by<br />

formula 1, for each test case tc in test suite TS, M 2 computes<br />

the highest confidence of requirements which tc can cover,<br />

denoted by Confidence, and put tc into one proper subset of<br />

TS in accordance with Confidence. We use algorithm 3to<br />

show the process of this module.<br />

In Algorithm 3, we define three sets, TS HC , TS MC , and<br />

TS LC to store test cases that can cover requirements with<br />

Algorithm 3 Test Case Classification Algorithm<br />

Require:<br />

Requirements: labeled statement-level requirements;<br />

TS: original test suite contains test cases to be classified;<br />

Ensure:<br />

TS is divided into 3 pieces, TS HC , TS MC , and TS LC ,<br />

in which test cases can only get the highest confidence<br />

HC, MC, and LC respectively.<br />

1: TS HC ,TS MC ,TS LC ←∅;<br />

2: for all tc in TS do<br />

3: tc.Confidence ←LC;<br />

4: for all req in Requirements do<br />

5: if tc.Cover(req) &&<br />

tc.Confidence ≺ req.Confidence then<br />

6: tc.Confidence ← req.Confidence;<br />

7: end if<br />

8: end for<br />

9: if tc.Confidence = HC then<br />

10: TS HC .Add(tc);<br />

11: else if tc.Confidence = MC then<br />

12: TS MC .Add(tc);<br />

13: else if tc.Confidence = LC then<br />

14: TS LC .Add(tc);<br />

15: end if<br />

16: end for<br />

confidence HC, MC, and LC at most respectively. Initially,<br />

we set these result sets empty (Line 1). Then, for each test<br />

case tc, wecompute the highest confidence of requirements<br />

tc can cover (i.e., Confidence)(Lines 3-8). Finally, we add<br />

tc to TS HC , TS MC ,orTS LC according to tc.Confidence<br />

(Lines 9-15). After classification, each test case can be in only<br />

one of TS’s subsets (i.e., TS HC , TS MC ,orTS LC ).<br />

3) Test Suite Reduction Module (M 3 ): We use M 3 to<br />

generate the final reduced test suite. After classification by<br />

M 2 , original test suite TS is divided into three sub test suites<br />

TS HC , TS MC , and TS LC . Then we can reduce these three<br />

sub test suites by using a classical test suite reduction approach<br />

HGS [7]. Three reduced test suite with each confidence category<br />

HC, MC, and LC are respectively denoted by RT S HC ,<br />

RT S MC , and RT S LC . Finally, we propose a strategy named<br />

Partial-CATESR to generate the final reduced test suite.<br />

Meanwhile to illustrate the effectiveness of Partial-CATESR,<br />

we also propose another strategy named Full-CATESR for<br />

comparison.<br />

Partial-CATESR is motivated by research work of Gu et al.<br />

[5]. They conjectured that not all test requirements need to be<br />

covered during regression testing. Their empirical results show<br />

that properly not covering irrelevant test requirements could<br />

not only reduce the size of test suite, but also keep the FDA.<br />

Similarly, our Partial-CATESR strategy pays more attention<br />

to the test cases covering the most related requirements (i.e.,<br />

TS HC ) and ensure the same requirement coverage of TS HC .<br />

Based on the former analysis, reduced test suite RT S HC<br />

has the highest confidence to cover the code changes after<br />

modification, RT S MC the second, and RT S LC the lowest.<br />

220

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

Saved successfully!

Ooh no, something went wrong!