a new testing approach using cuckoo search to achieve multi-objective genetic algorithm

Upload: journal-of-computing

Post on 08-Apr-2018

224 views

Category:

Documents


1 download

TRANSCRIPT

  • 8/6/2019 A new Testing approach using Cuckoo Search to achieve Multi-Objective Genetic Algorithm

    1/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 CuckooSearch to achieve Multi-Objective Genetic

    AlgorithmKavita 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

    oftware Testing is an area of software engineeringwhich deals with finding faults in software. SoftwareTesting remains the primary technique used to gain

    customers confidence in the software. The process of test-ing any software system is a difficult task which is timeconsuming and costly. The objective of software testing isto design a set of minimal number of test cases such thatit finds as many faults as possible. Mainly, the test datageneration activity is manual, but, nowadays, softwaretesting field is diverted towards automatic generation of

    test cases. An automated software testing reduces the costof developing software. The benefits of automated soft-ware testing are the test preparation can be done in ad-vance, the test execution would be considerably fast andthe confidence in the testing can be increased. We pro-pose to consider Multi-objective Genetic Algorithm ap-proach for software testing. It provides a search metho-dology, which uses the concept of natural evolution.Cuckoo search (CS) [17] is an optimization algorithm de-veloped by Xin-She Yang and Suash Deb in 2009. It wasinspired by the obligate brood parasitism of some cuckoospecies by laying their eggs in the nests of other host birds(of other species). Some host birds can engage direct con-

    flict with the intruding cuckoos. For example, if a hostbird discovers the eggs are not their own, it will eitherthrow these alien eggs away or simply abandon its nestand build a new nest elsewhere. Many engineering prob-lems do have multiple objectives i.e. maximize perfom-

    ance, increasing reliability etc.

    2 LITERATURE SURVEY

    Aljahdali et al. [1] used multi-objective genetic algorithmbased approach as one of the computational intelligencetechniques by predicting the faults during the softwaretesting process using software faults historical data. Market al. [10] introduced a Fuzzy-Based Age Extension ofGenetic Algorithm approach to generation of effective

    black-box test cases. Kalyanmoy et al. [4] have proposed acomputationally fast and elitist MOEA (Multi-ObjectiveEvolutionary Algorithm) based on a nondominated sort-ing approach. Krishnamoorthi et al. [9] describes a time-aware coverage based test suite prioritization technique.Sami et al. [2] explained a novel approach for test casegeneration based on binary search which does not requireparameter calibration. Jones et al. [7] used genetic algo-rithm for structural testing and was based on ensuringthat all branches in the software were exercised. The fit-ness function was based on the predicate associated witheach branch, and a value for fitness derived from ham-ming distance. In the case of loops, the fitness was based

    on the number of iterations required. The quality of testdata produced is high, because the tests can be directedthrough the fitness function to the areas where faults aremost likely to be revealed. Lin et al. [11] explained howgenetic algorithms can be used to generate test cases au-tomatically for path testing and also used ExtendedHamming Distance to derive a fitness function. Susan etal. [8] described automatic generation of test data usingbranch coverage. Masud et al. [12] proposed a model toreveal faults and kill mutants using Genetic Algorithms.The model used already stored source and mutant pro-gram (changed program) and then divided in small units.

    Kavita Choudhary is with the Department of Computer Science, ITM Uni-versity, Gurgaon.

    Prof. G.N. Purohit is with the Department of AIM&ACT, Banasthali Uni-versity, Rajasthan..

    S

  • 8/6/2019 A new Testing approach using Cuckoo Search to achieve Multi-Objective Genetic Algorithm

    2/3

    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 findfault in each unit or kills each mutant unit. Nirmal et al.[6] used genetic algorithm for unit testing of object-oriented software. Yong et al. [3] applied multi-population genetic algorithm (MPGA) for generating au-tomatic path-oriented test data which selects individualsfor free migration based on their fitness values. Erfani et

    al. [5] explains a method for even generation of ParetoFrontier in Multiobjective Optimization known as di-rected search domain (DSD). Yang et al. [16] proposedCuckoo Search technique for optimization.

    3 TEST CASE GENERATION USING MULTI-OBJECTIVE GENETIC ALGORITHM

    Genetic Algorithms are often used for Single-objectiveproblems. According to single objective concept, everyproposal of solution is represented by a vector A of theindependent variables, which is coded in a chromosome.Whenever a new solution is proposed by the genetic algo-

    rithm then the objective function is evaluated and a rank-ing of the individuals in the current population is dynam-ically updated, based on their fitness values. This rankingis used in the selection procedure based on the concept ofSurvival of the fittest. After that cross-over and muta-tion phases are conducted. An algorithm based on theseprocedures is referred to as a Steady-Single state geneticalgorithm. When using single objective genetic algorithm,each population is designated by single objective, thus itlack behind in providing optimal solution with respect tocoverage of the code within minimum time-span. There-fore, multi-objective genetic algorithm is taken into con-sideration for more optimum results.

    Multi-objective genetic algorithm provides better esti-mated accuracy and associated cost than Single-objectivegenetic algorithm. For each point A in the search space,we must consider several objective functions fi(A),i=1,2,, and then identify that A* which gives rise to thebest compromise among the various objective functions.Let us consider N different objective functions fi(A),i=1,2,,N where A represents the vector of independentvariables identifying a generic proposal of solution. Heresolution A dominates solution B if A is better on all objec-tives, i.e. if fi(A)>fi(B) for i=1,2,,N. The solutions notdominated by any other are said to be non-dominant so-lutions. Once a population of individuals (chromosomes)

    {A} has been created, then their ranking should be done.All non-dominant individuals in the current populationare identified. The best solution assigned the rank 1 andthen the next set of non-dominated individuals are identi-fied and assigned rank 2. This process continues untilevery solution in the population has been ranked.

    4 PROPOSED ALGORITHM

    In this paper, we propose Multi-objective geneticalgorithm for software testing. In order to achieve Multi-objective optimization, we use a type of evolutionary al-gorithm i.e. Cuckoo Search for the generation of test cas-

    es. Till now, Cuckoo Search is used for optimization.Yang and Deb introduces Cuckoo Search in 2009. CuckooSearch [16] follows three rules :- 1) Each Cuckoo lays oneegg at a time, and dump its egg in randomly chosen nest;2) The best nest with high quality of eggs will carry overto the next generations; and 3) The egg laid by a Cuckoois discovered by host bird with a probability [0,1]. For

    optimization, the quality or fitness of a solution is propor-tional to the value of the objective function. In case of testdata generation using cuckoo search, we first initialize thetest cases from the domain of the program by consideringthat each egg in a nest represents a solution, and a cuckooegg represent a new solution. The aim is to use the newand potentially better solution (cuckoos) to replace a not-so-good solution in the nest.

    Algorithm (Cuckoo search for testing)

    Initialize test cases from the domain of the program tobe tested at random;

    do(/* determine which test case should survive with fit-ness function*/)Objective function: f(A), A=(a1,a2,a3,...........,ak);Generate an initial population of n host nests;while ((MaxGeneration|| (Stop Condition))(/*Get a cuckoo (solution) r randomly and evaluate iton the basis of fitness function Fr */)Fr f(Ar)(/*For Maximization */)Select another cuckook randomly;if(Fr > Fk)replace k by the new solution

    end ifend while(/* Purpose: To keep the best solution */)Crossover (Population);Produce the next new generation of test cases;Mutate the new generation of test cases;Evaluate the test cases;

    According to the algorithm, at first, we randomly gen-erate set of initial test cases (population of n host nests).Then each test case is modelled as a chromosomerepresenting input values. Next each chromosome is eva-luated on the basis of fitness function. Higher fitness is

    the better solution. Good chromosomes are those thatdiscover the errors. Fitter individuals have more chanceto reproduce. Based on fitness value, chromosomes areselected to reproduce offspring for a new generation. Fit-ness function is based on Cuckoo Search where we selecta cuckoo (individual solution i.e. r) randomly and eva-luate it by using Fr f(Ar) for maximization. Then, againchoose a cuckoo (solution) k randomly. If value of fit-ness function for solution r is greater than fitness func-tion for solution k, then we replace solution k by newsolution. The search proceeds through a number of gen-erations until the termination condition has been met.After evaluating on the basis of fitness function, crossover

  • 8/6/2019 A new Testing approach using Cuckoo Search to achieve Multi-Objective Genetic Algorithm

    3/3

    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 eliminatebad test cases that are not able to expose any error, whileincreasing the number of good test cases that have a highprobability of producing an erroneous output.

    5 CONCLUSION

    Although a number of testing techniques and adequacycriteria have been suggested in the literature but it hasbeen observed that no technique/criteria is sufficientenough to ensure the delivery of fault free software con-sequential to the need of automatic test case generationto minimize the cost of testing. Effective and efficienttest data generation is one of the major challenging andtimeconsuming tasks within the software testingprocess. Researchers have proposed different methodsto generate test data automatically; however, those me-thods suffer from different drawbacks. In contarst to it,a Multi-objective Genetic Algorithm based approachthat tries to generate a set of test data that is expected tocover a given set of target paths. Here, we have usedCuckoo Search for test data generation, which providesMulti-objective optimisation. Test data is often generat-ed by hand, so demand for automatic test data genera-tion is high in these sectors. The overall aim is to devel-op a self-learning algorithm that has the ability toprocess and incorporate new information as the workenvironment changes. The primary objective is to pro-pose a Multi-objective GA-based software test data ge-nerator and to demonstrate its feasibility.

    ACKNOWLEDGMENT

    We wish to thank our institution i.e. ITM University andBanasthali University for their co-operation.

    REFERENCES

    [1] Aljahdali S.H. and Telbang E.E. (2009), Software Reliabli-ty Prediction using Multi - objective Genetic Algorithm, (293-300) 2009 IEEE.www.ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=5069339[2] Beydeda S and Gruhn V (2003), Test Case Generationaccording to the Binary Search Strategy, Proceedings of 27thAnnual International Computer Software and ApplicationsConference, 2003 IEEE.

    http://doi.ieeecomputersociety.org/10.1109/CMPSAC.2003.1245318[3] Chen Y and Zhong Y (2008), Automatic Path-orientedTest Data Generation using a Multi-population Genetic Al-gorithm, Proceeding of International Conference on NaturalComputation, (566-570) 2008 IEEE.[4] Deb K, Pratap A, Agarwal S and Meyarivan T (2002), AFast and Elitist Multi-objective Genetic Algorithm: NSGA-II,IEEE Transactions on Evolutionary Computation, Vol.6,No.2, April 2002.[5] Erfani T and Utyuzhnikov (2010), Directed Search Do-main: A Method for Even Generation of Pareto Frontier inMulti-objective Optimization, Journal of Engineerig Optimi-

    zation, July 2010, (1-22) http://www.informaworld.com .[6] Gupta N.K. and Rohil M.K. (2008), Using Genetic Algo-rithm for Unit Testing of Object Oriented Software, Procced-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-ic Structural Testing using Genetic Algorithm, InternationalHaifa Verification Conference, Haifa, Israel, Springer 2006,

    ISBN 3-540-32604-9 (134-148).[8] Khor S and Grogono Peter (2004), Using a Genetic Algo-rithm and Formal Concept Analysis to Generate BranchCoverage Test Data Automatically, Proceedings of the 19thInternational Conference on Automated Software Engineer-ing (ASE2004) 1068-3062/04 2004 IEEE.[9] Krishnamoorthi R and Mary S.A. (2009), Regression TestSuite Prioritization using Genetic Algorithm, International

    Journal of Hybrid Information Technology, Vol.2, No.3, July2009.[10] Last M, Eyal S and Kandel A (2006), Effective Black BoxTesting with Genetic Algorithm.www.springerlink.com/index/w316n3854q861050.pdf

    [11] Lin J.C. and Yeh P.L. (2009), Using Genetic Algorithmfor Test Case Generation in Path Testing.www.sersc.org/journals/IJSEIA/vol3_no4_2009/6.pdf[12] Masud M, Nayak A, Zaman M and Bansal N (2005), AStrategy for Mutation Testing using Genetic Algorithm,(1049-1052) 2005 IEEE.www.ieeexplore.ieee.org/xpls/abs_all.jsp?arnumber=1557156[13] Singh K and Kumar R (2010), Optimization of Function-

    al Testing using Genetic Algorithm, International Jounal ofInnovation, Management and Technology, Vol.1, No.1, April2010, ISSN:2010-0248.[14] Srivastava P.R. and Kim T.H. (2009), Application of Ge-

    netic Algorithm in Software Testing, International Journal of

    Software Engineering and its Applications, Vol.3, No.4, Oc-tober 2009.[15] Wasif A, Richard (2009), Suitability of genetic program-ming for software reliability growth modeling, Blekinge In-stitute of Technology, S-372 25 Ronneby.www.richard.torkar.googlepages.com/afzal_csa08_suitability_gp_SRGM.pdf[16] Yang X.S. and Deb S (2010), Engineering Optimisationby Cuckoo Search, www.arxiv.org/abs/1005.2908 Interna-tional Journal of Mathematical Modelling and NumericalOptimization, Vol. 1, No. 4, 330-343(2010).[17]http://en.wikipedia.org/wiki/Cuckoo_search

    Kavita Choudhary is Assistant Professor in Department of Comput-er Science (ITM University, Gurgaon). Currently, she is pursuingPhd. from Banasthali University. She did her Post graduation withdistinction from Guru Gobind Singh Indraprastha University in 2010.She did her graduation, B.Tech (CSE),in honors from University ofRajasthan in 2005.She have more than five year of teaching expe-rience. Her core subjects are Software Engineering, Computer Net-works and Software Testing. Member of CSI.

    Prof. G.N.Purohit is an emeritus professor at Banasthali University in

    AIM & ACT department. He is Dean over there. His areas of specialization

    are Discrete Mathematics, Computer networks and Software Engineering.