|
,博彩网址导航
(责任编辑:admin)通常在这些情况下需要使用到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("WebTours").Page("Web Tours").ChildObjects(oWebChkDesc) For i = 0 to allCheck.Count - 1 SetoCheckBox = allCheck(i) oCheckBox.Set"ON" Next Whenand Why to use Descriptive programming? Below are some of the situations whenDescriptive Programming can be considered useful: 1、The objects in theapplication are dynamic in nature and need special handling to identify theobject. The best example would be of clicking alink which changes according to the user of the application, Ex. “Logout<>“. (对象动态变化,博彩咨询,需要特殊处理来识别) 2、When object repository is getting huge due to the no. of objectsbeing added. If the size of Object repository increases too much then itdecreases the performance of QTPwhile recognizing a object. (防止对象库过大导致QTP识别对象的性能下降) 3. When you don’t want to use objectrepository at all.(不使用OR而使用DP的场景) Well the first question would be why notObject repository? Consider the following scenario which would help understandwhy not Object repository Scenario1: Suppose we have a web application that has notbeen developed yet. Now QTP for recording the script and adding the objects torepository needs the application to be up,皇冠网址, that would mean waiting for theapplication to be deployed before we can start of with making QTP scripts. Butif we know the descriptions of the objects that will be created then we canstill start off with the script writing for testing (可以在AUT未开发出来之前开始QTP的脚本编写) Scenario2: Suppose an application has 3 navigation buttonson each and every page. Let the buttons be “Cancel”,博彩网址, “Back” and “Next”. Nowrecording action on these buttons would add 3 objects per page in therepository. For a 10 page flow this would mean 30 objects which could have beenrepresented just by using 3 objects. So instead of adding these 30 objects tothe repository we can just write 3 descriptions for the object and use it onany page.(减少添加重复的测试对象) 4、Modification to a test case is needed but the Object repository forthe same is Read only or in shared mode i.e. changes may affect other scriptsas well. (采用共享对象库会影响脚本的并发开发) 5、When you want to takeaction on similar type of object i.e. suppose wehave 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 goodprogramming approach.(需要对一组对象进行相同的操作时,皇冠足球投注网,用DP会比较方便) |
