QTP Descriptive Programming
QTP Descriptive Programming
Descriptive Programming:
QTP scripts can execute only if the objects are present in the Object Repository. If the descriptions
of the Objects are created using Descriptive programming when testers want to perform an
operation on an object that is not present in the object repository.
When the Object Repository grows big, it results in poor Performance as the size of the Object
Repository increases.
When the framework is built such that it has been decided not to use Object Repository at all.
When testers want to perform an action on the application at run-time without having the
knowledge of object's unique properties.
Syntax
There are two ways to script using Descriptive Programming technique. They are
Description Objects
Description Strings
Description Objects
Script is developed using description Objects that depends upon the properties used and their
corresponding values. Then these descriptions are used to build the script.
Description Strings
The description of the objects are developed using the properties and values as strings as shown
below.
Child Objects
QTP provides the ChildObjects method which enables us to create a collection of objects. The
parent objects preceeds ChildObjects.
Dim oDesc
Set oDesc = Description.Create
oDesc("micclass").value = "Link"
Ordinal Identifiers
Descriptive programming is used to script based on ordinal identifiers which will enable QTP to act
on those objects when two or more objects have same properties.
' Index
Obj.WebEdit("name:=Test","index:=0").Set "1123"
Obj.WebEdit("name:=Test","index:=1").Set "2222"