DP 101 in 60 simple slides www.AdvancedQTP.


What is DP?
DP stands for Descriptive Programming

But what IS DP?
It¶s a cool way to work without QTP¶s
Object-Repository (OR)

Why would I want to do that? .

Many reasons .

You have to Functions & Recovery scenarios work with different actions Different actions = Different ORs .

Do I know you? Can¶t be sure« .

Sub menus .You have to Can¶t record certain objects Auto-hide panels Objects with changing hierarchies Nested inner-objects.

Hold still. damnit! Even when you think you got it. all the properties turn out null .

Simplicity Why kill a fly with an atom bomb? No need to use the OR for every one-time click button in the application .

You can do VERY cool things with DP .And.

bring it on .OK.

First. we need to better understand the Object Repository What the OR is How does the OR work .

I thought DP is all about NOT using the OR« .

Well. but under the hood. is to understand DP . yes. DP & the OR work the same way To understand the OR.

What is the OR? .

A mysterious beast that records objects, in order to use them later

What is to record an object?

Write down how to identify it

Who are you?

How can I identify you?

Identification is done with properties and values .

Who are you? = Your height = 400 Your title = ³NotePad´ You are visible (=True) .

So. What IS the OR? Collections of properties & corresponding values Each collection represents an object No mysterious beast here .

either . So what IS DP? DP is a way for specifying the properties & values without using the OR interface No mysterious beast here.OK.

OK. I get it. there¶s nothing more than properties and values Can we get on with it? .

How do I actually use DP? There are two ways .

1 Throw the properties and values straight into a command .

except the string between the () is not the OR name. It¶s the property:=value identification string .It¶s the good old syntax you know.

That¶s kinda restrictive What if I want to use multiple identification properties? .

No problem: VBWindow(³height:=400´.Maximize You can use as many properties as you like . ³title:=New Document´).

All fine and well. but what if I want to use regular expressions? .

*´).Maximize ID strings are automatically interpreted as regular expressions .No problem: VBWindow(³title:=.*Document.

2 Throw the properties & values into a description object. and throw IT into the command .

RegularExpression = False . all the values are interpreted as regular expressions.Here also. To turn it off. use oDesc(³Property1´).

Method 1 is faster. tops . best used for one or two commands.

method 2 is a better choice by far (allows one-time definitions. multiple uses) .When you want to execute multiple commands on an object.

You can use DP with OR VBWindow(³OR´).VBButton(oDesc).VBButton(³text:=OK´).Click .Click Or (when oDesc is a description object): VBWindow(³OR´).

But. you can only start from OR. and move to DP So this will not work: VBWindow(³title:=notgood´).VBButton(³clickme´).Click .

and you¶ll be able to use objects that are not in the OR .And that¶s about it You can use each of the methods (or combine them).

You said I could do really cool stuff with DP! .

Play with them and see the true power of DP .Right you are We¶ll cover some of the more popular tricks and tips These examples are only the tip of the iceberg.

The power of the string DP is nothing more than simple strings We can do such interesting things with strings« .

check4 We can set all of them with a nice simple loop: .The power of the string Say we got an app with 4 checkboxes. check0. «.

The power of the string Very complex identification tasks can be done via strings manipulation Try different variations for yourself .

it freezes This kinda sucks .Solving double objects When QTP finds two object which match the same description.

? .

DP has a magic property: ³index´. which allows us to tell the double objects apart Index is a zero-based counter .

All is well .

deserves a title on its own .Getting objects collections This feature is so cool.

THE coolest thing you can do with DP. is to get a collection of all the objects that math an identification .

Don t know how to identify each checkbox .I don t know who you are. but I want to mark all of you! Regular DP won t help . or how many are you.

Object collections to the rescue! Step 1: define a description object .

Object collections to the rescue! Step 2: get all matching objects .

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) .

What can we do with it? Anything we want .

Example for common uses Mark all Checkboxes Mark all checkboxes with a certain property (even RO) .

blind to UI changes) Select object which match complex identification criteria (write custom if filters) The list goes on and on« .The possibilities are endless Randomly input fields Input only mandatory fields Zero maintenance (new fields are added automatically.

OK. but it only gets us the inner controls of a given window. this is indeed cool. Can we also get the application¶s top level windows? .

Sure .

So. Love it It¶s worth your while . Use it. Experience it. 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. Learn it.

And that was DP in 60 slides .