两种DP描述方法的比较
2010-01-01 12:20
381 查看
使用
DP
(
Descriptive Programming
)时,可以使用两种方法,一种是直接描述的办法,另外一种是使用
Description
对象来存储描述:
Method
1 – Using String Description
Browser("Browser").Page("Google").WebButton("type:=Submit",
_
"name:=Google Search", "html tag:=INPUT").Click
Method
2 – Using Object Description
Set oGoogleSearch = Descrition.Create
oGoogleSearch("type").Value =
"Submit"
oGoogleSearch("name").Value =
"Google Search"
oGoogleSearch("html tag").Value =
"INPUT"
Browser("Browser").Page("Google").WebButton(oGoogleSearch).Click
这里做了个对比:
参考:
http://knowledgeinbox.com/articles/qtp/descriptive-programming/dp-part-2-converting-or-based-scripts-to-dp/
DP
(
Descriptive Programming
)时,可以使用两种方法,一种是直接描述的办法,另外一种是使用
Description
对象来存储描述:
Method
1 – Using String Description
Browser("Browser").Page("Google").WebButton("type:=Submit",
_
"name:=Google Search", "html tag:=INPUT").Click
Method
2 – Using Object Description
Set oGoogleSearch = Descrition.Create
oGoogleSearch("type").Value =
"Submit"
oGoogleSearch("name").Value =
"Google Search"
oGoogleSearch("html tag").Value =
"INPUT"
Browser("Browser").Page("Google").WebButton(oGoogleSearch).Click
这里做了个对比:
String Description | Object Description |
Uses less memory as strings are used (因为使用字符串描述,内存用得少些) | Requires more memory as objects are created. Object creation is as such a overhead (由于使用了对象,需占用较多内存) |
Increases statement length in case more than one property is to be used (如果要描述多个属性,则语句长度会增加) | Increase lines of code due to object creation overhead and property assignment (增加的不是语句长度,而是代码行数) |
| Preferred when property value have regular expression characters which needs to be treated literally (如果属性描述中包含正则表达式,则采用这种方法更好) |
参考:
http://knowledgeinbox.com/articles/qtp/descriptive-programming/dp-part-2-converting-or-based-scripts-to-dp/
相关文章推荐
- Android网络连接的两种方法:apache client和httpurlconnection的比较
- 二叉树遍历函数的两种实现方法的比较
- 代码中强制退出apk的两种方法区别与比较
- sqlserver两种分页方法比较
- Oracle Spool的用法小结以及两种方法的比较----------导出记录到文本 分享
- Java中Integer两种转int方法比较
- 面向对象建模与数据库建模两种分析设计方法的比较
- c++ primer 两种输入string方法的比较
- Oracle中spool命令实现的两种方法比较
- C#实现SQL SERVER数据库备份的两种方法比较
- 在C++中定义常量的两种方法的比较
- 比较两种php调用Java对象的方法
- Oracle Spool的用法小结以及两种方法的比较----------导出记录到文本
- 文件流操作两种方法比较
- HashMap的两种遍历方法比较
- AutoCAD.NET二次开发:创建自定义菜单的两种方法比较
- c语言:把只含因子2、3和5的数称为丑数,求按从小到大的顺序的第1500个丑数(两种方法比较)
- python清空字典的两种方法比较
- 比较两个字符串空,两种方法性能比较
- 洗牌程序的两种实现方法比较