Dynamic Handling Of Object Repositories in QTP

This article gives the details about the dynamic handling of Object Repositories.Dynamic Handling of Object Respositories represents the Finding the path of the object repository,Loading the Object Repository and Removing the Object repository during run time.

Dynamic Handling is very helpful to improve the QTP performance.To do this, QTP is providing an object called "RepositoriesCollection".

Loading Object Repository:
Use the following code snippet to load a specific Object Repository.

RepositoriesCollection.Add "Path of the repository file"

Finding Object repository:
Use the following code snippet to find a specific object repository.

RepositoriesCollection.Find("Path of the Object repository")

Removing Object Repositories:
Use the following code snippet to remove the Object Repository during run time.

RepositoriesCollection.Remove(position)

We can remove all the loaded Object Repositories by using the following code snippet.

RepositoriesCollection.RemoveAll

Example:
OrPath="C:\Automation\ObjectRepository\Login.tsr"
RepositoriesCollection.Add(OrPath)
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe"
Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set "softwaretestingcommunity"
Dialog("Login").WinEdit("Password:").SetSecure "mercury"
Dialog("Login").WinButton("OK").Click
pos=RepositoriesCollection.Fin(OrPath)
RepositoriesCollection.Remove(pos)
RepositoriesCollection.RemoveAll
SHARE

About அமரகோசம்

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment