Professional Documents
Culture Documents
Application of Artificial Bee Colony Algorithm To Software Testing
Application of Artificial Bee Colony Algorithm To Software Testing
Violated Penalty to be imposed in case 1. Triangle classifier (TC) is one of the most used
distinct predicate is not satisfied programs for experimentation of test data generation
predicate in structural testing environment. It accepts three
A<B A – B+ ζ inputs as sides of a triangle and then decides whether
A≤B A–B these sides form a triangle and if yes, then of what
type. This program contains total 7 feasible paths of
A>B B – A+ ζ
which four involves equality constraints.
A≥ B B–A
A=B Abs(A – B) 2. Line-rectangle classifier (LRC) program identifies
A≠B ζ – abs(A – B) whether a line cuts a rectangle or lies completely
A and B are operands and ζ is a smallest constant of outside or lies completely inside of the rectangle. In
operands’ universal domains. In case integer it is 1 this program total eight inputs are entered; four for
and in case real values it can be 0.1 or 0.01 depending co-ordinates of rectangle and other four inputs to
on the accuracy we need in solution. define the line. Some of the nodes in CFG of this
program have very high level of nesting. This is main
reason of using this program so that the difficulty of
testing a nested structure can be found.
5. Experimental Setup and Results 3. Number of days between two dates program(DBTD)
accepts six integer input variables representing two
In order to prove the worthiness of the ABC method dates. Input ranges for first date year and second date
for test data generation, we have experimented on ten year are between 2000 and 2100. This program
real world problems. The aim of the experiment was to contains plenty of branches with equality conditions;
generate test cases automatically from the corresponding some of them use the remainder operator, which adds
CFG using the standard ABC algorithm. CFG of discontinuity to the decisions domains and therefore
programs are automatically constructed from respective tester may face a greater difficulty in finding the test
source code and all feasible paths are identified cases that cover those branches. The nesting level is
manually. The fitness function corresponding to the very high for some of the nodes. These characteristics
target path is constructed using the concept of symbolic make this program an ideal one to evaluate the
testing and path constraint system, which has been effectiveness and efficiency of automatic test
already described in section 4.2 of this paper. ABC generator for the path coverage criterion. This
algorithm is implemented using MATLAB programming program also contains several loops. We have
environment. The performance of the algorithms is converted loops in case statements in such a way so
measured using Average Test Cases generated Per Path that each condition within the loop is executed at
(ATCPP) and Average Percentage Coverage (APC) least once by test cases and it covers each statement
metrics. Experiment is conducted 10 times for averaging in the loop.
results. In each attempt, ABC is iterated for 100
4. Program ‘a2f’ (A2F) converts a numeric string into
generations for each of 10 runs. In each run, except for
real value. The main reason of taking this program is
the first run, first-generation population is seeded with
its complexity and the nested structure it is having,
the best solution from the previous run. This is done to
making compound constraint in symbolic testing
check premature convergence of population. Total
more complex and hard to be satisfied. It inputs an
number of real encoded individuals in each population is
array of numeric characters. Input domain for each
30. If a solution is not found within all runs that
position in array is 0 to 127 which represents
generates total 30,000 invalid test cases then it is
characters in ASCII table. This program has 15
declared that the test case generation has failed for that
decision nodes. The highest nesting level is seven
particular attempt. This value has been obtained by
which is rare in most real world programs. This
multiplying total number of runs, generations and
program contains a few equality conditions branches
number of individual in each population. An invalid test
also. This program also contains several loops. We
have allowed loops to execute utmost thrice thereby
limiting the explosion of number of paths but side by ABC for large domains of inputs. It also fails to generate
side enough chance is given for the execution of test data for TC (small domain) frequently for a path in
every statement in loop and traversing its effect in which it has to prove triangle as equilateral. Thereby, we
future execution of loop. can also conclude that search algorithm performance is
affected by the number of equality constraints the target
5. Binary search (BS) program accepts a variable size
path involving. Other than these, the binary search is the
array of maximum 80 elements. The loop in the
only program for which ABC fails to generate test cases
program is allowed to execute 5 times utmost.
miserably. This may be due to requirement of inputting
6. Remainder (REM) finds the remainder of two integer variable array to satisfy the boundary cases. Although
numbers. It also contains 4 loops which are again we have taken a fixed size array of size 80 but its size is
restricted for 5 executions only. varied by taking an external variable ‘n’ during
experimentation. Although, we have used the same
7. Bubble sort (BUB) arrange an array in ascending approach for A2F and BUB programs but in these,
order. It accepts a variable size array. This program is boundary cases are not required to be satisfied.
unique in the sense that it is the only program in this
set of programs, where nested loops structure is Table 3. ATCPP and APC for Test Objects
present. Name of Program ATCPP APC
8. Quadratic equation program(QUAD) finds the roots TC (small Domain) 6197 85.71
of a quadratic equation. Program also tests equation TC (Large Domain) 17156 42.86
for linearity or infeasibility. LRC (small Domain) 1255 100
9. Min-max program (MINMAX) finds minimum and LRC (Large Domain) 3924 89.06
maximum value from an array. In this program loop DBTD 206 100
is again allowed to execute 5 times utmost. A2F 3195 100
BS 15545 51.94
10. Isprime (ISPRIME) program test an integer for its
primeness. This is the simplest program in the list. REM 970 100
BUB 258 100
Detail characteristics of these test objects are given in QUAD 1930 100
table 2. MINMAX 619 100
ISPRIME 52 100
Table 2. Test Objects’ characteristics
Name of
Highest Nesting
Decision Nodes
Program
Feasible Paths
Total Paths in
Lines of Code
Complexity
Cyclomatic
Number of
6. Conclusion
Level
CFG
[15] Lin JC,Yeh PL, Automatic test data generation for path [31] Pham DT, Otri S, Ghanbarzadeh A, Kog E, Application
testing using GAs. Information Sciences 2001; 131:47– of the Bees Algorithm to the Training of Learning
64. Vector Quantisation Networks for Control Chart
Pattern Recognition. ICTTA'06 Information and
[16] Tracey N, A Search-Based Automated Test-Data Communication Technologies, 1624-1629, 2006b.
Generation Framework for Safety Critical Software.
PhD thesis, University of York, 2000.
[17] Mansour N and Salame M. Data generation for path
testing. Software Quality Journal 2004; 12:121–136.