Wednesday, June 16, 2010

Descriptive Programming in QTP

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

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:

QTP support following applications for Automation

Default Add-ins
v  ActiveX
v  Visual basic
v  Web
Other Add-Ins
v  Siebel
v  Java
v  SAP
v  Oracle
v  Delphi
v  .Net 

Names of the Products and Vendor for Automation tools

Tool Name
Company Name
Latest Version
HP
10
IBM Rational
8.1.0.3
IBM Rational
2001
OpenSource Tool
1.0.6
Micro Focus
2009
AutomatedQA
7.52
Micro Focus
6.3
WATIR
Open Source tool
1.6.5

The benefits of Effective Test Automation

1) Cost Effective
2) Time is saved
3) Reusable the automation scripts
4) Human resources is reduce
5) Support the Development process

Object Spy in QTP

Object spy pointing mechanism for view the supported properties and methods of spy objects. Click on the “Hand symbol” button and select the window or object , it will display the Properties and value of the objects

There are two ways to Spy the objects in QTP
1) Choose Tools-> Object Spy
2) Object repository Dialog

Note:- The Application or object is not visible, hold the Ctrl button and Click or activate the required window to and release the Ctrl button

Object repository in QTP

Understand the Object Repository:
          While Record the Application, Manually Define or Add the Objects it stored into Object Repository. All Objects displayed in the tree view
v  Name:- Name of the Objects
v  Class: Class of the objects
v  Repository : Repository location and Default like “ Local”
v  Test Object details:
v  Description Properties: View/Modify the object’s properties and property value.
v  Ordinal Identifier : It indicate the Identifier Type – Location or Index  and Value 0(Default value)
v  Additional details : it will display Smart Identification is disable or enable and comments
Add the Objects into OR
v  Ctrl+ R (or) Resources -> Object Repository. Select  “Add object to Local” button, highlight the application or window, it will capture all the objects and stored into Object Repository