您的位置:首页 > 编程语言 > Qt开发

【软件测试自动化-QTP NOTE 7】 == 描述性编程(Descriptive Programming)-3rd ==

2010-07-19 00:02 337 查看
今天这篇分享同样是针对DP的,当然会通过和OR对比的方式进行分析和阐述

1.首先以Google的搜索栏为例

'OR
Browser( "Google" ).Page( "Google" ).WebEdit( "q" ).Set "hello world"

'DP
Browser( "title:=Google" ).Page( "title:=Google" ).WebEdit( "name:=q" ).Set "hello world"


这是两者最普通的表现方式

对于DP,包括其属性和对应值。相反OR只是显示了其对象的逻辑描述。

2.当然这两种对于对象的定位和控制方式是不同的,我们不能以DP的方式定义父对象,然后用OR描述子对象:

'报错:Browser是DP,而Page和WebEdit是OR
Browser( "title:=Google" ).Page( "Google" ).WebEdit( "q" ).Set "hello world"
'报错:Browser和Page是DP,而WebEdit是OR
Browser( "title:=Google" ).Page( "title:=Google" ).WebEdit( "q" ).Set "hello world"


3. 然而,一个OR父对象可以识别DP和OR作为子对象

'Browser是OR,Page和WebEdit是DP
Browser( "Google" ).Page( "title:=Google" ).WebEdit( "name:=q" ).Set "hello world"

'Browser和Page是OR,WebEdit是DP
Browser( "Google" ).Page( "Google" ).WebEdit( "name:=q" ).Set "Google hello world"


4.从性能角度对比,DP的性能会比OR略逊一筹

'OR: 9.74 秒
For i = 0 to 99
Browser("Google").Page("Google").WebEdit("q").Set "hello world"
Next

'DP: 14.64 秒
For i = 0 to 99
Browser("title:=Google").Page("title:=Google").WebEdit("name:=q").Set "hello world"
Next
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: