Chapter - 4
Object Repository: -
It is a storage place, where we store objects and their information
Note: - Before designing or executing a test script we need to add objects to Object Repository for recognition of
objects by QTP. Else QTP is not able to understand the objects displayed the errors while executing the script
Navigation: - Resource menu Object Repository select
Or Click Object Repository
Or Cntrl + R
Application under test [AUT]: -It means which application we need to test is called AUT.
Adding Objects to Object Repository: -
We can add objects to Object Repository by manually or by Recording
Adding Objects to Object Repository By Manually: -
Open Application under test [AUT] Open Object Repository Click Ad Objects to local icon
Select required object with the help of handler pointer
Click OK button If it is parent object displays Filter Options [Selected objects only, Default Object
Types, All Object Types, Selected Object Types] Select required option Click OK Button.
Note: - Every Action maintains individual Object Repository in Object Repository
Options in Object Repository: -
We have Operations as follows
ADD: - We can add objects to Object Repository by manually or by Recording
Rename: - Open Object Repository Right Click on required object Select Rename
Delete: - Open Object Repository Right Click on required object Select Delete Check YES in
Confirmation
Note-1: - Before executing the script, we make sure that the AUT is open
Note-2: - If we Re-name the Object name in Object Repository it affects to test script
Note-3: - If we do any modification on objects in test script it will not/ doesn’t affect to Object Repository
Note-4: - If we save a test script Object Repository also saves for the same test script
Note-5: - We can drag objects from Object Repository to test script. We write test script in Keyword View.
Types of Object Repository: -
We have two types of Object Repository
1. Local Action (or) per Action Object Repository
2. Shared Object Repository
Local Action (or) per Action Object Repository: -
Maintaining Repositories in Action independent is called as Local Action (or) Per Action Object
Repository.
Ex: - Objects A1R (Action Repository)
Objects >A2R (Action Repository)
Objects >A3R (Action Repository)
Note1: - Local repository saves the file with “.mtr” [Mercury Test Repository] while save the script
Shared Objects Repository: -
Creating and maintaining a single repository for multiple actions called as
Shared Object Repository. EX: -
Creating Shared
Object Repository: -
It is a storage place, where we store objects and their information
Note: - Before designing or executing a test script we need to add objects to Object Repository for recognition of
objects by QTP. Else QTP is not able to understand the objects displayed the errors while executing the script
Navigation: - Resource menu Object Repository select
Or Click Object Repository
Or Cntrl + R
Application under test [AUT]: -It means which application we need to test is called AUT.
Adding Objects to Object Repository: -
We can add objects to Object Repository by manually or by Recording
Adding Objects to Object Repository By Manually: -
Open Application under test [AUT] Open Object Repository Click Ad Objects to local icon
Select required object with the help of handler pointer
Click OK button If it is parent object displays Filter Options [Selected objects only, Default Object
Types, All Object Types, Selected Object Types] Select required option Click OK Button.
Note: - Every Action maintains individual Object Repository in Object Repository
Options in Object Repository: -
We have Operations as follows
ADD: - We can add objects to Object Repository by manually or by Recording
Rename: - Open Object Repository Right Click on required object Select Rename
Delete: - Open Object Repository Right Click on required object Select Delete Check YES in
Confirmation
Note-1: - Before executing the script, we make sure that the AUT is open
Note-2: - If we Re-name the Object name in Object Repository it affects to test script
Note-3: - If we do any modification on objects in test script it will not/ doesn’t affect to Object Repository
Note-4: - If we save a test script Object Repository also saves for the same test script
Note-5: - We can drag objects from Object Repository to test script. We write test script in Keyword View.
Types of Object Repository: -
We have two types of Object Repository
1. Local Action (or) per Action Object Repository
2. Shared Object Repository
Local Action (or) per Action Object Repository: -
Maintaining Repositories in Action independent is called as Local Action (or) Per Action Object
Repository.
Ex: - Objects A1R (Action Repository)
Objects >A2R (Action Repository)
Objects >A3R (Action Repository)
Note1: - Local repository saves the file with “.mtr” [Mercury Test Repository] while save the script
Shared Objects Repository: -
Creating and maintaining a single repository for multiple actions called as
Shared Object Repository. EX: -
Creating Shared
Creating Shared Object Repository: -
Open AUTOpen Object RepositoryAdd object to Object RepositoryFileExport Local
ObjectsSave the file in required path with “.tsr” [Test Shared Repository]
After creating a shared ObjectRepository we need to associate to required test script for use.
We can associate in bellow ways
1. By Navigation
2. By Scripting
By Navigation: -
Open required test scriptRepositoryAssociate RepositoriesClick Add ButtonBrowse and Open
SOR [Shared Object Repository]select Required Actionclick OK button
By Scripting: -
Syntax: - RepositoriesCollection.Add “SOR File Path”
Ex: - RepositoriesCollection.Add “D:\suresh\OR\xxxx.tsr”
Note1: - RepositoriesCollection.Add is a static association i.e. if we write the statement in action, then it associate to
action1 Repository
Note2: - After script execution SOR disassociate by default.
Note3: -For better maintenance we use only one shared object repository.
Working with Shared Object Repository/ Operations in SOR: -
Directly we are not able to modify any operations on SOR file. We use Object Repository Manager [ORM].
Navigation: -Resource Menuobject Repository ManagerClick open folder iconBrows and open required SOR
fileclick Enable edit Iconperform required operations (Add, Rename, Delete)on ObjectsClick Save.
Note: - if we do any modification in SOR file it changes in all associated object repositories.
Merging Shared Object Repository: - [we won’t use]
Navigation: -Resources menu select ORM Toolsselect Object Repository Merge toolBrowse and Open
primary and secondary filesclick save icon save the file .tsr
Types of Objects
With respect to OR we have 2 types of objects.
1. Test objects
2. Runtime Object
Test Object: -Objects which are in OR are called as test objects.
Runtime Objects: - objects which are in AUT are called as runtime objects.
Note: - Every Test object is a run time object.
Note: - Every runtime object may or may not be a test object
Working with Test Objects: -
1. GetToProperty()
2. GetToProperties()
3. SetToProperty()
GetToProperty (): -
It is used to retrieve test object given, property value during run time.
Syntax: -
Ex: - MsgBox dialog(“login”).WinButton(“Help”).GetTOProperty (“Text”) ‘Returns Help
MsgBox Dialog(“login”).GetToProperty(“text”)
Note: - 1. If given property is invalid or not available in Object Repository. It retrieves EMPTY.
2. Property names are not case sensitive
GetTOProperties(): -
It is used to retrieve multiple property names and its values for a test object, from OR during run time.
Ex: - MsgBox Dialog(“login”).GetTOProperties() ‘ Returns ERROR {Script 2 is an example for this}
Script No 2: - Write a script to retrieve property names and values per a login object
Set sPropertyLst = Dialog("Login").GetTOProperties
'MsgBox sPropertyLst.Count
For index = 0 To sPropertyLst.Count-1
Print sPropertyLst(index).Name & VbTab & sPropertyLst(index).Value
Next
Set sPropertyLst = Nothing
SetTOProperty(): -
It is used to change the test object property values during run time.
Whenever object properties are changing at runtime we use this method:
Syntax: -
Ex: - Dialog(“login”). SetTOProperty “text”,”sreekar”
Working with Run Time Objects: -
GetROProperty(): -
It used to retrieve run time object property value during run time
Syntax: -
Ex: - MsgBox Dialog(“login”).GetROProperty(“text”)
[Above code will retrieve QTP identified properties {in object spy}]
Note: -*** If we want to retrieve Native Properties for an object we use “Object()”
Syntax: -
[Native Properties are developers given properties {in object spy}]
Work Out: - Go through the button, text box, browser, page, link for Identified Properties and Native Properties
Adding objects to OR by Run Time
Types of Recording: -
1. Normal or Standard Recording
2. Analog Recording
3. Low-Level Recording
Normal or Standard: - It is used to record standard objects like Window, Web, VB, Java, Dot Net…Etc.
Navigation: - Open application (AUT) Record Buttonselect desired environment (Web/ Windows)
Click Apply Click OK perform operations on AUT click Stop observe that script is generated in
test pane and respective objects added in OR.
Analog Recording: -
Analog recording is used to record diagrams, signatures, graphs…etc. It generates a single statement for
every start and stop recording.
Navigation:- Open AUTClick Recording in QTPSelect Environment window or webClick
OKSelect Analog Recording from Automation MenuSelect Record relative to the following window
radio buttonwith help of handler point select AUTClick start analog record buttonperform
operationClick Stop Recording in QTP.
Low-Level Recording: - It is used to record minimum operations on non-supported environments
Navigation: -Open AUTClick Record in QTPSelect desired EnvironmentWeb/WindowsSelect
Low Level Recording from Automation MenuPerform operations on AUTclick STOP Recording.
Object Repository Standards: -
1. What is an Object?
2. How QTP is recognizing objects?
3. What is OR?
4. What is your approach for writing a test script?
5. What is the default OR?
6. How do you add object to OR?
7. What is extension of PerAction of Local repository?
8. How do you create local Repository?
9. How many objects I can store in QTP test script?—2MB
10. How to create SOR?
11. What is difference between PerAction and SOR?
12. How many SOR files you have created for your project?
13. What is the file extension of SOR file?--.tsr
14. Where do you maintain all SOR files in your testing process?
15. Have you merged SOR files?
16. Why do you go for merging SOR files?
17. Can we do merge more than 2 SOR files at a time, if it is not then how do you merge more than two SOR files?
18. How do you merge PerAction Repository?
19. How many objects are there and what are they?
20. How do you create test objects?
21. What are the methods you can find for Test Objects?
22. What is the difference between GetToProperty and GetToProperties method?
23. Write a test script for retrieving multiple properties and their values for a object?
24. How do you handle, if test object properties are dynamically changing during run time?
25. How do you retrieve object information during runtime?
26. What is the deference between GetToProperty and GetROProperty?
27. Which method you are using for retrieving object information GetToProperty or GetROProperty?
28. Who will create SOR?
29. How do you work with SOR?
**** End of Chapter IV ****
No comments :
Post a Comment