Instead of using Object Repository for storing properties of Test objects, we can straight-away define the properties while writing the script itself.
It can be done in two ways.
One is, by giving the description in form of the string arguments.
For example a text box having html code as <input type=”text” name=”txtUser”> can be accessed as below.
Browser(“Browser”).Page(“Page”).WebEdit(“Name:=txtUser”,”html tag:=INPUT”).set “QualityPoint”.
The other way is using Decription.create as below.
Set objDesc = Description.Create
objDesc(“html tag”).value= “INPUT”
This Descriptive approach is having some short-comings.
The main disadvantage of Descriptive programming is Maintenance issue.
Since Object repository will be stored in centralized place, property definition for any Object can be easily changed at any time if the application developer changes the property of the actual object/control.
But, in descriptive programming (DP) it is difficult to change the object property as each QTP developer will be defining object property in many places using DP.
For example, assume that you and team member are developing automation test scripts for testing gmail application.
Gmail login script will be used in many test scenarios.
Assume that you are automating some scenarios and your team member is automating some other scenarios.
In case of Object Repository, you and your team member will be forced to use same object description for login page controls/Objects (e.g username, password, login button).
So in future if Google changes any property (e.g change the button name from “login” to “get into gmail”), all the scenarios can be easily updated just by updating this change in Object repository.
But in case of DP, there is a possibility of defining the login button in multiple places. One definition by you and another by your team. (Anyway proper Team Coordination will avoid this issue, but practically it is very difficult to achieve this coordination.).
So, comparatively updating DP style coding is bit difficult if the application properties got changed.
Anyway, Descriptive programming is having its own advantages as mentioned below.
1. We can start work on writing QTP scripts even before the application under Test is NOT available. It will help to increase the utilization of the Automation scripts as it will be immediately available once the application gets released.
2. We can define the properties of an object without considering the parent objects in the hierarchy. i-e Object identification will not depend on its parent object.