July 4, 2013

Descriptive Programming in HP QTP

In this blog, we will see about Descriptive Programming in HP QTP and some sample codes which helps you to learn and practice.

What is Descriptive Programming?

By default, QTP recognizes everything as an object. Each object’s properties, methods, and values get stored in repository called Object Repository. During run-time, QTP try to matches properties and values that are stored in OR with the run-time objects. If it matches, then the QTP performs specified action in the script. If not, QTP throws Object not found error or some appropriate error messages.

Descriptive Programming is one of the approaches that are widely followed in the projects which help automation engineers to define the property and values on their own to identify the objects during execution.

To define an object using Descriptive Programming approach, use below syntax:

Set myObj = Description.Create()

To define the object properties and values, use below syntax:

Objectname(“property_type”).value = “property_value”
myObj ("Name").Value = "userName"

myObj ("Index").Value = "0"

Next step is to define the action. Action can be defined using respective methods for the defined objects.

Browser(“QAInsights”).Page(“QAInsights”).WebEdit(myObj).Set “QAInsights”

Above syntax enters the text “QAInsights” in username field. The same can be achieved using value pairs i.e. propertyname:=propertyvalue.

i.e. classname(“propertytype:=propertyvalue”)


Browser(“title:=QAInsights”).Page(“name:=QAInsights”).WebEdit(“name:=userName”,”index:=0”).Set “QAInsights”

Thanks for visiting QAInsights! Check out our new portal to get updates on Software Testing related certifications. We’re always posting interesting articles on QAInsights. I request you to subscribe so you don’t miss out anything. Searching for QA Jobs Openings, check it at

Want to start a blog like this, please visit SpidyDomain to buy cheap web hosting and register domain.

Subscribe to our QAInsights YouTube Channel | Subscribe our free weekly newsletter.

About NaveenKumar Namachivayam

Hi there! is a passionate and experienced Performance Test Analyst based in Chicago, USA with skill sets in Manual Testing, Test Automation, Performance Testing, and Test Estimation. He loves to learn and experiment new trends and models in Software Testing. Please stop by at his personal blogs: Excel Blog, DealsBrook,, and Affiliate Insights blog and Software Testing Memes.

Leave a Reply

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