-->Descriptive Programming & Description Objects

Providing the description of an object in the script itself (rather than maintaining them in the object repository) is called ‘Descriptive Programming’.

Scenarios in which Descriptive Programming can be used:
1.The object repository is full (saturated) & doesn’t want to add any new objects to it.
2.The object repository is read-only, where we can’t add any new objects
3.To increase the performance of the script execution. (Performance increases because there is no searching time for the object in the object repository during playback)
4.The application is still under development & test team wants to develop the automation script based on the proto type or by just having the properties of the object.

Eg: Dialog(“text:=Login”).WinEdit(“Attached Text:=Agent Name:”).Set “Rafi”
Dialog(“text:=Login”).WinEdit(“Attached Text:=Password:”,“height:=20”).Set “mercury”
Dialog(“text:=Login”).WinButton(“Text:=OK”).Click

Description Object:
It is used to define an object with its unique properties & use the object name in the scripting whenever it is required.

Eg: Set Dialog1=Description.Create
Dialog1(“text”).Value= “Login”
Set Dialog2= Description.Create
Text2(“Attached Text”).Value =“Password”
Text2(“Height”).Value=20
Dialog (Dialog1).WinEdit(“Attached Text:=Agent Name:”).Set “Rafi”
Dialog(Dialog1).WinEdit(Text2).Set “mercury”
Dialog(Dialog1).WinButton(“Text:=OK”).Click

Eg: Script which uses both DP & DO
Browser("Title:=.:OpenEnquiry:.").Page("Title:=.:OpenEnquiry:.").Link("Text:=Administration").Click
Browser("Title:=OpenEnquiry").Page("Title:=OpenEnquiry").Link("Text:=forum threads","Class:=menuheadlink").Click
Browser("Title:=OpenEnquiry_Threads").Page("Title:=OpenEnquiry_Threads").WinButton("name:=sort").Click
Set oDesc=description.CreateCreate()
oDesc("Micclass").Value="webList"
Set lists=Browser("Title:=OpenEnquiry_Threads").Page("Title:=OpenEnquiry_Threads").ChildObjects(oDesc)
NumberOfLists=Lists.Count()
msgbox NumberOfLists