Object Repository:
Ø OR is a place to stores QTP learned objects
Ø QTP uses default Object Identification properties: mandatory and assistive to learn objects into OR
Script play back using OR
- QTP find the Objects in OR using Logical name and Object hierarchy
- QTP retrieve the test object properties from OR
- QTP search the application for the object with the same object in OR and perform the user action
Descriptive Programming:
v Learn the object Properties and physical description of the objects and used into Script level
v Descriptive properties is store Script level
Script play back using Descriptive programming
- QTP search the AUT for the Object using Descriptive properties and performs user action
How to use the Descriptive programming
They are two ways in which descriptive programming can be used as below
1) By creating properties for collection of Objects or Child Objects
We can use description object to get all the objects on the page that matches that specific description. Suppose we have to check all the checkboxes present on a web page. So we will first create an object description for a checkbox and then get all the checkboxes from the page
Dim obj_ChkDesc
Set obj_ChkDesc=Description.Create
obj_ChkDesc(“html tag”).value = “INPUT”
obj_ChkDesc(“type”).value = “checkbox”
Dim allCheckboxes, singleCheckBox
Set allCheckboxes = Browse(“Browser”).Page(“Page”).ChildObjects(obj_ChkDesc)
For each singleCheckBox in allCheckboxes
singleCheckBox.Set “ON”
Next
Dim obj_ChkDesc
Set obj_ChkDesc=Description.Create
obj_ChkDesc(“html tag”).value = “INPUT”
obj_ChkDesc(“type”).value = “checkbox”
Dim allCheckboxes, singleCheckBox
Set allCheckboxes = Browse(“Browser”).Page(“Page”).ChildObjects(obj_ChkDesc)
For each singleCheckBox in allCheckboxes
singleCheckBox.Set “ON”
Next
2) By creating properties for Single Objects
When going for single or specific point within a test object hierarchy, you must create descriptive properties from starting onwards
For Example,
Dialog("text:=Login").Activate
Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Set "vinodh"
Dialog("text:=Login").WinEdit("attached text:=Agent Name:").Type micTab
Dialog("text:=Login").WinEdit("attached text:=Password:").SetSecure "4c18d6c06f2d8fe29ad434c54106936bc9199553"
Dialog("text:=Login").WinButton("regexpwndtitle:=OK").Click
Window("text:=Flight Reservation").Close
Note: If initially of the code used OR objects after that, if used descriptive properties, QTP doesn’t recognize the objects
For example
Dialog("text:=Login").WinButton("OK").Click
Error:
No comments:
Post a Comment