Showing posts with label Object Repository. Show all posts
Showing posts with label Object Repository. Show all posts

Thursday, August 9, 2012

Web based Test Objects and Test Operations


Test object is an object that qtp creates in the test to represent the actual object in the application.
Below are some of the web application Test Objects, based on the below syntax the test objects are been placed.

Syntax:

In which browser.In which page.In which object.what operation

As per above syntax the below script will be generate,

Browser("BrowserName").Page("PageName").Object("ObjectName").Operation

For Example:

Browser("Google").Page("Google").webedit("q").set "QTP 11.0"
Browser('Google").Page("Google").webbutton("Googlesearch").Click

Properties of an Object Names:

Browser Name: Google
Page Name: Google
Edit box: q
Button Name: Googlesearch

Test Objects:














Test Operations:

There will be no change in Test Operations, For and Windows the test operations will be same 



Tuesday, August 7, 2012

Concept of Object Repository (OR)


Add Objects:

Resources --> Object Repository (Ctrl+R) --> Objects --> Add Objects to Local --> Choose the Auto (or) Object --> All object Type

By doing above operations in Resources menu in QTP objects are been added                         
Save OR:

OR - Window --> Export Local Object -->  File Name

By doing above operations in Object Repository menu under Resources in QTP OR is saved.

Associate Repository:

Resources --> Associate Repository --> (+) click --> Choose tsr file --> Available Action --> Action 1 -->   Associate Action --> OK

By doing above operations the created objects (.tsr) are been added to the Associate Repository

(or)

we can add the path of the .tsr file which indicates the repository where it get stored

RepositoriesCollection.Add "C:\Program Files (x86)\HP\QuickTest Professional\TSR\flight.tsr"
Systemutil.Run(""C:\Program Files (x86)\HP\QuickTest Professional\samples\flight\app\flight4b.exe")
Dialog("Login").Active
Dialog("Login").WinEdit("Agent Name:").Set "admin"
Dialog("Login").WinEdit("Password:").Set "mercury"
Dialog("Login").WinButton("OK").Click
Window("Flight Reservation").Close

So, as per the above script if the qtp play backs these scripts, even if the objects are not assigned to associate repository (RepositoriesCollection.Add "C:\Program Files (x86)\HP\QuickTest Professional\TSR\flight.tsr") the given script will bring the stored objects from the targeted path.

Keyword Driven

Object:

         As very simple to describe about object, "Each and everything that we seeing in Application is called an Object", The identified objects are been stored in object repository,

                          QTP --> OR --> Application

        When the QTP play back the recorded scripts, At first QTP will look for objects that we stored in the repository, "Object Repository" is the place where it holds its properties and its values, Here we can store all the object information's which is available  in the application, and it acts as a interface between QTP and Application

Steps to go for Object Repository:

1. Open QTP
2. Click on "Resources" menu
3. Click on "Object Repository" (Ctrl+R)

After the above steps, Click on "Add Objects to local" Menu



















In above screenshot i just captured the all objects of "www.google.co.in", Here the selected Test Object is "Google" the object Properties of the google is the same highlighted in Right side of the page,

Name: Google
Class: Browser
Repository: Local (Stored in Local system)

By having the above object properties we can generate the script without recording, since the captured object is get stored in local,

Browser("Google").Page("Google").WebEdit("q").Set"QTP"
Browser("Google").Page("Google").WebButton("Google Search").Click

the above script will "Google Search" the word "QTP" once it get playback from the "Object Repository"