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.
Hostodo是一家成立于2014年的国外VPS主机商,现在主要提供基于KVM架构的VPS主机,美国三个地区机房:拉斯维加斯、迈阿密和斯波坎,采用NVMe或者SSD磁盘,支持支付宝、PayPal、加密货币等付款方式。商家最近对于上架不久的斯波坎机房SSD硬盘VPS主机提供66折优惠码,适用于1GB或者以上内存套餐年付,最低每年12美元起。下面列出几款套餐配置信息。CPU:1core内存:256MB...
RAKsmart怎么样?RAKsmart机房即日起开始针对洛杉矶机房的独立服务器进行特别促销活动:低至$76.77/月,最低100Mbps带宽,最高10Gbps带宽,优化线路,不限制流量,具体包括有:常规服务器、站群服务器、10G大带宽服务器、整机机柜托管。活动截止6月30日结束。RAKsmart,美国华人老牌机房,专注于圣何塞服务器,有VPS、独立服务器等。支持PayPal、支付宝付款。点击直达...
运作了18年的德国老牌机房contabo在继去年4月开办了第一个美国数据中心(中部城市:圣路易斯)后立马在本月全新上马两个数据中心:纽约、西雅图。当前,为庆祝美国独立日,美国三个数据中心的VPS全部免除设置费,VPS本身的配置很高,价格适中,有较高的性价比!官方网站:https://contabo.com/en/SSD VPSKVM虚拟,纯SSD阵列,不限制流量,自带一个IPv4内存CPUSSD带...
studentmain为你推荐
租服务器我想租服务器,请问会提供哪些服务?虚拟主机推荐谁可以给推荐下好用的虚拟主机域名主机IDC(主机域名)是什么意思?域名主机域名与主机的对应关系在哪里可以看到?海外域名怎么挑选合适的国外域名?apache虚拟主机Apache跟虚拟主机有什么关系?下载虚拟主机虚拟机怎么使用和下载花生壳域名花生壳域名是什么免费域名注册哪里有免费域名申请域名抢注域名抢注是什么意思啊?
青岛虚拟主机 中文域名注册 深圳域名空间 idc评测 bluehost lamp配置 嘉洲服务器 福建天翼加速 腾讯实名认证中心 泉州移动 世界测速 美国免费空间 vip域名 彩虹云 万网空间管理 外贸空间 国外在线代理服务器 lamp的音标 主机返佣 xuni 更多