欢迎来到天天文库
浏览记录
ID:13281921
大小:196.50 KB
页数:23页
时间:2018-07-21
《qtp基础教程-descriptive programming》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、WorkingwithDynamicObjectsObjectivesAftercompletingthischapter,youwillbeableto:Writescriptsthatoperateondifferentobjectsdependingonrun-timeinformation.Buildaprogrammaticdescription.CreateanduseaDescriptionobject.Identifywhenprogrammaticdescriptionsareuseful.DynamicObjectsversusSt
2、aticObjectsManyapplicationsconsistofdynamicobjectsinadditiontostaticobjects.Dynamicobjectsareobjectswhichdonotalwaysexistintheapplication,butratherarecreatedbasedonrun-timeinformation.Review:ObjectRepositoryforStaticObjectsQTPlearnsobjectsinyourapplicationandstoresthemintheObjec
3、tRepository.ThestepsofyourtestsandcomponentscanrefertotheobjectsbyusingtheirlogicalnamefromtheObjectRepository.IdentifyingDynamicObjectsTherearetwomethodsforidentifyingdynamicobjectsinyourQTPscripts:SetthepropertiesintheObjectRepositorytobedynamic.Useprogrammaticdescriptions.Set
4、tingDynamicValuesintheObjectRepositoryIftheobjectisdefinedintheObjectRepositorybuthasdynamicpropertyvalues,youcansetitsvaluesasfollowsintheObjectRepository:Usearegularexpressiontomatchvaluesthatvaryatrun-time.UseaparametertomatchinformationstoredinaDataTable.Withinthescript,refe
5、rtothedynamicobjectbylogicalnamejustasyouwouldanyotherobjectintheObjectRepositoryUsingProgrammaticDescriptionsProgrammaticdescriptionscanbeusedtoidentifyanydynamicobject,includingobjectsnotdefinedintheObjectRepository.Whenaprogrammaticdescriptionisusedinastatement,QTPbypassesthe
6、ObjectRepository.Youmayalsouseprogrammaticdescriptionstovalidatespecificpropertyvalueswhichmaybedynamic.Withprogrammaticdescriptions,supplyoneormorepairsofanobjectpropertyanditsdesiredvalue.QTPusesthesepropertiestoidentifythedesiredobject.Theoverallstepsforbuildingaprogrammaticd
7、escriptionareasfollows:Identifytheobjectclass.Selectobjectproperties.Codeaprogrammaticdescription.Objectidentifiedwithprogrammingdescriptionsareusedinyourscriptsjustlikeobjectsidentifiedthroughtheirlogicalnames.BuildingProgrammaticDescriptionsIdentifyingtheObjectClassTouseprogra
8、mmingdescriptions,firstidentifytheclassofthedes
此文档下载收益归作者所有