基于遗传算法的软件测试技术文档格式.docx
《基于遗传算法的软件测试技术文档格式.docx》由会员分享,可在线阅读,更多相关《基于遗传算法的软件测试技术文档格式.docx(22页珍藏版)》请在冰豆网上搜索。
![基于遗传算法的软件测试技术文档格式.docx](https://file1.bdocx.com/fileroot1/2023-2/2/a9b650d0-54ba-4378-8b88-b96779cedf6c/a9b650d0-54ba-4378-8b88-b96779cedf6c1.gif)
AzadHindFauzMarg,Dwarka,Sector-3,NewDelhi-110078,India
Abstract
Theoverallaimofthesoftwareindustryistoensuredeliveryofhighqualitysoftwaretotheenduser.Toensurehighqualitysoftware,itisrequiredtotestsoftware.Testingensuresthatsoftwaremeetsuserspecificationsandrequirements.However,thefieldofsoftwaretestinghasanumberofunderlyingissueslikeeffectivegenerationoftestcases,prioritisationoftestcasesetcwhichneedtobetackled.Theseissuesdemandoneffort,timeandcostofthetesting.Differenttechniquesandmethodologieshavebeenproposedfortakingcareoftheseissues.Useofevolutionaryalgorithmsforautomatictestgenerationhasbeenanareaofinterestformanyresearchers.GeneticAlgorithm(GA)isonesuchformofevolutionaryalgorithms.Inthisresearchpaper,wepresentasurveyofGAapproachforaddressingthevariousissuesencounteredduringsoftwaretesting.
Keywords:
Softwaretesting,GeneticAlgorithm
1.Introduction
Testingisprimarilydoneonsoftwareaswellasinwebfortestingclientandserverarchitecture.Softwaretestingisoneofthemajorandprimarytechniquesforachievinghighqualitysoftware.Softwaretestingisdonetodetectpresenceoffaults,whichcausesoftwarefailure.However,softwaretestingisatimeconsumingandexpensivetask[29],[20],[28].Itconsumesalmost50%ofthesoftwaresystemdevelopmentresources[3],[20].Softwaretestingcanalsobedefinedasprocessofverifyingandvalidatingsoftwaretoensurethatsoftwaremeetsthetechnicalaswellasbusinessrequirementsasexpected[16].
Verificationisdonetoensurethatthesoftwaremeetsspecificationandisclosetostructuraltestingwhereasvalidationisclosetothefunctionaltestingandisdone
byexecutingsoftwareundertest(SUT)[18].Broadly,testingtechniquesincludefunctional(blackbox)andstructural(whitebox)testing.Functionaltestingisbased
onfunctionalrequirementswhereasstructuraltestingisdoneoncodeitself[13][10][24].Grayboxtestingishybridofwhiteboxtestingandblackboxtesting[8].
Testingcanbedoneeithermanuallyorautomaticallybyusingtestingtools.Itisfoundthatautomatedsoftwaretestingisbetterthanmanualtesting.However,veryfewtestdatagenerationtoolsarecommerciallyavailabletoday[14].Varioustechniqueshavebeenproposedforgeneratingtestdataortestcasesautomatically.Recently,lotofworkisbeingdonefortestcasesgenerationusingsoftcomputingtechniqueslikefuzzylogic,neuralnetworks,GA,geneticprogrammingandevolutionarycomputationprovidingkeystotheproblemareasofsoftwaretesting.
Evolutionarytestingisanemergingmethodologyforautomaticallyproducinghighqualitytestdata[10].GAiswellknownformoftheevolutionaryalgorithmsconceivedbyJohnHollandinUnitedStatesduringlatesixties[6][25].In[21],evolutionaryblackboxtestingisalsoappliedonembeddedsystemstotestitsfunctionalandnon-functionalproperties.GAhasbeenappliedinmanyoptimizationproblemsforgeneratingtestplansforfunctionalitytesting,feasibletestcasesandinmanyotherareas[5][15].GAhasalsobeenusedinmodelbasedtestcasegeneration[3][23][26][27].Inobjectorientedunittestingaswellasintheblackboxtesting,GAisusedforautomaticgenerationoftestcases[23],[10],[15].Concerningtestingofwebapplications,manytools,newtechniquesandmethodshavebeendevelopedtoaddressissueslikemaintainability,testability,security,performance,correctnessandreliabilityofwebapplication[8].Webapplicationsarecomposedofwebpagesandcomponentsandinteractionbetweenthemexecuteswebservers,HTTP,browser(theclientside)andnetworks.Awebpageisinformationviewedontheclientsideinasinglebrowserwindow[16].In[30],usersessiondataofwebapplicationisusedtogeneratetestcasesbyapplyingGA.
Inthisresearchpaper,asurveyofdifferentsoftwaretestingtechniqueswhereGAisefficientlyusedispresented.Thispaperisdividedinto4sections.Section2describesbrieflytheworkingofaGA.Insection3,applicationsofGAindifferenttypesofsoftwaretestingisdescribed.Section4concludesthepaperandgivesanoverviewofourfuturework.
2.GeneticAlgorithm:
ABriefIntroduction
Inthepast,evolutionaryalgorithmshavebeenappliedinmanyreallifeproblems.GAisonesuchevolutionary
algorithm.GAhasemergedasapractical,robustoptimizationtechniqueandsearchmethod.AGAisasearchalgorithmthatisinspiredbythewaynatureevolvesspeciesusingnaturalselectionofthefittestindividuals.
Thepossiblesolutionstoproblembeingsolvedarerepresentedbyapopulationofchromosomes.Achromosomeisastringofbinarydigitsandeachdigitthatmakesupachromosomeiscalledagene.Thisinitialpopulationcanbetotallyrandomorcanbecreatedmanuallyusingprocessessuchasgreedyalgorithm.ThepseudocodeofabasicalgorithmforGAisasfollows[6]:
-
Initialize(population)
Evaluate(population)
While(stoppingconditionnotsatisfied)
{
Selection(population)
Crossover(population)
Mutate(population)
}
GAusesthreeoperatorsonitspopulationwhicharedescribedbelow:
ΣSelection:
Aselectionschemeisappliedtodeterminehowindividualsarechosenformatingbasedontheirfitness.Fitnesscanbedefinedasacapabilityofanindividualtosurviveandreproduceinanenvironment.Selectiongeneratesthenewpopulationfromtheoldone,thusstartinganewgeneration.Eachchromosomeisevaluatedinpresentgenerationtodetermineitsfitnessvalue.Thisfitnessvalueisusedtoselectthebetterchromosomesfromthepopulationforthenextgeneration.
ΣCrossoverorRecombination:
Afterselection,thecrossoveroperationisappliedtotheselectedchromosomes.Itinvolvesswappingofgenesorsequenceofbitsinthestringbetweentwoindividuals.Thisprocessisrepeatedwithdifferentparentindividualsuntilthenextgenerationhasenoughindividuals.Aftercrossover,themutationoperatorisappliedtoarandomlyselectedsubsetofthepopulation.
ΣMutation:
Mutationalterschromosomesinsmallwaystointroducenewgoodtraits.Itisappliedtobringdiversityinthepopulation.
3.UsingGeneticAlgorithminSoftware
Testing
InthissectionwewilldiscussindetailtheapplicationsofGAindifferentareasoftestingliketestplanning[5],minimizationoftestcasesinregressiontesting[11],modelbasedtesting[3][23][26][27]andwebtesting[30].
3.1ApplicationsofGAinWhiteBoxTesting
Structuraltestingcanbedoneintheformofdataflowtestingorpathtesting.Pathtestinginvolvesgeneratingasetofpathsthatwillcovereverybranchintheprogramandfindingthesetoftestcasesthatwillexecuteeverypathinthissetofprogrampath[16][18].Indataflowtesting,thefocusisonthepointsatwhichvariablesreceivevaluesandthepointsatwhichthesevaluesareused[2].Next,wewilldiscussbrieflysomeoftheresearchworkregardingtheapplicationsofGAinwhiteboxtesting.
3.1.1DataFlowTesting
M.R.Girgis
Girgis[7]hasproposedastructuralorientedautomatictestdatagenerationtechniquethatusesaGAguidedbythedataflowdependenciesintheprogramtofulfiltheall-usescriterion.TheprogramtobetestedisconvertedintoaControlFlowGraph(CFG)whereeachnoderepresentsablockinaprogramandtheedgesoftheflowgraphdepictthecontrolflowofthestatements.
Variablesinaprogramundertestaredividedinto'
cuses'
and'
p-uses’variables.c-usesvariablesarethosewhichareusedincomputationsorasapredicatesinaprogramwhereasp-usesvariablesareassociatedwithedgesoftheflowgraph.Inordertofulfiltheall-usescriteria,thedef-clearpath(apathcontainingnonewdefinitionofacurrentvariable)fromeachdefinitionofavariabletoeachuseofthatvariableneedtobedetermined.Tofindoutthesetofpathssatisfyingallusescriteria,itisnecessarytodeterminedefc-use(dcu)anddefp-use(dpu)ofavariablei.e.thedef-clearpathstotheirc-useatnodeianddef-clearpathstotheirp-useatedge(i,j).
Usingthelocationofavariabledefsandusesinaprogramundertest,combinedwiththe‘Basicstatereachalgorithm’,thesetsdcu(i)anddpu(i,j)aredetermined.Fromthe‘Basicstatereachalgorithm’twosetsreach(i)andavail(i)aredeterminedwherereach(i)isthesetofallvariabledefsthat“reach”nodeiandsetavail(i)isthesetofall“available”variabledefsatnodeii.e.Theunionofsetofglobaldefsatnodeiandthesetofalldefsthatreachthisnode.
dcu(i):
reach(i)«
c-use(i)
(1)
dpu(i,j):
avail(i)«
p-use(i,j)
Listofalldcuanddpusetsintheprocedurecallssatisfyingtheall-usescriterionaredeterminedalongwithkillingnodes(nodescontainingotherdefinitionofavariableinacurrentpath)thatmustnotbeincludedinthecurrentpath.Inthisapproach,GAacceptsinstrumentedversionoftheprogramundertest,thelistofdef-usesetstobecovered,thenumberofinputvariables,andthedomainandtheprecisionofeachinputvariablesasaninput.Abinaryvectorisusedtorepresentachromosome.Thelengthoftheinputisdeterminedbythedomainandtheprecision.ThedomainisrepresentedbyDi=[ai,bi]whereeachvariableinaprogramtakesvaluesfromtherange[ai,bi].EachdomainDishouldbecutintoequalsizerangesifdecimalplacesdiisdesiredforavariab