Вы находитесь на странице: 1из 15

QTPHybridFrameWorkPartI

QTPHybridAutomationFrameWork

InitiallyIhavepresentedthisarticleatSlideShare

WhatisAutomationFramework?
Frameworkisawrapperaroundcomplexinternalarchitecturewhichmakesenduserto
interactwiththesystemeasily.Italsodefineguidelinesandsetstandardsforallphasesof
ADLC(AutomationDevelopmentLifeCycle).
ThisDualFunction(Hybrid)frameworkisacombinationofthreeframeworks
(FunctionalDecomposition,DataDriven,KeywordDriven)and(reusability,advanced
errorlogic,customQTPmethods,dualfunction)techniques.

KeyfeaturesofDualfunctionFramework
1.Reusability,lowmaintenancedesign(DualFunction).
2.Supportdifferentapplicationenvironments(Development,QualityControl,production)
andcustomclientsettings.
3.ExternallyConfigurableExecuteallthetestcases,executeonlyfailedtest
cases,executetestcasesbytestcaseid,executetestcasesbyusingflags...can
beconfiguredindifferentways.
4.SelfConfigurableandcanrununattendedwithoutresultsbeingoverwritten.
5.BetterROI(ReturnOfInvestment).
6.Realtimestatusmonitoringdisplaydetailstatusduringthetestexecution
andautomaticallyclosethepopupstatusinxsec.
7.Teststatusreportinginthreewaysdetailed,highlevelandsummarylogfile.
8.Systemautomaticallysendemailnotificationswithtestresultsoncethetest
iscomplete.
9.ScreenCaptureonfailedteststep,notifiedinthetestcaseitself,assignunique
nameandstoredintheseparatefolderforeasyaccessing.
10.Automationtestcasesresemblemanualtestcases(Justreplacewithkeywordsandtest
data)
11.Easywayofcreatingtestcaseswithtestcasegenerators(Selectkeywordsfromdrop
down).
12.Easytomaintainanddevelopscripts(DP,CustomMethodsandDualFunction).

13.Testexecutiontimestampforeachstep,sothatwecaneasilytracewhenthetestwas
executed.
14.SamescriptcanbeexecutedonQTP9.2,9.5and10.0.Backward,forwardcompatibility.
15.Ifthetestisrunningindifferentlocation,systemautomaticallyidentifytheplaceof
executionusingSystemIP.IftheIPisunknownnotinthedefinedlistorchanged,itwould
publishtheIPaddressintheresults.
16.Ifobjectismissingorobjectpropertiesgotchangedontheapplication,
systemwillnotifyobjectismissingandproceedwiththenexttestcase.This
willnotstopthetestexecution.
17.Calculateeachpageresponsetimeautomatically.
18.FrameworkisdesignedinsuchawaythatitcanbeinitiatedusingAOMscriptor
directlyrunusingQTPGUIespeciallyusefulduringdebuggingorscriptcreation.
19.Itwouldautomaticallystopautomaticallyifspecificnumberoftestcasesgotfailedin
sequence,thiswillhelpusknowthereisseriousproblemintheapplication.
20.Multilanguagesupport.
21.SendingtestresultsasSMS.
22.Itwouldautomaticallyaddnewlibraryfiles.
23.Astheentirecoderesideinlibraryfiles,totalsizeoftheframeworkisverysmall.This
willhelpustoeasilycopy,backupanduploadintoversioncontroltools.
24.Automaticresultsarchivingfacility,oldresultswillnoterased.

AdvantagesofDualFunctionFrameworkandROI(ReturnOfInvestment)
1.Reducetestingtime.
2.Improvetestingproductivity.
3.Improveproductquality
4.ReduceQAcosts.
5.Consistenttestresults.
6.Calculatepageresponsetimeofallthepages.
7.Scheduletestruns.

FrameWorkFolderStructure

Frameworkcontaindifferentfilesassociatedwithdifferentfunctionality,allthefilestobe
placedinthecorrespondingfolderssothatitiseasytomaintain.
Note:Frameworkcan'tidentifythefoldersiffoldernamesgetrenamed,exceptsubfolders
createdunder"AutomationTestDocuments".
AutomationTestDocumentsfoldercontainsubfoldersrelatingtoeachtest.Ifwehavetwo
tests,therewillbetwosubfolders.Createnewfoldersasperthetestrequirement.Thereis
norestrictiononthefoldername.

