Trending September 2023 # Descriptive Programming In Qtp/Uft: Dynamic &Amp; Static # Suggested October 2023 # Top 11 Popular |

Trending September 2023 # Descriptive Programming In Qtp/Uft: Dynamic &Amp; Static # Suggested October 2023 # Top 11 Popular

You are reading the article Descriptive Programming In Qtp/Uft: Dynamic &Amp; Static updated in September 2023 on the website We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested October 2023 Descriptive Programming In Qtp/Uft: Dynamic &Amp; Static

What is Descriptive Programming?

Descriptive programming is used to execute operations on an Object in the AUT whose definition is not stored in the Object Repository. Using this mechanism, you can bypass identification from the Object Repository and supply the Object Description in the statement itself.

An object name is simply used to map an object in script with its description in an object repository. Meaning if you change the object name in your script and object repository, the script should run. Watch the following video on this concept

Video Highlights

Delete the Object Description of Agent Name Win Edit Box from the Object Repository. If you run the test again it will fail since it can not recognize the object. Let’s examine the reason why the script is failing

But what if instead of QTP replacing the object description, you as a tester directly specify the object descriptions in your script. This is nothing but “Descriptive Programming”

Types of Descriptive Programming

You can use Descriptive programming in two ways



Static Descriptive Programming

In Static Method, for object identification, you specify an object’s property in the following format


So in our case, the description for Agent Name becomes

"nativeclass:=Edit", "attached text:=Agent Name:" Dynamic Descriptive Programming

The second method of doing the same action is using Dynamic Descriptive programming

In case your script uses the descriptive programming object candidate multiple times, it will be very tiresome to specify all the property value pairs for each statement

In such cases, you can make use of Description Class provided by QTP

The syntax for creating a description object is

Set MyDescription = Description.Create(); MyDescription("property").Value = "property-value";

This is the Dynamic Method

Why Use Descriptive Programming?

Video Transcript

The million dollar question is why to use DP when the Object Identification process is handled by QTP

Suppose you are assigned to test a job portal. You enter a search query into the portal and

In such cases, you can use descriptive programming. Even though you do not know the number and names of the checkboxes you do know the class for the objects as “WebCheckBox”

You can use the ChildObject method to return objects belonging to a particular parent

A line of code like – Set allObjects = Browser("Jobs").Page("QTP").ChildObjects()

Will return all child objects for this page.

But we want only WebCheckBox objects. To do so we can create a filter creation object and set its property as web check box and pass this filter as an argument for the ChildObjects method

In this case, only the checkboxes are returned.

Next, you can write a code like this which access the entire collection of checkboxes starting from zero and sets all checkboxes ON.

You can also use Descriptive Programming to run objects which are difficult to record like Auto-Hide Panels, Objects with changing hierarchies, Nested Inner Objects, Sub-menus.

In conjunction with index property, descriptive programming could be very useful in identifying difficult objects.

If you use programmatic description for an object in object hierarchy you will need to use description programming for succeeding child objects

For example, for the page object, descriptive programming was used but for succeeding child object WinEdit Object Repository is used which is incorrect

On the contrary here for both Page and WinEdit descriptive programming is used which is correct

You're reading Descriptive Programming In Qtp/Uft: Dynamic &Amp; Static

Update the detailed information about Descriptive Programming In Qtp/Uft: Dynamic &Amp; Static on the website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!