DP (Descriptive Programming) is a way to work in QTP without using the Object Repository. It allows specifying objects using property-value pairs instead of object names. There are two main ways to use DP - directly in commands or by creating description objects. DP provides more flexibility than the OR in handling dynamic objects and can retrieve collections of all objects that match a description. It enables powerful automation techniques like manipulating objects programmatically.
32. 2 Throw the properties & values into a description object, and throw IT into the command
33. Here also, all the values are interpreted as regular expressions. To turn it off, use oDesc(Property1).RegularExpression = False
34. Method 1 is faster, best used for one or two commands, tops
35. When you want to execute multiple commands on an object, method 2 is a better choice by far (allows one-time definitions, multiple uses)
36. You can use DP with OR VBWindow(OR).VBButton(text:=OK).Click Or (when oDesc is a description object): VBWindow(OR).VBButton(oDesc).Click
37. But , you can only start from OR, and move to DP So this will not work: VBWindow(title:=notgood).VBButton(clickme).Click
38. And thats about it You can use each of the methods (or combine them), and youll be able to use objects that are not in the OR
39. You said I could do really cool stuff with DP!
40. Right you are Well cover some of the more popular tricks and tips These examples are only the tip of the iceberg. Play with them and see the true power of DP
41. The power of the string DP is nothing more than simple strings We can do such interesting things with strings
42. The power of the string Say we got an app with 4 checkboxes, check0, , check4 We can set all of them with a nice simple loop:
43. The power of the string Very complex identification tasks can be done via strings manipulation Try different variations for yourself
44. Solving double objects When QTP finds two object which match the same description, it freezes This kinda sucks
53. Object collections to the rescue! Step 3: Use the collection oChildren now holds a collection of all the checkboxes So the first checkbox is accessed by: oChildren(0)
55. Example for common uses Mark all Checkboxes Mark all checkboxes with a certain property (even RO)
56. The possibilities are endless Randomly input fields Input only mandatory fields Zero maintenance (new fields are added automatically, blind to UI changes) Select object which match complex identification criteria (write custom if filters) The list goes on and on
57. OK, this is indeed cool, but it only gets us the inner controls of a given window. Can we also get the applications top level windows?
59. So, With DP we can work with no OR Sometimes we have to use it Other times its just more fun and useful DP also throws in a lot of extras that make it an inseparable part of good QTP automation Taste it, Experience it, Learn it, Use it, Love it Its worth your while