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.
- Measure Client-side Performance using Lighthouse - August 10, 2017
- Perf Calculator – free iOS app for performance testers - July 16, 2017
- How to performance test AngularJS or ReactJS applications? - June 25, 2017
- How to run Apache JMeter tests with Visual Studio Team Services? - June 6, 2017
- Google Test Automation Conference – GTAC 2017 - June 2, 2017