Slideshow transcript
Slide 1: DP 101 in 60 simple slides www.AdvancedQTP.com
Slide 2: What is DP? DP stands for Descriptive Programming
Slide 3: But what IS DP? It’s a cool way to work without QTP’s Object-Repository (OR)
Slide 4: Why would I want to do that?
Slide 5: Many reasons
Slide 6: You have to Functions & Recovery scenarios work with different actions Different actions = Different ORs
Slide 7: ?Do I know you …Can’t be sure
Slide 8: You have to Can’t record certain objects Auto-hide panels Objects with changing hierarchies Nested inner-objects, Sub menus
Slide 9: !Hold still, damnit Even when you think you got it, all the properties turn out null
Slide 10: Simplicity Why kill a fly with an atom bomb? No need to use the OR for every one-time click button in the application
Slide 11: And, You can do VERY cool things with DP
Slide 12: OK, bring it on
Slide 13: First, we need to better understand the Object Repository What the OR is How does the OR work
Slide 14: I thought DP is all about NOT using the OR…
Slide 15: Well, yes, but under the hood, DP & the OR work the same way To understand the OR, is to understand DP
Slide 16: What is the OR?
Slide 17: A mysterious beast that records objects, in order to use them later
Slide 18: What is to record an object? Write down how to identify it
Slide 19: Who are you? = How can I identify you?
Slide 20: Identification is done with properties and values
Slide 21: Who are you? = Your height = 400 Your title = “NotePad” You are visible (=True)
Slide 22: So, What IS the OR? Collections of properties & corresponding values Each collection represents an object No mysterious beast here
Slide 23: OK, So what IS DP? DP is a way for specifying the properties & values without using the OR interface No mysterious beast here, either
Slide 24: OK, I get it, there’s nothing more than properties and values Can we get on with it?
Slide 25: actually use DP? How do I There are two ways
Slide 26: 1 Throw the properties and values straight into a command
Slide 27: It’s the good old syntax you know, except the string between the () is not the OR name. It’s the property:=value identification string
Slide 28: That’s kinda restrictive What if I want to use multiple identification properties?
Slide 29: No problem: VBWindow(“height:=400”, “title:=New Document”).Maximize You can use as many properties as you like
Slide 30: All fine and well, but what if I want to use regular expressions?
Slide 31: No problem: VBWindow(“title:=.*Document.*”).Maximize ID strings are automatically interpreted as regular expressions
Slide 32: 2 Throw the properties & values into a description object, and throw IT into the command
Slide 33: Here also, all the values are interpreted as regular expressions. To turn it off, use oDesc(“Property1”).RegularExpression = False
Slide 34: Method 1 is faster, best used for one or two commands, tops
Slide 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)
Slide 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
Slide 37: But, you can only start from OR, and move to DP So this will not work: VBWindow(“title:=notgood”).VBButton(“clickme”).Click
Slide 38: And that’s about it You can use each of the methods (or combine them), and you’ll be able to use objects that are not in the OR
Slide 39: You said I could do really cool stuff with DP!
Slide 40: Right you are We’ll 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
Slide 41: The power of the string DP is nothing more than simple strings We can do such interesting things with strings…
Slide 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:
Slide 43: The power of the string Very complex identification tasks can be done via strings manipulation Try different variations for yourself
Slide 44: Solving double objects When QTP finds two object which match the same description, it freezes This kinda sucks
Slide 45: ?
Slide 46: DP has a magic property: “index”, which allows us to tell the double objects apart Index is a zero-based counter
Slide 47: All is well
Slide 48: Getting objects collections This feature is so cool, deserves a title on its own
Slide 49: THE coolest thing you can do with DP, is to get a collection of all the objects that math an identification
Slide 50: I don’t know who you are, or how many are you, but I want to mark all of you! Regular DP won’t help - Don’t know how to identify each checkbox
Slide 51: Object collections to the rescue! Step 1: define a description object
Slide 52: Object collections to the rescue! Step 2: get all matching objects
Slide 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)
Slide 54: What can we do with it? Anything we want
Slide 55: Example for common uses Mark all Checkboxes Mark all checkboxes with a certain property (even RO)
Slide 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…
Slide 57: OK, this is indeed cool, but it only gets us the inner controls of a given window. Can we also get the application’s top level windows?
Slide 58: Sure
Slide 59: So, With DP we can work with no OR Sometimes we have to use it Other times it’s 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 It’s worth your while
Slide 60: And that was DP in 60 slides



Add a comment on Slide 1
If you have a SlideShare account, login to comment; else you can comment as a guest- Favorites & Groups
Showing 1-50 of 10 (more)