Descriptive programming

Descriptive programming is very powerful concept in UFT. Descriptive programming can be considered for the following scenarios.

1. Application is having many dynamic objects. Dynamic objects are the objects whose properties are not constant ,instead they will change very frequently.

2. It will by pass the object repository. If object repository’size is huge.Loading repository and maintaining such a big repository can become a challenge.

3. Execution will be faster.

4. Without knowing the unique properties of the objects, it is easy to get the collection of the similar objects an work on that.

5. If multiple people are using shared object repository, then updating object repository and accessing it becomes troublesome if it is used by any other person at the same time. It will be in read -only mode.No such case with descriptive programming.

6. In keyword driven programming. Suppose, if application is not ready yet but you know the properties description of the objects. You can create the objects with those description and objects will be used when application is available.

Types of descriptive programming:

1. Static DP
2. Dynamic DP

Static DP: A line of code creates an object by using the objects properties and values.
E.g. Consider, you need to create an webedit object without adding it to the repository. The pair of property and value is used to define an object.
Read the properties of the object using object spy and then use them in defining object as shown below.

Syntax: Object(“Property1:=value1″,Property2:=Value2”)

We can use multiple property and value combination.

Note: Note:
– We can use the object repository object as parent object and child object as descriptive programming but vice versa not possible. As you can see in the example – browser and page are taken fro object repository and webedit uses descriptive programming. – We can write the whole object in descriptive programming only.

We can use regular expression as well as ordinal identifiers.

 


 

Dynamic DP: It can be used to identify the identical objects or get the collection of the childobjects under any parent objects.

E.g. Suppose, There are n no. of links on a page and we need to count the no. of links and print their text as well.In this case, we will create a description object and extract these links(childobjects) under the page(Parent object).

 

Print Friendly, PDF & Email
Debugging
Error handling in UFT - Part 1
Shekhar Sharma

Shekhar Sharma

Shekhar Sharma is founder of testingpool.com. He is an automation engineer having more than 8 years of experience who loves troubleshooting in automation and finding innovative ways to solve the problems. His other leisurely activities includes playing harmonica, paintings, sketching portrait, watching movies and travelling etc.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *