Sunday, 28 October 2012

Dynamic Handling of Object Repositories



Dynamic handling of object Repositories

Loading repositories during running, finding path of the repositories and removing repositories is called Dynamic Handling of Object Repositories.

Using this feature we can increase QTP performance. To do this, QTP is providing an object called “RepositoriesCollection”.

Syntax for Loading a Repository:
RepositoriesCollection.Add “Path of the Repository File”

Syntax for finding Position of the Repository:
Variable=RepositoriesCollection.Find(“Path of the Repository”)

Syntax for Removing the Repository:
RepositoriesCollection.Remove(position)

Syntax for Removing All Repositories:
RepositoriesCollection.RemoveAll

Example:
RepPath="C:\Documents and Settings\Administrator\My Documents\Login.tsr"
RepositoriesCollection.Add (RepPath)
systemutil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "sudhakar"
Dialog("Login").WinEdit("Password:").Set "mercury"
Dialog("Login").WinButton("OK").Click
pos=RepositoriesCollection.Find(RepPath)
RepositoriesCollection.Remove(pos)
RepositoriesCollection.RemoveAll
***********************************
Go to home page for QTP Guide, Script examples, Interview questions and Framework etc.


No comments:

Post a Comment