Analyzing Test Case Selection & Prioritization Using ACO: ACM SIGSOFT Software Engineering Notes September 2011
Analyzing Test Case Selection & Prioritization Using ACO: ACM SIGSOFT Software Engineering Notes September 2011
Analyzing Test Case Selection & Prioritization Using ACO: ACM SIGSOFT Software Engineering Notes September 2011
net/publication/220630944
CITATIONS READS
15 152
2 authors:
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Bharti Suri on 06 July 2016.
time information and results in the selected and prioritized ordering of 2. Percentage reduction in execution time, and
the test suite. 3. Percentage of the number of times the best path is found.
4.3 Design
Assuming ‘T’ = {t1, t2……tn} is the set of all ‘n’ number of test cases, To build the confidence in the technique ACO, we repeated ten runs for
and ‘F’ = {f1, f2……fx} be the set of all faults seeded in the program each of the programs with same test suites for seven different TC
under test. Some or all the faults in ‘F’ are covered by the test case {t1, values. Each run yielded the path found whether or not optimal. The
t2……tn} in the original test suite. We assume a fully connected time constraint (TC) chosen as the stopping criteria of the algorithm
undirected graph with the test cases as its nodes. ‘zi’ , is the time taken was taken to be 85 to 400 for 70 runs of each program. Time reduction,
while ants cover new nodes in the graph. For evaluating a complete optimality of technique and the correctness of the technique while
path, the total time constraint, TC, is taken to be MAX (user defined matching with optimum path were obtained from the output data.
input). The same numbers of artificial ants are generated as the number
of test cases. ‘S’, which consists of ‘m’ test cases (m<n, S T), is a
subset of the original test suite and consists of the selected test cases for 5. DATA ANALYSIS
each ant. There are ‘n’ subsets corresponding to ‘n’ ants. Pheromone For our experiment, out of the complete test pool, we randomly chose a
deposited is represented by ‘wi,’ the weight of the ith edge in the graph. test suite of five to twenty-six test cases for P1 to P8 respectively.
The deposition rate of pheromone is taken to be +1 for each edge Execution time for each of the test cases was then calculated and used
crossed by the ant on the optimal path. The evaporation rate of as an input to the ACO algorithm. The algorithm was executed 70 times
pheromone is selected to be 10%, which is reduced from the weight of each for the test programs with varying time constraint TC=85, 150,
each edge, after iteration is completed [2]. 200, 250, 300, 350 and 400. The results obtained are summarized in
Fig. 2- Fig. 7.
4. EXPERIMENTAL DESIGN
5.1 Time Analysis
4.1 Programs Previously, ACO_TCSP [7] was tested only for a constant value of the
For our analysis we used seven C++ and one Java program. Using fault TC on various programs. In this paper, time analysis for seven different
seeding technique, five to ten modified versions and black box test values of TC on all eight programs is presented. Ten runs for each case
cases for the programs were generated. Brief description about the were recorded, making a total of 560 ACO runs (10*7*8) on the test
programs, their sizes, versions and test suites are given in Table 1. data. For 381 out of 560 runs, the optimum path was found using
ACO_TCSP. This indicates a very high probability of getting optimal
Table 1. Details of the Selected 8 Test Programs
results using the ACO_TCSP tool.
Total Test
Prog Size No. of No. of
Program Lang Suite
ram Versi Test
Name uage LOC Execution
No. ons Cases
Time (sec)
CollAdm
P1 C++ 281 5 9 105.32
ission
HotelMg
P2 C++ 666 5 5 49.84
mnt
P3 triangle C++ 37 6 19 382
P4 quadratic C++ 38 8 19 441
cost_of_p
P5 C++ 31 8 19 382 Fig 2: Number of Best Paths found out of 10 Versus TC
ub
P6 calculator C++ 101 9 25 82.5
The numbers of best paths found by each test program for varying
P7 prev_day C++ 87 7 19 468
values of TC out of ten runs each were recorded. The same is
railway_ represented graphically in Fig. 2. It can be observed clearly that the
P8 Java 129 10 26 177
book number of best paths found increases with the increase in value of TC
for all programs except P3 and P5. Though different numbers of best
paths are found by each of the eight programs, but a general increasing
4.2 Variables trend with rising TC value can be inferred. P3 and P5 show ten out of
The independent variables manipulated by the experiment are: ten best paths found in all cases, hence there is no possibility of an
1. Subject programs with five to ten faults each. increasing trend with TC. It also shows the effectiveness of ACO_TCSP
2. Various Time Constraints (TC). in finding the optimum paths according to total fault coverage and
For each of the programs, on each run we measured: minimum execution time criteria.
1. The ratio of the total execution time of the test suite to the
reduced ACO execution time.
2. Whether the optimal path has been found or not.
For each program run, random nature of ACO led to different paths
using which three dependent variables were computed:
1. Percentage reduction in test suite size,
Fig 3: Average Execution Time of ACO Paths versus TC Fig 5: Average No. of Iteration at which Optimum path is found
Versus TC
Average execution times of the final paths found on each of the ten runs
of ACO_TCSP for all the eight test programs with seven different TC The average number of iterations of ACO_TCSP execution out of ten
values are depicted graphically in Fig. 3. It can be inferred from the runs, at which the optimum path is found, was also noted. Its variation
figure that even though execution time of final paths for eight programs with different TC values is depicted in the graph and shown in Fig. 5. A
are different, but the general trend is a decrease in the execution time general increase in the number of iteration finding optimum path with
with an increase in TC value. Thus, as the TC is increased, paths with the increasing TC can be figured from Fig 6.8. P3 and P5 again show
less amount of execution time are found by the ACO_TCSP. It can be exceptional behavior as the optimum path for them is found in the 1st
thus derived from here that increased value of TC provides better iteration for all 70 test runs each. Thus increasing the value of TC
results. The exceptions for P3 & P5 are same as explained before. increases the chances of finding the optimum path by the proposed
technique.
Fig 7: Percentage Reduction in Test Suite using ACO for the test
programs
7. REFERENCES
[1] Caro, G. Di and Dorigo, M. 1998, AntNet: Distributed stigmergetic
control for communications networks. Journal of Artificial
Intelligence Research, 9, (1998), 317-365.
[2] Dorigo, M., Maniezzo, V., and Colorni, A. 1996. Ant System:
Optimization by a colony of cooperating agents. IEEE
Trannsactions on Systems, Man and Cybernetics, B(26), (1996),
29-41.
[3] Li, H., and Peng Lam, C. 2005. Software Test Data Generation
Using Ant Colony Optimization. In Transactions on Engineering,
Computing and Technology (2005).
[4] Parpinelli, R.S., Lopes, H.S., and Freitas, A.A. 2002. Data mining
with an ant colony optimization algorithm. IEEE Transactions on
Evolutionary Computation, 6, (2002), 321–332.
[5] Rothermel, G., Untch, R.H., Chu, C., and Harrold, M.J. 1999. Test
case prioritization: An empirical study, In Proceedings of the
International Conference on Software Maintenance, (1999), 179–
188.
[6] Singh, Y., Kaur, A., and Suri, B. 2010. Test Case Prioritization
Using Ant Colony optimization. Association in Computing
Machinery, Newsletter ACM SIGSOFT Software Engineering
Notes, New York, USA, (July 2010), 1-7.
[7] Suri, B., Singhal, S. 2011. Implementing Ant Colony Optimization
for Test Case Selection and Prioritization. International Journal on
Computer Science and Engineering, 3(5), (May 2011), 1924-1932.
[8] Walcott, K.R., Soffa M.L., Kapfhammer, G.M., and Roos, R.S.
2006. Time aware test suite prioritization. In Proceedings of
ACM/SIGSOFT International Symposium on Software Testing &
Analysis (ISSTA), Portland Maine, USA, (2006), 1–11.
[9] Zhao, P., Zhao, P. and Zhang, X. 2006. New Ant Colony
Optimization for the Knapsack Problem. (2006).