Descriptive Programming in QTP – 1

Well, so what is descriptive programming or DP? There are many definitions:

Descriptive programming is defining objects present in the application programmatically without relying on the Object Repository (OR).

DP approach is used when you want to perform an action or an operation on an application object without adding it to the OR.

So what is Object Repository/OR?

OR is the store of the object data learned from the application under test.

Now let’s start… Following topics will be covered:

1.In line descriptive approach

2.Object Collection

3.Insider Techniques!!

In line DP

This is the simplest approach….  Properties required to identify an object will be specified as string arguments n line. 

Window(“Property1:=Value1”, “Property2:=Value2”).WinEditor(“Property1:=Value1”).Operation

For example let’s record entering text into a notepad… This is what you will get

Window(“Notepad”).WinEditor(“Edit”).Type “hello world”

Now if you observe the object properties has been added to the OR.

Now using one of the DP approach, OR is not required as the property values of the object would be specified in line.

Window(“Class Name:=Window”, “nativeclass:=Notepad”).WinEditor(“Class Name:=WinEditor”).Type “hello DP”

This would eliminate the need of the OR.  Now let’s delete the objects from the OR and re rerun the test

Window(“Class Name:=Window”, “nativeclass:=Notepad”).WinEditor(“Class
Name:=WinEditor”).Type “hello DP”

 Note that I used multiple property value pairs to identify the object and then performed an operation. 

Class Name Property and the native class property value pairs were used to describe the object. The object spy can be used to determine the properties and values that can be used.  Note that multiple property value pair might have to be used to identify an object as a unique object.

The second approach of using an object collection will be discussed in Descriptive Programming in QTP – 2