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.
Above syntax enters the text “QAInsights” in username field. The same can be achieved using value pairs i.e. propertyname:=propertyvalue.
Thanks for visiting QAInsights! Check out our new portal Testifications.com 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 www.QAJobOpenings.com
Want to start a blog like this, please visit SpidyDomain to buy cheap web hosting and register domain.
- Unboxing Apache JMeter 4.0 - February 13, 2018
- Swagger Inspector and Swagger Hub Hands-on - January 25, 2018
- Speedometer 2.0 Testing - January 17, 2018
- Performance Analysis of Rajini Makkal Mandram Website - January 8, 2018
- Must Have Tools For Technical Founders - November 9, 2017