Sunday, 2 March 2014

QTP Object Repository

Object Repository: ♦  Object Repository(OR) stores the objects information in QTP. Object repository acts as a interface between the Test sc... thumbnail 1 summary
Object Repository:
♦  Object Repository(OR) stores the objects information in QTP. Object repository acts as a interface between the Test script
    and AUT in order to identify the objects during execution.
♦  QuickTest has two types of object repositories for storing object information:
 1. Shared object repository
 2. Local object Repository


Shared Object Repository:

A Shared Object Repository(SOR) stores objects information in a file that can be accessed by multiple Test.Extension of file name is .tsr, This is the most familiar and efficient way to save objects.


Local Object Repository:


Local Object Repository stores objects information in a file that is associated with one specific action, so that only that action can access the stored objects.Extension of file name is .mtr. 




Associate OR's with Tools Options:
Ex1:





Assciate OR's without Tool Options:

Using Descriptive Method: (using VB Script associate the Repositories to the test script)

Ex1:

RepositoriesCollection.Add "C:\Documents and Settings\Administrator\Desktop\Login.tsr"

SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "asdf"
Dialog("Login").WinEdit("Password:").SetSecure "4ebb38aa00f6ebff54916645736b6385b5855c6d"

Dialog("Login").WinButton("OK").Click


Ex2:

'to add or to the test

repositoriescollection.Add "C:\Documents and Settings\Administrator\Desktop\Project FR\OR\Login.tsr"


repositoriescollection.Add "C:\Documents and Settings\Administrator\Desktop\Project FR\OR\OpenORder.tsr"

'executefile "C:\Documents and Settings\Administrator\Desktop\Project FR\Lib\Login.vbs"

'executefile "C:\Documents and Settings\Administrator\Desktop\Project FR\Lib\OpenORder.vbs"

'Call Login()
'Call OpenOrder()



 Ex3:

'to count object repositoreis
rc=repositoriescollection.Count
msgbox rc


repositoriescollection.RemoveAll 



Ex4:

executefile "c:\test.vbs"

RepositoriesCollection.Add "C:\Documents and Settings\Administrator\Desktop\Repository\Login.tsr"

x= RepositoriesCollection.Count
msgbox x


RepositoriesCollection.RemoveAll

x= RepositoriesCollection.Count
msgbox x


========================

No comments

Post a Comment