`
kuwoleft
  • 浏览: 1078350 次
文章分类
社区版块
存档分类
最新评论

什么时候使用DP?

 
阅读更多

通常在这些情况下需要使用到 DP Descriptive Programming :

* Checking/Unchecking all Check Boxes on a web page

* Setting all the Text Boxes to blank value

* Selecting the first possible value for every WebRadioGroup

下面是一个使用的例子:

Dim oWebChkDesc

Set oWebChkDesc = Description.Create

oWebChkDesc("micclass").value = "WebCheckBox"

oWebChkDesc("html tag").Value = "INPUT"

'Get all objects matching this description

Dim allCheck, oCheckBox

Set allCheck = Browser("Web Tours").Page("Web Tours").ChildObjects(oWebChkDesc)

For i = 0 to allCheck.Count - 1

Set oCheckBox = allCheck(i)

oCheckBox.Set "ON"

Next



When and Why to use Descriptive programming?

http://knowledgeinbox.com/articles/qtp/descriptive-programming/dp-part-1-overview/

Below are some of the situations when Descriptive Programming can be considered useful:

1 The objects in the application are dynamic in nature and need special handling to identify the object. The best example would be of clicking a link which changes according to the user of the application, Ex. “Logout <>“. 对象动态变化,需要特殊处理来识别

2 When object repository is getting huge due to the no. of objects being added. If the size of Object repository increases too much then it decreases the performance of QTP while recognizing a object. 防止对象库过大导致 QTP 识别对象的性能下降

3. When you don’t want to use object repository at all. 不使用 OR 而使用 DP 的场景

Well the first question would be why not Object repository? Consider the following scenario which would help understand why not Object repository

Scenario 1 : Suppose we have a web application that has not been developed yet. Now QTP for recording the script and adding the objects to repository needs the application to be up, that would mean waiting for the application to be deployed before we can start of with making QTP scripts. But if we know the descriptions of the objects that will be created then we can still start off with the script writing for testing 可以在 AUT 未开发出来之前开始 QTP 的脚本编写

Scenario 2 : Suppose an application has 3 navigation buttons on each and every page. Let the buttons be “Cancel”, “Back” and “Next”. Now recording action on these buttons would add 3 objects per page in the repository. For a 10 page flow this would mean 30 objects which could have been represented just by using 3 objects. So instead of adding these 30 objects to the repository we can just write 3 descriptions for the object and use it on any page. 减少添加重复的测试对象

4 Modification to a test case is needed but the Object repository for the same is Read only or in shared mode i.e. changes may affect other scripts as well. 采用共享对象库会影响脚本的并发开发

5 When you want to take action on similar type of object i.e. suppose we have 20 textboxes on the page and there names are in the form txt_1, txt_2, txt_3 and so on. Now adding all 20 the Object repository would not be a good programming approach. 需要对一组对象进行相同的操作时,用 DP 会比较方便

分享到:
评论

相关推荐

    djh123#note#像素 720dp sw720dp DPI 关系???1

    sw720 的dp 的意思是最小720dp 红米手机的宽720px/2=360 所有 红米手机 应该是sw360 android 在运行程序的时候应该会找 dr

    转DP使用手册

    本产品适用的场合是将普通的RS232(俗称串口)或者485 口...所以使用本产品的时候您只需要弄清楚您需要连接到Profibus 的设备接收什么数据, 发送什么数据,也就是怎么和您使用的设备进行通讯。下面会用例子进行说明。

    JDP5.20免狗版本

    ------关闭NCServer:不需要开启NCServer的时候手动关闭(之前有朋友不知道要到什么地方才能关掉) 2.加了一个JDP免狗版的快捷方式 ---其实就是软件及转换器开启的快捷方式 (因为批处理的图标不是那么好看) 软件...

    DP-311u使用教程

    设置打印机的时候,请直接将打印服务器用网线连接电脑,暂时不接入你的局域网,暂时不连接打印机。电脑若是有无线网卡,将无线网络断开或者禁用。 设置打印服务器教程

    MS-C-DP使用手册(MODBUS接口做主站

    微硬创新MS-C-DP硬件连线如下: (1) 如图1-0,顶部为电源接口(直流24V)、Modbus主从设置拨码(MS为Modbus做从站,MM为做Modbus主站)、Profibus地址设置拨码(采用的是8421码,如AD1-AD3拨到ON的位置地址为7)。 ...

    Android 的px到DP的转换工具

    在android开发中布局文件要用DP进行布局,但是美工在设置的时候一般都是用PX,美工按照800*480分辨率设计完了,程序人员可以直接使用PX进行布局测试,该工具可以再程序完成时将PX直接转换为DP 方便适配

    100小时学SAP之FI财务篇笔记-DP版

    不喜欢上传什么资源。自己网上下载的资源又觉得是别人的,懒得上传。后来自己在做项目的过程中倒是慢慢写了很多SAP的笔记。但怕CSDN上每人看。也不弄。不过CSDN上的其他资源还是不错了。特别是程序开发。但中是要...

    数塔问题 DP

    在讲述DP算法的时候,一个经典的例子就是数塔问题 要求从顶层走到底层,若每一步只能走到相邻的结点,则经过的结点的数字之和最大是多少?

    Android中的长度单位详解(dp、sp、px、in、pt、mm).pdf

    总算,把Android中要用到各种长度单位,讲清楚了,以前用的时候,总是不清不楚的。现在用得心里有底了。

    基于Android中dp和px之间进行转换的实现代码

    一般情况下,我们都会选择使用dp,这样可以保证不同屏幕分辨率的机器上布局一致。但是在代码中,如何处理呢?很多控件的方法中都只提供了设置px的方法,例如setPadding,并没有提供设置dp的方法。这个时候,如果需要...

    【程序】STM32F107VC单片机驱动DP83848以太网PHY芯片,移植lwip 2.1.2协议栈,并加入网线热插拔检测的功能(HAL库)

    开发板: 杜邦线传输高速数字信号容易出错,所以在用面包板搭建开发环境时,最好使用25MHz时钟的MII接口。如果要用50MHz的RMII接口,那么杜邦线必须要...因为单片机没有运行的时候,DP83848没有时钟信号,如果此时D

    Android 中SP与DP的区别实例详解

    从一开始写Android程序,就被...这时候,就开始怀疑了,到底有啥区别呢,dp和sp有什么不同呢? 我们做个简单的Sample验证一下,如下,一个布局代码 &lt;TextView android:layout_width=wrap_content android:layout_height

    dp18_ap6330整理完工20170209_1129.7z

    rootroot@cm-System-Product-Name:/home/wwt/dp18_ap6330/lichee/linux-3.10$ make ARCH=arm64 menuconfig rootroot@cm-System-Product-Name:/home/wwt/dp18_ap6330/lichee/linux-3.10$ WIFI部分可以关闭realtek:...

    TypeC转DP视频输出模块

    基于CH543的USBC AltMode模式,PD协议通讯验证 正常基于TypeC的母口插座进行应用的时候,都需要MUX芯片进行切换,基于此,有以下两种应用方式

    Android UI规范

    为什么是 48dp? 一般情况下,48dp 在设备上的物理大小是 9mm (会有一些浮动)。这是触摸控件的推荐大小 (范围7-10mm) ,用户用手指触摸起来比较容易、且准确。 如果您设计的 UI 元素都至少有 48dp 的高度和宽度,...

    DP83848 - 单路10/100 Mb/s 以太网收发器在省电模式下的初始化

     美国国家半导体公司的DP83848 10/100 Mb/s 单路物理层器件的应用设计选项是在省电模式下当系统上电时候器件支持初始化。该选项可以通过外部逻辑器件来执行。具体采用一个外部电阻或者一个逻辑器件和电阻的组合来...

    不同屏幕分辨率适配的varlues包

    下载这些不同屏幕对应的demens目录和文件到自己项目的res目录下,布局中控件设置宽高的时候类似这样调用android:layout_width="@dimen/dp_45"就可以

    常见算法小结(DP、动态规划、最长子序列、DFS、BFS等常见基础算法小集)

    本资源主要是汇集了自己刷题时总结下来的一些经典题目:包括二分、字符串替换、DP问题、动态规划、最长子序列、DFS、BFS、回溯算法等,旨在记录和查看复习,为了不断提升,不断更新补充。也包括链表的一些基础,有...

    解析android中的dip,dp,px,sp和屏幕密度

    在屏幕密度为160的显示屏上,1dip=1px,有时候可能你的屏幕分辨率很大如480*800,但是屏幕密度没有正确设置比如说还是160,那么这个时候凡是使用dip的都会显示异常,基本都是显示过小。 dip的换算: dip(value)=...

Global site tag (gtag.js) - Google Analytics