Eachtest(ProductionLoginTestingfromtheabovescreenshot)contain2Files(Startup,
Control)and3subfolders(AutomationTestCasescontaintestcasesExecuationLog
systemautomaticallycreatetwonewfilesoncetestiscomplete,basedontheconfiguration,
Testsummary.txtandResponsetime.xlsScreenShotscontainapplicationscreenshots,if
thereareanyerrors.Itwouldautomaticallyassignuniquenamewithtimestampforeach
screenshotandnotifiedintheteststepitself.
Configfoldercontainxlsfilescontainingcustomclientsettings.
ExecutedScriptsfoldercontaincopyofthetestfolderafterexecution.Ifwerunthesame
testagainandagain(scheduleondailybasis)resultsareoverwritten.Inordertopreserver
thetestresults,frameworkwillcopythetestfolderintonewlycreatedfolderwithtime
stamp,oncethetestgotcompleted.

Frame_WorkGepfoldercontainQTPcodeofoneaction"KickOff"withsinglelineofcode
"CallStartUP".EntireprojectcodecoderesideintheVBSfile.
Followingarethereasonsforchoosingthiskindofdesign.
1.VBSfileareverylightintermsofsize.
2.FrameworkisentirelybasedonDP(Descriptiveprogramming).
3.Wecaneasilyimplementanyconfigurationmanagementtool.

Libraryfoldercontainapplicationlibrarieswhichcontaincoderelatingtokeyword
functionsandcontainsubfoldercalled"CoreLibraries"thatcontainfilescorrespondingto
actualframeworkonly.

DualFunctionFrameworkArchitecture

Note:Highleveldesignintendedtoshowinasimplemanner.Manyotherscriptsarecalled
betweenintermediatestages.
QTPAOMScript
1.vbsfilecreatedusingAOM.
2.Attachedtowindowsscheduler.
3.IdentifytheplaceofexecutionusingsystemIP.Ifscriptisexecutedonnewlocation,it
wouldconsiderIPaddressasplaceofexecution.
4.Astherearemanytestsunder"AutomationTestdocuments",scriptneedtobeupdated
withthetestfoldernameandpaththatweareplanningtoexecute.
5.ScriptwillopentheQTPandassociatethetestspecifiedinthestep4.
6.Twoparametersarepassedasenvironmentvariables(locationandtestpath).
7.Copytheresultsin"ExecutedScripts"foldertoprotectresultsfromoverwriting,if
initiatedthroughAOMscriptonly.
8.TestcanalsobeexecutedinstandalonemodewithoutAOMscript,especiallyuseful
duringtestcreationanddebugging.
KickOffAction
ThisistheonlyQTPactionusedintheframework,itcontain"CallfunKickOff"toinitiate
KickOffscript.

KickOffScript
Containglobalobjectdeclaration,initializationandcontrollingtestexecutionmode.This
scriptwillinitiateStartUpscript.
StartUpscript
Thisscriptwillconfiguretheframeworkasperthesettingsprovidedinthestartup
spreadsheet.
ControlScript
Startupscriptwillinitiatecontrolscript.Basedonthestartupspreadsheetsettings,script
willreadeachtestcasefromthecontrolspreadsheetandcallthedriverscriptwithtestcase
id,testcasename.Thisscriptwillalsogeneraterealtimestatusofthetestintheformof
popupmessageandupdatetheteststatus.
Driverscript
Basedonthetestcaseidandtestcasename,itwillmapthetestcaselowerboundand
upperbond,thenitwillreadeachlineofthetestcaseandcallcorrespondingkeyword
functions.
Howlowerboundiscomputed?
Basedonthetestcaseidreceivedfromthecontrolscript,itwillstartverifyingtheline
havingthekeyword"TestCaseID",ifIDunderP1(ColumnF)ismatching,thenitistreated
aslowerbound.
Howupperboundiscomputed?
Oncescriptidentifythelowerbound,itwillstartsearchingtheimmediate"STOP"key
word,thiswillbeconsideredasupperbound.
Thenitwillstartreadingallthekeywordsbetweenlowerandupperboundbycalling
correspondingkeywordfunctionsandupdatingeachstep.

Applicationlibrary
Thesefunctionswillactuallymanipulate(enterdataorperformcertainactiononthe
control)theapplicationasperthedesignandsendthestatusbacktothedriverscript.
TounderstanddifferentvariablesthatIhavecreatedintheframework,lookintothe
functionavailableunderthislink.
Note:Abovescriptscontaincomplexvalidationanderrorlogictechniques,
justgaveyouhighleveloverview.Followingtopdownapproachandeach
scriptisindependententity,thiswillhelpustomaintainframeworkwithease
andchangethefunctionalitywithouteffectingotherscripts.

Startupspreadsheet

Row1DefaultURLIfyouareusingthesametestindifferentenvironments
(Development,Qualitycontrol,production),justchangetheURL,scriptswouldrun
withoutanyissues.Thiswillhelpustorunthetestsindifferentenvironmentswithvery
littlechange.
Row2DBNameIfyouareaccessingthedatabasethroughQTP,youcanspecifythe
nameaftercreatingDSN.
Row3TestExecuteFlagDropDownvaluesAll,Yes,No,EmptyExecuteFlag,Check,Test
CaseIds
Thesesettingsareappliedbythecontrolscriptonthecontrolspreadsheet.
AllExecuteallthetestcases

Yes(Y)ExecutetestcasewithYflag
No(N)ExecutetestcasewithNflag
EmptyExecuteFlagExecutetestcasewithemptyflag
CheckWhenselected,itwouldjustgeneratetestreportwithconsolidatepass/failstatus
(iftestisrunmultipletime,initiallyalltestcases,nextfailedtestcases)withoutactual
executionthetest.
TestCaseIdsExecuteonlyspecifictestcaseids.
Row4TestExecutionStatusFlagDropDownvaluesAll,Pass,Fail,BadInputs,Empty
ExecutionFlag,Check,TestCaseIds
Thesesettingsareappliedbythecontrolscriptonthecontrolspreadsheet.
IfwewanttocontrolthetestbasedonPass/Failstatususethiscontrol.
AllExecuteallthetestcases
PassExecutetestcasewithPassstatus
FailExecutetestcasewithFailstatus
BadInputsExecutetestcasewithBadInputsstatus
EmptyExecuteFlagExecutetestcasewithemptyflag
CheckWhenselected,itwouldjustgeneratetestreportwithconsolidatepass/failstatus
(iftestisrunmultipletime,initiallyalltestcases,nextfailedtestcases)withoutactual
executionthetest.
TestCaseIdsExecutespecifictestcaseids.
Row3and4canbeusedindifferentcombinationwhileexecutingthetest,sothatdesired
testcasesareexecuted.Mostofthecombination'sareconsidered.
Row5ExecuteSpecificTestCaseIdsMentiontestcaseidsthatyouwanttoexecute,
"TestCaseIds"flagneedtobeselectedinRow3or4.Thiswilloverrideallthesettings.
Row6TesterNameNameofthetesterwhoisexecutingthescript,samenameappearin
controlandlogfilesaftertestexecution.
Row7Releaseno/Modulename.
Row8TestCycleMentiontestcycle.
Row9ExceptionsexistcounterTestwouldautomaticallystoponcethefailedtestcase
countreachthecountervalue.Itdoesn'tmakesensetokeeponexecutingthetestwith50
ormorefailedtestcases,somethinggonewrongbadly.
Row10TeststatuspopupdisplayDropdownvaluesOn,Off,ValidTestCase
OnAlwaysdisplayrealtimeteststatuspopup.
OffDon'tdisplayrealtimeteststatuspopup.
ValidTestCaseDisplaywhileexecutingvalidtestcase,don'tdisplayforinvalidtestcase,
determinedfromthecombinationofRow3and4flagsettings.
Row11Teststatuspopupdisplay(sec)Howmaysecondsrealtimetestpopupneedto
bedisplayed,automaticallycloseafterspecifiedseconds.
Row17ObjectHighlightingOn/Off
OnItwillhighlightalltheobjectsduringtestexecution,reducetestexecutionspeed.
OffNohighlighting

Row18SilentModeOn/Off
OnFrameworkgeneratemanymessagesduringexecution,whentestisgettingexecuted
unattended,wecansuppressthesemessagebyselectionOn.
OffUserneedtoclickOKforeachframeworkmessage,usedduringdebugging.
Row19CalculateaveragepageresponsetimeOn/Off
OnItwillgenerateanexcelfilewitheachpageresponsetimeandstoreitinthe
"ExecuationLog"folder.Extracodingrequired,needtomodifyexcelCOMmodelfunction
aspertherequirements.
OffItwillnotgenerateanypageresponsefile.
Row26BeeponanyclickOn/Off
OnGeneratebeepsoundwhensystemselectanycontrol.
OffNobeep.
ReasonforimplementingthisfeatureOneofthedevelopertoldmethatyouarenot
calculatingpageresponsetimecorrectlythereisflawinpagesynchronizationcode.Inorder
toprovethatIamcorrect,Ihaveimplementedthisfeature.Whensystemselectanyaction
onthecontrolitwillgenerateabeep,oncepagesynciscomplete,itwillgeneratedifferent
beep.Aftershowingthesametothedeveloper,heagreedthatmypageresponsetimecode
iscorrect.

ControlSpreadsheet

HeadershighlightedinYELLOWUserneedtofillthecolumns.
HeadershighlightedinWHITESystemautomaticallyfillthecolumnsduringexecution.
Onecontrolspreadsheetforentiretest.
Column1TestCaseIdEachtestcaseisassigneduniqueidinascendingorderonly.
Column2TestCaseDescriptionOptional,smalldescriptionaboutthetestcase.

Column3ExecuteFlag(Y/N/Empty)Controlscriptwillretrievethesettingsfromthe
startupspreadsheetRow3andchecktheflag.Ifbothflagsmatch,systemwillexecutethe
testcaseelseitwillignoreit.Thissystemwillhelpustoquicklyconfigurewhichtestcases
tobeexecuted.
Column4TestcasefilenameNeedtospecifythecorrespondingtestcasefilename.
Eachtestcanhavemultipletestcasesifrequired,sothatfunctionalitycanbedistributed
andeasytomaintain.
TestcaseGroupofteststeps(procedure)withspecifictestdatatovalidatearequirement.
TestcasefileGroupoftestcasesplacedinafile.
Column5ResponseTimeConsolidatedresponsetimeofalltheteststepsunderspecific
testcase.
Column6ExecutionStatusOncetestcaseidisexecuted,systemwillupdatethestatus
withPass/Fail/BadInputs(testdataprovidedtotheteststepsareincorrect).
Wecanalsousethisflagtocontroltestexecution.Row4startupspreadsheet.
Column7ExecutionPlaceorSystemIP/StatusMessageDisplayexecutionplace/Error
andcheckpointmessages,ifthereareanyinconsistencies.
Column8TimestampTestexecutiontimestampinLocaltime.
Column9TesttesternameAsspecifiedinthestartupspreadsheet.
Column10Releaseno/modulenameAsspecifiedinthestartupspreadsheet.
TestcaseSpreadsheet
BeforeExecution

HeadershighlightedinYELLOWUserneedtofillthecolumns.
HeadershighlightedinWHITESystemautomaticallyfillthecolumnsduringexecution.
Testcasespreadsheetconsistofteststepssimilartomanualtestcases.
ColumnAKeywordPerformspecificactiononthescreenlikeenterdata,retrievedata,
checkpoint.Thesekeywordsareselectedfromthedropdown,notrequiredtotypethe
keywords.Oncetestcasecreatorselectthekeyword,basedonthedesign,columnFtoQare
highlightedandcorrespondingcellsareinsertedwithcomments,theseareinput

parametersP1,P2,P3....P20."LogInSignon"(Row118)contain4parameters,P1User
name,P2Password,P3Credentialsarecorrect,P4Language.

AfterExecution

SystemstartfillingcolumnsB,C,DandFduringtestexecution.
Mappingofmanualandautomationtestcasestocheckthecoverage

Wecancreatenewcolumn"AutomationtestcaseID"inthemanualtestcasesspreadsheet,
sothattherewillbeonetoonemappingwithoutmissinganyfunctionality.

Testsummarylogfile

Generatedandplacedinthe'ExecutionLog"folderonetestiscompleted.
Itcontainfollowinginformation.
1.Placeofexecution.
2.Teststartandendtimewithtimezone.
3.Totalexecutestestcases(Pass/fail/badinputs)andignoredtestcases(basedonstartup
spreadsheetsettings).
4.Starupspreadsheetdetails.
5.Informationrelatingtosendingemailnotifications.
6.Averagepageresponsetime(dependonthestartupspreadsheetsettings)
7.AvailablePCphysicalmemorybeforeandafterexecutionwithtimestamp.
8.TestterminationmessageBysystemcompleted/Byuser/Byexceptionexistcounter.
9.Whetheremailsentsuccessfully.

10.PCinformation.
ItisasummaryofTestresults+Frameworksettings+PCinfo.

RealTimestatusPOPUPmessage

Itprovidelivehealthofyourtest,thiscanbeconfiguredinthestartupspreadsheet.
Aboveimageisselfexplanatory.
Ifyourtestisrunningfor2hoursanddon'thavethisfeature,youwillunderstandnothing
ifyoulookatyourrunningtestafteronehour.Itwouldbebettertoimplementthisfeature
asperyourrequirements,notsoexhaustivelyasmentionedabove.
Note:Implementingthesefeatureswillnothaveanyperformancebottleneckintermsof
executionspeedormemoryusage.
Testcasegenerator(Keywordsheettocreatetestcases)
SimpleSheet


Testcasegeneratorspreadsheetcontaintwosheets
1.KeyListWhereyoudesignkeywords,sameasabovescreenshot
2.KeywordWhereyoucreateautomationtestcasesbyselectingthekeywordsfromthe
dropdown.
Macrosarewrittentoconnectbothsheets
HowtocreateKeyWords?
Letscreatekeywordfortheloginscreen,whereyouhaveUsername,PasswordandLogin
button.
FlowEnterusername,Passwordandselectloginbutton.
KeywordnameLoginSignOn
InputParametersUsername,Password
AssigntwoparametersP1,P2undercolumnEandF.
CreatecellcommentsforP1andP2asusernameandpassword.
OOptionalparameter
MMandateparameter(Systemwillgenerate"BADINPUTS"ifusersdon'tentervalues
andexecutethescript.
PointstobeconsideredwhilecreatingKeywords
1.StandardCamelCaseformat.
2.Keywordgranularity(neverhavesamekeyworddoingsameoroverlapping
functionality).
3.Whencreatingcomplexkeywordschoosefollowingformat(productname+pageName
+functionality)
4.Don'tworryaboutthelengthofkeyword,youarenottypingit,justselectingfromthe
dropdown.Itshouldbeselfexplanatory.
Advantagesofthisdesign.
1.Itisnotrequiredtoentertestobjectpropertiesinthetestcase,alreadyimplementedin
thecode.
2.Wecancreatedadocumentwhichcontainscreenshotofthepageandcorresponding
keywords.Bylookingatitanyonecancreatetestcases.

3.Generallyinkeyworddrivenframework,wecanenteronevalueorfireonemethodper
lineinthisdesignyoucanentermaximumof20valuesinasingleline.
4.Itisnotrequiredtomemorizealltheinputsassociatedwithakeyword,Justselectthe
Keywork,itwouldautomaticallyhighlighttheparametersandassigncellcommentstoeach
parameter,sothatyouwillunderstandeasilywhatP1,P2...parametersfor.
5.Eachkeywordisselfexplanatorydesignedusingcamelcase,anypersoncanunderstand
it.

ComplexSheetwithlengthykeywords

Aftercreatingthecoreframework,nextjobwouldbecreatingkeywordsasperthe
functionalityandexecutingthetest.

Continued...QTPHybridFrameWorkPartII

Вам также может понравиться