Proceedingsofthe3rdInternationalConferenceonComputingandInformatics,ICOCI2011,8-9June,2011Bandung,IndonesiaPaperNo.
021226ANIMPROVEDALGORITHMINTESTCASEGENERATIONFROMUMLACTIVITYDIAGRAMUSINGACTIVITYPATHNorLailyHashim1,YasirD.
Salman21UniversitiUtaraMalaysia,Malaysia,laily@uum.
edu.
my2UniversitiUtaraMalaysia,Malaysia,s820400@uum.
edu.
myABSTRACT.
ThispaperproposedanimprovedalgorithmtoautomaticallygeneratetestcasesdirectlyfromUMLactivitydiagramusinganactivitygraph.
ThisalgorithmhasbeenimplementedasaprototypeusingUMLactivitydiagramsasinputstogeneratetestcases.
Thesegeneratedtestcasesaregeneratedautomaticallyarecomparedtotestcasesthataregeneratedmanuallyinordertoevaluatethealgorithm'susabilityandreliability.
Theresultshowsthatthetestcasesgeneratedbythedevelopedtestcasegeneratorprogramarethesameastheonemanuallyderived.
Keywords:testcasegeneration,automatedgeneration,testcaseINTRODUCTIONTestcasegenerationisoneofthemostimportantelementsforthetestingeffortsforprogramsandapplications(Linzhangetal.
,2004).
Itisespeciallycomplicatedwhenasystemcontainssimultaneouslyexecutingparticipants,sinceasystemlikethatcanshowdifferentresponsesdependingonthesimultaneousoccurrenceconditions.
AUnifiedModellingLanguage(UML)activitydiagramisasuitablemodellinglanguagefordescribinginteractionsbetweensystemobjectsgiventhatanactivitydiagramcanbeconvenientlyusedtocapturebusinessprocesses,workflowsandinteractionscenarios(Kimetal.
,2007).
ManyhavegeneratedtestcasesfromUMLactivitydiagramsbygeneratingthemmanuallytotestthesystem(Linzhangetal.
,2004;Kundu&Samanta,2009;Kimetal.
,2007).
Manygeneratetestcasesautomaticallyusingdifferentmethods(Chenetal.
,2009;Javed,Strooper&Watson,2009),howevernoneofthesestudieshasrevealedthealgorithmthattheyhaveused.
Kundu&Samanth(2009)havedevelopedanalgorithmtogeneratetestcasesusingactivitypaths.
Theiralgorithmhasneverbeenimplementedandthisalgorithmneedsanactivitygraphthathasbeengeneratedmanuallyfromtheactivitydiagram.
Theiralgorithmalsoneedstoenterthetypeofeachnodemanuallyandapplysomerulestogettheresultpaths.
ThispaperfocusesonextendingKundu&Samanth(2009)'salgorithmusedingeneratingtestcasesusingUMLactivitydiagrambyapplyingactivitypathapproach,inwhichthetestcasesaregeneratedautomaticallygenerated.
Theactivitypathisamethodtocalculateallpossiblepathsfromtheactivitydiagrams,convertedeachnumberinthepathtoitsoriginaldata,andfromtherewillgeneratethetestcases.
Proceedingsofthe3rdInternationalConferenceonComputingandInformatics,ICOCI2011,8-9June,2011Bandung,IndonesiaPaperNo.
021227BACKGROUNDThefollowingarethemainconceptsappliedinthisstudy.
UMLActivityDiagramUMLisastandardthatcontainsalargesetofmodellingconceptsthatarerelatedincomplexways.
SinceUMLbecameastandardofOMGin1997,UMLmodelshavebecomemainclassofartefactsinsoftwaredevelopmentprocesses.
UMLprovidesanumberofdiagramstodescribedifferentaspectsofsoftwareartefacts.
UMLactivitydiagramsillustratethesequentialcontrolflowsofactivities.
Theycanbeusedtorepresentcontrolflowofanoperationormodelthedynamicaspectsofagroupofobjects,whichformakindofdesignspecificationsforprograms(Chenatal.
,2009).
Inordertodirectlyreusetheactivitydiagramsmodelingofanoperationasatestmodeltogeneratetestcases,itisnecessarytofollowthetestabilityrequirement.
Anactivitydiagramshouldonlyhaveoneinitialactivitystate,pairofbranchesandmerges,pairofforksandjoins.
Theownerobjectofeachactivitystateshouldbelabeledbyswimlanes,orbelabeledinthenameofactivitystate.
Everynodeotherthantheinitialnodeandfinalnodehasatleastoneoutgoingedgeandoneincomingedge,whichmeansallnodesarereachable.
Anyforknodeonlyhastwoexitedges.
Concurrentactivitystateswillnotaccessthesameobjectandonlyexecuteasynchronously(Linzhangetal.
,2004).
ActivitygraphAnactivitygraphisadirectedgraphwhileitsconstructisrepresentedbyeachnodeintheactivitygraph(initialnode,decisionnode,flowfinalnode,guardcondition,joinnode,forknode,etc.
),andfromthateachborderoftheactivitygraphsymbolizesthestreamintheactivitydiagram.
Furthermore,theactivitygraphasshowninFigure1summarizesassembleofanactivitydiagraminanorganizedwaywhichcanbeusedforfurtherautomation(Kundu&Samanta,2009).
Thesenodesareusedfortestcasegenerationduetotheircapabilityfordetectingmorefaultsinthesynchronizationandloopfaultsthantheotherapproaches.
Inadditiontheabilitytoidentifylocationofthefaultswillhelptoreducetestingaffordandhavingmodel-basedtestcasegenerationtoimproveanddevelopdesignquality.
Furthermore,ithasapossibilitytobuiltautomaticallyprototypefortheactivitygraph.
ThealgorithmbyKundu&Samanta(2009)hastakentheactivitygraphasaninputandtheoutputfromitwillbetheactivitypath.
Furthermore,thegeneratedpathswillneedsomeofrulestoapplyontheresultpathstogetallthepossiblepathsthatwillbeneededtogeneratethetestcases.
Figure1.
ActivityGraphforloginscreenProceedingsofthe3rdInternationalConferenceonComputingandInformatics,ICOCI2011,8-9June,2011Bandung,IndonesiaPaperNo.
021228TestCaseGenerationTestcasegenerationhasattractedmoreandmoreresearchattention(Cartaxo,Neto&Machado,2007;Chenatal.
,2009;Heumann,2001;Javed,Strooper,&Watson,2007;Kimetal.
,2007;Kundu&Samanta,2009;Linzhangatal.
,2004;Mingsong,Xiaokang,&Xuandong,2006).
LargenumberofthemfocusedonUMLactivitydiagramasabasedtogeneratethetestcase(Chen,atal,2009;Kundu&Samanta,2009;Kim,Kang,Baik,&Ko,2007;Linzhangatal.
,2004;Mingsong,Xiaokang,&Xuandong,2006),andnoneofthemrevealtheirproposedapproachesoralgorithms,orsharetheirtestingimplementationconductedduringthetesting.
Atestcasespecifiesasetoftestinputs,expectedresults,andexecutionconditionsdevelopedtoverifyobservancewithaspecificrequirementorimplementaparticularprogrampath(Lilly&G,2010).
PROPOSEDALGORITHMFORGENERATINGTESTCASESThefollowingalgorithmwillgenerateallthepossiblepathsfromtheactivitydiagram,andfromtheresultpaths,testcaseswillbegenerated.
Thisalgorithmisevaluatedintermsofitsusabilityandreliabilitybycomparingmanualtestcaseswithtestcasesautomaticallygeneratedfromtheprototypeofthisalgorithm.
ThemanualtestcasesareobtainedfromAlshammari(2010),wherefourtestcasesforstudentfunctionalitiesfromUniversitiUtaraMalaysialearningmanagementsystemcalled,LearningZoneareused.
Thefunctionsarelogin,downloadassignment,changepassword,andforumsearch.
Duetospacelimitation,onlyoneLoginfunctionisusedandpresentedinthispaper.
Algorithm1:GenerateTestCasePartA:variablesusedintheAlgorithmInput:anactivitydiagramOutput:testcaseTofindthenumberofpaths,thefollowingarethevariablesused:TDN-thenumberofnodewhichhastwodirections.
RNN-thenumberofreturnnode.
TDNI-thenumberoftwodirectionsinsideeachreturnnode.
RNNI-thenumberofreturnnodeinsideeachreturnnode.
Basicpathswiththereturnpathsnumber(BPR)=TDN+1Basicpathsnumber(BP)=BPR-RNNNumberofpathsafterreturn(PAR)=TDNI-RNNIThenumberofallpaths(AP)=BP+PAR(s)PartB:Pseudocodeofmethodssupportedinthealgorithm1.
Tofindthebasicpathswiththereturnpaths,thefollowingarethevariablesused:a.
Node-toputthenodesb.
LoopFlag-tokeeptrackoftheloopc.
N1-forthefirstnextofthenodesd.
N2-forthesecondnextofthenodese.
Nodeflag–forkeepingtrackofthevisitednodesf.
End–forknowtheendofthepathBeginLoopFlag=TDN,Node=firstnode,Nodeflag=0,End=trueWhileLoopFlagisnotemptydoWhileEndistruedoProceedingsofthe3rdInternationalConferenceonComputingandInformatics,ICOCI2011,8-9June,2011Bandung,IndonesiaPaperNo.
021229If(it'sthefirstnode)thenputthefirstnodeinthepath;PutthenodefirstnextinN1anditssecondnextinN2;If(N1=0)thenputendtotrue;If(NodeFlag=0andN2=0)thenputN1forthenextnodeinthepath;Elseif(NodeFlag=0andN2!
=0)thenputN1forthenextnodeinthepathandputNodeFlag=1,putNodeFlag=NodeFlag–thenumberoftwodirectionnodebeforeit;Elseif(NodeFlag=1andN2!
=0)thenputN2forthenextnodeinthepathandputNodeFlag=2;Putthenextnodeofthepathasthecurrentnode;EndPutthepathinarray;End2.
Tofoundallthepaths(AP)DuplicatethepathsthathavewithoutEndtothe(TDNI+RNNI)number;Putthereturnpathsinsideittocontinueittothenumberofpathsinsidethereturnpath;Finisheachonefromthesizebasicpaths;Thatwillgeneratethepossiblepaths.
3.
Fromthesaveinformationofeachnode,printoutthedetailsofeachpathtothelastone,whatwillgiveusthetestcase.
AutomaticgenerateforthetestcasefromtheloginactivitydiagramFirst:Usetheactivitydiagram,asshowninFigure2togeneratethetestcasefromit.
Figure2.
ActivityDiagramfor"Login"Usingthealgorithmexplainedearlier,theprototypewillgeneratethefollowingresultasshowninFigure3No.
ofTimes>N>Y>>Proceedingsofthe3rdInternationalConferenceonComputingandInformatics,ICOCI2011,8-9June,2011Bandung,IndonesiaPaperNo.
021230Figure3.
Theprogramresultforthe"login"activitydiagramThisresultcontainsallpossiblepathsthataregeneratedfromthealgorithmbasedongivenactivitydiagramasshowninFigure3.
Thedetailforeachpathtogetherwithsavednodesisusedtogeneratethetestcases.
ThetestcasesgeneratedforLoginactivitydiagramcanbeseeninTable1inthelastcolumn.
Columntwoshowsthebranchconditionsthateachpathfollows.
Table1.
Thegeneratedtestcasesfor"Login"TestcaseSequenceofBranchConditionsActivitySequence1RegID=InvalidTryagain=NoDisplay:Loginhereusingyourusernameandpassword,Display:Sorry,youhaveexceededtheallowednumberofloginattempts.
Restartyourbrowser.
2RegID=ValidDisplay:Loginhereusingyourusernameandpassword,Launchstudentmainviewpage.
3RegID=InvalidTryagain=YesRegID=InvalidTryagain=NoDisplay:Loginhereusingyourusernameandpassword,Display:Invalidlogin,pleasetryagain.
Display:Loginhereusingyourusernameandpassword,Display:Sorry,youhaveexceededtheallowednumberofloginattempts.
Restartyourbrowser.
4RegID=InvalidTryagain=YesRegID=ValidDisplay:Loginhereusingyourusernameandpassword,Display:Invalidlogin,pleasetryagain,Display:Loginhereusingyourusernameandpassword,Launchstudentmainviewpage.
TestResultFourstudentfunctionalitieshavebeenautomaticallygeneratedusingtheproposedtestcasegeneratorprototype.
ThegeneratedtestcasesarecomparedwiththetestcasesmanuallygeneratedbyAlshammari(2010).
Fromthiscomparison,itshowsthatthetestcasesgeneratedTestcasesforeachpathAllpossiblepaths:4pathsarecreatedProceedingsofthe3rdInternationalConferenceonComputingandInformatics,ICOCI2011,8-9June,2011Bandung,IndonesiaPaperNo.
021231bythedevelopedtestcasegeneratorprogramarethesameastheonemanuallyderived.
Therefore,itcanbeconcludedthattheproposedalgorithmisusableandreliable.
FUTUREWORKInthefuture,thisalgorithmcanbegeneralizedsothatitcanaccommodatevarioustestcoveragecriteriawithinthesametestderivationframework.
Thisprototypecanbeimprovedbydevelopingtheabilitytobuilddirectedgraphandparsetestcasesfromit.
TheUMLactivitydiagramsthathavebeenusedinthisresearchwereusingUML1.
0version.
Forthefuturework,theuseofUML2.
0notationisrecommended.
Additionally,theUMLactivitydiagramsweregeneratedmanuallyinthework;therefore,theuseofatoolthatisabletoautomaticallygeneratethesediagramsissuggested.
CONCLUSIONTheuseofactivegraphisagoodmethodtoensurethatthegenerationofthetestcasesautomaticallyusingtheproposedalgorithmanditsimplementation,andusingtheUMLactivitydiagramasabasetoguaranteetheabilityofautomaticimplementation.
Thereusabilityofthisresearchworkcanbeappliedtocompletefullautomaticanalysis.
ThistestwillopennewopportunitytodiscovernewtechniquesormethodsforthetestingusingUMLdiagramsandautomatictestcasesgeneration.
REFERENCESAlshammari,S.
A.
(2010).
GeneratingTestCasesforLearningZone.
Thesis,UUM.
Cartaxo,E.
,Neto,F.
,&Machado,P.
(2007).
TestCaseGenerationbymeansofUMLSequenceDiagramsandLabeledTransitionSystems.
IEEE,1292-1297.
Chen,M.
,Qiu,X.
,Xu,W.
,Wang,L.
,Zhao,J.
,&Li,X.
(2009).
UMLActivityDiagram-BasedAutomaticTestCaseGenerationForJavaPrograms.
TheComputerJournal,52(5),545-556.
Heumann,J.
(2001).
GeneratingTestCasesFromUseCases.
Retrieved5July,2010,from:http://www.
ibm.
com/developerworks/rational/library/content/RationalEdge/jun01/GeneratingTestCasesFromUseCasesJune01.
pdfJaved,A.
,Strooper,P.
,&Watson,G.
(2007).
AutomatedGenerationofTestCasesUsingModel-DrivenArchitecture.
IEEE,3-9.
Kim,H.
,Kang,S.
,Baik,J.
,&Ko,I.
(2007).
TestCasesGenerationfromUMLActivityDiagrams.
IEEE,556-561.
Kundu,D.
,&Samanta,D.
(2009).
ANovelApproachtoGenerateTestCasesfromUMLActivityDiagrams.
JournalofObjectTechnology,8(3),65-83.
Lilly,R.
,&G,U.
(2010).
ReliableMiningofAutomaticallyGeneratedTestCasesfromSoftwareRequirementsSpecification.
InternationalJournalofComputerScienceIssues,87-91.
Linzhang,W.
,Jiesong,Y.
,Xiaofeng,Y.
,Jun,H.
,Xuandong,L.
,&Guoliang,Z.
(2004).
GeneratingTestCasesfromUMLActivityDiagrambasedonGray-BoxMethod.
IEEE,284-291.
Mingsong,C.
,Xiaokang,Q.
,&Xuandong,L.
(2006).
AutomaticTestCaseGenerationforUMLActivityDiagrams.
ACM,2-8.
大硬盘服务器、存储服务器、Chia矿机。RackNerd,2019年末成立的商家,主要提供各类KVM VPS主机、独立服务器和站群服务器等。当前RackNerd正在促销旗下几款美国大硬盘服务器,位于洛杉矶multacom数据中心,亚洲优化线路,非常适合存储、数据备份等应用场景,双路e5-2640v2,64G内存,56G SSD系统盘,160T SAS数据盘,流量是每月200T,1Gbps带宽,配5...
有一段时间没有分享Gcore(gcorelabs)的信息了,这是一家成立于2011年的国外主机商,总部位于卢森堡,主要提供VPS主机和独立服务器租用等,数据中心包括俄罗斯、美国、日本、韩国、新加坡、荷兰、中国(香港)等多个国家和地区的十几个机房,商家针对不同系列的产品分为不同管理系统,比如VPS(Hosting)、Cloud等都是独立的用户中心体系,部落分享的主要是商家的Hosting(Virtu...
UCloud优刻得商家这几年应该已经被我们不少的个人站长用户认知,且确实在当下阿里云、腾讯云服务商不断的只促销服务于新用户活动,给我们很多老用户折扣的空间不多。于是,我们可以通过拓展选择其他同类服务商享受新人的福利,这里其中之一就选择UCloud商家。UCloud服务商2020年创业板上市的,实际上很早就有认识到,那时候价格高的离谱,谁让他们只服务有钱的企业用户呢。这里希望融入到我们大众消费者,你...
studentmain为你推荐
海外主机租用国外服务器租用有几十块钱一年的么网站空间域名网站空间,域名,操作免费网站空间申请哪里有免费申请空间的(网页制作)虚拟主机试用30天虚拟主机返佣是怎么回事?广西虚拟主机网站icp备案流程域名网站哪里可以给你免费的域名做个网站域名邮箱有谁知道域名邮箱是干什么的啊?有什么作用吗?备案域名域名一共有几种?哪些域名需要备案?com域名.xyz域名和.com的区别子域名查询DNS名称查询的命令
qq域名邮箱 中文国际域名 鲨鱼机 cloudstack gomezpeer 有奖调查 hdd 卡巴斯基免费试用版 太原联通测速 国内域名 全能空间 汤博乐 nnt privatetracker alexa世界排名 优惠服务器 WHMCS 服务器机柜 赵荣博客 qq部落18-3 更多