Anda di halaman 1dari 3

JOURNAL OF COMPUTING, VOLUME 3, ISSUE 4, APRIL 2011, ISSN 2151-9617

HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 117

A new Testing approach using Cuckoo


Search to achieve Multi-Objective Genetic
Algorithm
Kavita Choudhary, G.N. Purohit

Abstract— Software Testing is the process of executing a program with the intent of finding errors. Software testing can also be
stated as the process of validating and verifying that a software program meets the requirements that guided its design and
development and works as expected. The verification and validation of software through dynamic testing is an area of software
engineering where progress towards automation has been slow. Software systems should be reliable and accurate. To achieve
this objective, a complete testing is required. An automated software testing can significantly reduce the cost of developing
software. This paper presents Cuckoo Search for generation of test cases. It is an optimization algorithm. Basically, Cuckoo
Search is one of the evolutionary algorithms used to achieve multi-objective genetic algorithm and was introduced in 2009.

Index Terms— Multi-objective genetic algorithm, Cuckoo Search, Test-data generation, Optimisation and Automatic Software
Testing.

——————————  ——————————

1 INTRODUCTION

S oftware Testing is an area of software engineering


which deals with finding faults in software. Software
Testing remains the primary technique used to gain
ance, increasing reliability etc.

2 LITERATURE SURVEY
customer’s confidence in the software. The process of test-
ing any software system is a difficult task which is time Aljahdali et al. [1] used multi-objective genetic algorithm
consuming and costly. The objective of software testing is based approach as one of the computational intelligence
to design a set of minimal number of test cases such that techniques by predicting the faults during the software
it finds as many faults as possible. Mainly, the test data testing process using software faults historical data. Mark
generation activity is manual, but, nowadays, software et al. [10] introduced a Fuzzy-Based Age Extension of
testing field is diverted towards automatic generation of Genetic Algorithm approach to generation of effective
test cases. An automated software testing reduces the cost black-box test cases. Kalyanmoy et al. [4] have proposed a
of developing software. The benefits of automated soft- computationally fast and elitist MOEA (Multi-Objective
ware testing are the test preparation can be done in ad- Evolutionary Algorithm) based on a nondominated sort-
vance, the test execution would be considerably fast and ing approach. Krishnamoorthi et al. [9] describes a time-
the confidence in the testing can be increased. We pro- aware coverage based test suite prioritization technique.
pose to consider Multi-objective Genetic Algorithm ap- Sami et al. [2] explained a novel approach for test case
proach for software testing. It provides a search metho- generation based on binary search which does not require
dology, which uses the concept of natural evolution. parameter calibration. Jones et al. [7] used genetic algo-
Cuckoo search (CS) [17] is an optimization algorithm de- rithm for structural testing and was based on ensuring
veloped by Xin-She Yang and Suash Deb in 2009. It was that all branches in the software were exercised. The fit-
inspired by the obligate brood parasitism of some cuckoo ness function was based on the predicate associated with
species by laying their eggs in the nests of other host birds each branch, and a value for fitness derived from ham-
(of other species). Some host birds can engage direct con- ming distance. In the case of loops, the fitness was based
flict with the intruding cuckoos. For example, if a host on the number of iterations required. The quality of test
bird discovers the eggs are not their own, it will either data produced is high, because the tests can be directed
throw these alien eggs away or simply abandon its nest through the fitness function to the areas where faults are
and build a new nest elsewhere. Many engineering prob- most likely to be revealed. Lin et al. [11] explained how
lems do have multiple objectives i.e. maximize perfom- genetic algorithms can be used to generate test cases au-
tomatically for path testing and also used Extended
————————————————
Hamming Distance to derive a fitness function. Susan et
 Kavita Choudhary is with the Department of Computer Science, ITM Uni-
al. [8] described automatic generation of test data using
versity, Gurgaon. branch coverage. Masud et al. [12] proposed a model to
 Prof. G.N. Purohit is with the Department of AIM&ACT, Banasthali Uni- reveal faults and kill mutants using Genetic Algorithms.
versity, Rajasthan..
The model used already stored source and mutant pro-
gram (changed program) and then divided in small units.
JOURNAL OF COMPUTING, VOLUME 3, ISSUE 4, APRIL 2011, ISSN 2151-9617
HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 118

