Object Repository VS Descriptive Programming

There is no specific answer as to which of the two (object repository or descriptive programming) is better.

There are certain situations when using descriptive programming has its own benefits (with descriptive programming along with other features you also get code portability) while in some other typical situations object repository works like a charm (No need to adjust the script when an object properties change, Highlighting an Object in Your Application etc are couple of features you can’t just resist and of course there are many more).

Below you can find some of the differences between object repository and descriptive programming. (Differences are not limited to what is shown below, there can be many more)


Object Repository
Descriptive Programming
With object repository QTP automatically resolves which properties and values are required to uniquely identify an object. QTP starts with predefined mandatory and assistive properties in that order. If the mandatory and assistive properties do not uniquely identify an object, QTP uses an ordinal identifier. QTP can also use Smart Identification (if enabled).
With descriptive programming set of property/value pairs are created by you and all are mandatory, although you can use object spy to get help in selecting set of property/value pairs.
Object repository in QTP is created automatically (manual creation is also possible) as and when you record on the application.
Descriptive programming statements need to be put into operation manually. Finding a set of properties to distinctively identify the object time and again can be time consuming.
Object repository is considered relatively faster if you take into account the performance for large applications.
It is considered relatively slower to create and performance wise also in case of large applications.


Object Repository 
' Enter  Email id in Username Field 
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Email").Set  "qtpworld.com" 

 'Enter password in Passowrd Field 
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebEdit("Passwd").Set  "qtp" 

'Cick on the Sign In Button 
Browser("Gmail: Email from Google").Page("Gmail: Email from Google").WebButton("Sign in").Click 

Descriptive Programming 
'Descriptive object to identify  Browser  with a particular title 
Set Dbrowser=description.CreateDbrowser("micclass").value="Browser"Dbrowser("title").value="Gmail: Email from Google"   

'Descriptive object to identify  Web page with a particular title 
Set  Dpage=description.CreateDpage("micclass").value="Page"Dpage("title").value="Gmail: Email from Google"   

'Descriptive object to identify a  particular Web Button 
Set  Dbutton=description.CreateDbutton("micclass").value="WebButton"Dbutton("name").value="Sign in"   

'Descriptive object to identify  Web Text Box 
Set Dedit=description.CreateDedit("micclass").value="WebEdit"Dedit("name").value="Email" 
  
'wait till browser loads 
Browser(Dbrowser).Page(Dpage).Sync   

' Enter  Email id in Username Field 
Browser(Dbrowser).Page(Dpage).WebEdit(Dedit).Set  "qtpworld.com"  Dedit("name").value="Passwd"   

'Enter password in Passowrd Field 
Browser(Dbrowser).Page(Dpage).WebEdit(Dedit).Set  "qtp"   

'Cick on the Sign In Button 
Browser(Dbrowser).Page(Dpage).WebButton(Dbutton).Click

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值