Research Article

An Effective Strategy to Build Up a Balanced Test Suite for Spectrum-Based Fault Localization

Algorithm 1

Selected best passed test cases (PNF).
Input:  initial passed testcases: ,
   initial failed testcases: ,
   class ratio:
Output: new passed testcases:
//() find passed test cases which do not
execute faulty statements
for  each   (passed test cases ID) in    do
 stmtSet: get executed statements set of tID;
if  stmtSet not contain faulty lines  then
  add () into ;
end
if  nonFaultMap is emptythen
 add all into ;
//() find passed test cases which execute as
many non-faulty statements as possible
sort by its value (size of stmtSet);
validPassList = .Key;
//() build up a new test cases
= ;
= new ArrayList (newPasscnt);
//statement coverage
= get the set of all executed statements;;
while    do
= a new test case of ;
= get executed statements by ;
if  one element in smSetTi smSet  then
  add to ;
  add smSetTi to ;
end
if  statement coverage of   <  that of    then
 //improve statement coverage
 find out the valuable passed test cases;
 add valuable passed test cases to ;
//   make sure of the required class ratio
while    do
 search unselected test case from ;
 add it to ;
end
return ;