Instead of checking the entire program, it tries to find es. Till now, Cuckoo Search is used for optimization.
fault in each unit or kills each mutant unit. Nirmal et al. Yang and Deb introduces Cuckoo Search in 2009. Cuckoo
[6] used genetic algorithm for unit testing of object- Search [16] follows three rules :- 1) Each Cuckoo lays one
oriented software. Yong et al. [3] applied multi- egg at a time, and dump it’s egg in randomly chosen nest;
population genetic algorithm (MPGA) for generating au- 2) The best nest with high quality of eggs will carry over
tomatic path-oriented test data which selects individuals to the next generations; and 3) The egg laid by a Cuckoo
for free migration based on their fitness values. Erfani et is discovered by host bird with a probability [0,1]. For
al. [5] explains a method for even generation of Pareto optimization, the quality or fitness of a solution is propor-
Frontier in Multiobjective Optimization known as di- tional to the value of the objective function. In case of test
rected search domain (DSD). Yang et al. [16] proposed data generation using cuckoo search, we first initialize the
Cuckoo Search technique for optimization. test cases from the domain of the program by considering
that each egg in a nest represents a solution, and a cuckoo
egg represent a new solution. The aim is to use the new
3 TEST CASE GENERATION USING MULTI-
and potentially better solution (cuckoos) to replace a not-
OBJECTIVE GENETIC ALGORITHM
so-good solution in the nest.
Genetic Algorithms are often used for Single-objective
problems. According to single objective concept, every Algorithm (Cuckoo search for testing)
proposal of solution is represented by a vector A of the
independent variables, which is coded in a chromosome. Initialize test cases from the domain of the program to
Whenever a new solution is proposed by the genetic algo- be tested at random;
rithm then the objective function is evaluated and a rank- do
ing of the individuals in the current population is dynam- (/* determine which test case should survive with fit-
ically updated, based on their fitness values. This ranking ness function*/)
is used in the selection procedure based on the concept of Objective function: f(A), A=(a1,a2,a3,...........,ak);
“Survival of the fittest”. After that cross-over and muta- Generate an initial population of n host nests;
tion phases are conducted. An algorithm based on these while ((MaxGeneration|| (Stop Condition))
procedures is referred to as a Steady-Single state genetic (/*Get a cuckoo (solution) ‘r’ randomly and evaluate it
algorithm. When using single objective genetic algorithm, on the basis of fitness function Fr */)
each population is designated by single objective, thus it Fr f(Ar)
lack behind in providing optimal solution with respect to (/*For Maximization */)
coverage of the code within minimum time-span. There- Select another cuckoo‘k’ randomly;
fore, multi-objective genetic algorithm is taken into con- if(Fr > Fk)
sideration for more optimum results. replace ‘k’ by the new solution
Multi-objective genetic algorithm provides better esti- end if
mated accuracy and associated cost than Single-objective end while
genetic algorithm. For each point A in the search space, (/* Purpose: To keep the best solution */)
we must consider several objective functions fi(A), Crossover (Population);
i=1,2,…, and then identify that A* which gives rise to the Produce the next new generation of test cases;
best compromise among the various objective functions. Mutate the new generation of test cases;
Let us consider N different objective functions fi(A), Evaluate the test cases;
i=1,2,…,N where A represents the vector of independent
variables identifying a generic proposal of solution. Here According to the algorithm, at first, we randomly gen-
solution A dominates solution B if A is better on all objec- erate set of initial test cases (population of n host nests).
tives, i.e. if fi(A)>fi(B) for i=1,2,…,N. The solutions not Then each test case is modelled as a chromosome
dominated by any other are said to be non-dominant so- representing input values. Next each chromosome is eva-
lutions. Once a population of individuals (chromosomes) luated on the basis of fitness function. Higher fitness is
{A} has been created, then their ranking should be done. the better solution. Good chromosomes are those that
All non-dominant individuals in the current population discover the errors. Fitter individuals have more chance
are identified. The best solution assigned the rank 1 and to reproduce. Based on fitness value, chromosomes are
then the next set of non-dominated individuals are identi- selected to reproduce offspring for a new generation. Fit-
fied and assigned rank 2. This process continues until ness function is based on Cuckoo Search where we select
every solution in the population has been ranked. a cuckoo (individual solution i.e. ‘r’) randomly and eva-
luate it by using Fr f(Ar) for maximization. Then, again
choose a cuckoo (solution) ‘k’ randomly. If value of fit-
4 PROPOSED ALGORITHM
ness function for solution ‘r’ is greater than fitness func-
In this paper, we propose Multi-objective genetic tion for solution ‘k’, then we replace solution ‘k’ by new
algorithm for software testing. In order to achieve Multi- solution. The search proceeds through a number of gen-
objective optimization, we use a type of evolutionary al- erations until the termination condition has been met.
gorithm i.e. Cuckoo Search for the generation of test cas- After evaluating on the basis of fitness function, crossover
JOURNAL OF COMPUTING, VOLUME 3, ISSUE 4, APRIL 2011, ISSN 2151-9617
HTTPS://SITES.GOOGLE.COM/SITE/JOURNALOFCOMPUTING/
WWW.JOURNALOFCOMPUTING.ORG 119

and mutation phase take place. The aim is to eliminate zation, July 2010, (1-22) http://www.informaworld.com .
bad test cases that are not able to expose any error, while [6] Gupta N.K. and Rohil M.K. (2008), Using Genetic Algo-
increasing the number of good test cases that have a high rithm for Unit Testing of Object Oriented Software, Procced-
probability of producing an erroneous output. ings of International Conference on Emerging Trends in En-
gineering and Technology, (308-313) © 2008 IEEE.
[7] Jones B.F., Sthamer H.H. and Eyres D.E. (1996), Automat-
5 CONCLUSION ic Structural Testing using Genetic Algorithm, International
Although a number of testing techniques and adequacy Haifa Verification Conference, Haifa, Israel, Springer 2006,
criteria have been suggested in the literature but it has ISBN 3-540-32604-9 (134-148).
been observed that no technique/criteria is sufficient [8] Khor S and Grogono Peter (2004), Using a Genetic Algo-
enough to ensure the delivery of fault free software con- rithm and Formal Concept Analysis to Generate Branch
Coverage Test Data Automatically, Proceedings of the 19th
sequential to the need of automatic test case generation
International Conference on Automated Software Engineer-
to minimize the cost of testing. Effective and efficient
ing (ASE2004) 1068-3062/04 © 2004 IEEE.
test data generation is one of the major challenging and
[9] Krishnamoorthi R and Mary S.A. (2009), Regression Test
timeconsuming tasks within the software testing Suite Prioritization using Genetic Algorithm, International
process. Researchers have proposed different methods Journal of Hybrid Information Technology, Vol.2, No.3, July
to generate test data automatically; however, those me- 2009.
thods suffer from different drawbacks. In contarst to it, [10] Last M, Eyal S and Kandel A (2006), Effective Black Box
a Multi-objective Genetic Algorithm based approach Testing with Genetic Algorithm.
that tries to generate a set of test data that is expected to www.springerlink.com/index/w316n3854q861050.pdf
cover a given set of target paths. Here, we have used [11] Lin J.C. and Yeh P.L. (2009), Using Genetic Algorithm
Cuckoo Search for test data generation, which provides for Test Case Generation in Path Testing.
Multi-objective optimisation. Test data is often generat- www.sersc.org/journals/IJSEIA/vol3_no4_2009/6.pdf
ed by hand, so demand for automatic test data genera- [12] Masud M, Nayak A, Zaman M and Bansal N (2005), A
tion is high in these sectors. The overall aim is to devel- Strategy for Mutation Testing using Genetic Algorithm,
op a self-learning algorithm that has the ability to (1049-1052) © 2005 IEEE.
process and incorporate new information as the work www.ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=155715
environment changes. The primary objective is to pro- 6
pose a Multi-objective GA-based software test data ge- [13] Singh K and Kumar R (2010), Optimization of Function-
al Testing using Genetic Algorithm, International Jounal of
nerator and to demonstrate its feasibility.
Innovation, Management and Technology, Vol.1, No.1, April
2010, ISSN:2010-0248.
[14] Srivastava P.R. and Kim T.H. (2009), Application of Ge-
ACKNOWLEDGMENT netic Algorithm in Software Testing, International Journal of
We wish to thank our institution i.e. ITM University and Software Engineering and its Applications, Vol.3, No.4, Oc-
Banasthali University for their co-operation. tober 2009.
[15] Wasif A, Richard (2009), Suitability of genetic program-
REFERENCES ming for software reliability growth modeling, Blekinge In-
stitute of Technology, S-372 25 Ronneby.
[1] Aljahdali S.H. and Telbang E.E. (2009), Software Reliabli-
www.richard.torkar.googlepages.com/afzal_csa08_suitabilit
ty Prediction using Multi - objective Genetic Algorithm, (293-
y_gp_SRGM.pdf
300) © 2009 IEEE.
[16] Yang X.S. and Deb S (2010), Engineering Optimisation
www.ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=506933
by Cuckoo Search, www.arxiv.org/abs/1005.2908 Interna-
9
tional Journal of Mathematical Modelling and Numerical
[2] Beydeda S and Gruhn V (2003), Test Case Generation
Optimization, Vol. 1, No. 4, 330-343(2010).
according to the Binary Search Strategy, Proceedings of 27th
[17]http://en.wikipedia.org/wiki/Cuckoo_search
Annual International Computer Software and Applications
Conference, © 2003 IEEE.
http://doi.ieeecomputersociety.org/10.1109/CMPSAC.2003. Kavita Choudhary is Assistant Professor in Department of Comput-
1245318 er Science (ITM University, Gurgaon). Currently, she is pursuing
[3] Chen Y and Zhong Y (2008), Automatic Path-oriented Phd. from Banasthali University. She did her Post graduation with
distinction from Guru Gobind Singh Indraprastha University in 2010.
Test Data Generation using a Multi-population Genetic Al- She did her graduation, B.Tech (CSE),in honors from University of
gorithm, Proceeding of International Conference on Natural Rajasthan in 2005.She have more than five year of teaching expe-
Computation, (566-570) © 2008 IEEE. rience. Her core subjects are Software Engineering, Computer Net-
[4] Deb K, Pratap A, Agarwal S and Meyarivan T (2002), A works and Software Testing. Member of CSI.
Fast and Elitist Multi-objective Genetic Algorithm: NSGA-II,
Prof. G.N.Purohit is an emeritus professor at Banasthali University in
IEEE Transactions on Evolutionary Computation, Vol.6, AIM & ACT department. He is Dean over there. His areas of specialization
No.2, April 2002. are Discrete Mathematics, Computer networks and Software Engineering.
[5] Erfani T and Utyuzhnikov (2010), Directed Search Do-
main: A Method for Even Generation of Pareto Frontier in
Multi-objective Optimization, Journal of Engineerig Optimi-

Anda mungkin juga menyukai