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.
819云是我们的老熟人了,服务器一直都是稳定为主,老板人也很好,这次给大家带来了新活动,十分给力 香港CN2 日本CN2 物理机 E5 16G 1T 20M 3IP 240元0官方网站:https://www.819yun.com/ 特惠专员Q:442379204套餐介绍套餐CPU内存硬盘带宽IP价格香港CN2 (特价)E5 随机分配16G1T 机械20M3IP240元/月日本CN2 (...
hostkvm怎么样?hostkvm是一家国内老牌主机商家,商家主要销售KVM架构的VPS,目前有美国、日本、韩国、中国香港等地的服务,站长目前还持有他家香港CN2线路的套餐,已经用了一年多了,除了前段时间香港被整段攻击以外,一直非常稳定,是做站的不二选择,目前商家针对香港云地和韩国机房的套餐进行7折优惠,其他套餐为8折,商家支持paypal和支付宝付款。点击进入:hostkvm官方网站地址hos...
RAKsmart怎么样?RAKsmart机房即日起开始针对洛杉矶机房的独立服务器进行特别促销活动:低至$76.77/月,最低100Mbps带宽,最高10Gbps带宽,优化线路,不限制流量,具体包括有:常规服务器、站群服务器、10G大带宽服务器、整机机柜托管。活动截止6月30日结束。RAKsmart,美国华人老牌机房,专注于圣何塞服务器,有VPS、独立服务器等。支持PayPal、支付宝付款。点击直达...
studentmain为你推荐
服务器租用武汉服务器租用,托管哪个公司好?免费注册域名如何注册免费域名ip代理地址ip代理有什么用?有图片..台湾vps做一个论坛,请问需要什么样的vps配置网站域名空间哪个网站的域名空间的便宜?手机网站空间手机网页空间需要多大?重庆网站空间重庆有没有发展空间?虚拟主机管理系统急!高分!比较好用的虚拟主机管理系统有哪些?虚拟主机试用30天需要一个免费的虚拟主机,稳定的shopex虚拟主机西部数码虚拟主机,适合做独立shopex或者echsop网店吗,我想开网店,推荐一下哪个型号的好
免费cn域名 息壤备案 美国翻墙 java主机 韩国电信 好看的桌面背景大图 parseerror 40g硬盘 web服务器架设 七夕快乐英文 hinet 免费吧 微软服务器操作系统 如何注册阿里云邮箱 web服务器是什么 smtp虚拟服务器 卡巴斯基官网下载 七牛云存储 北京主机托管 hdroad 更多