Saturday, September 27, 2008

QTP: dynamic load object repository

Thanks blogger for this information. I will apply it into my project, current Framework. So for each application/test case, window, it will has its own object repository, to increase accurately object identify, improve QTP performance during recognising object




Repository from the Script
Examples, Quick Test Pro, VB Scripts

Sometime there could be multiple object repositories in a test. It is possible the scripts or reusable actions browse through multiple application, and each apps has separate object repository. One of the problem with QTP8.2, we cannot associate multiple repositories at the same time. Here is a function that switches the repositories from the script.

###############################
‘Purpose: This function switches between desired object repositories
‘Example: Call Switch_ObjRepo(”C:\ObjectRepositories\”, “ApplicationRepGlb.tsr”)
‘###############################
Function Switch_ObjRepo (new_path, ObjRepo_name)
Dim qtApp, qtTestResources, fullpath
Set qtApp = CreateObject(”QuickTest.Application”) ‘ Create the Application object
Set qtTestResources = qtApp.Test.Settings.Resources
fullpath = new_path & ObjRepo_name
qtTestResources.ObjectRepositoryPath = fullpath
Set qtTestResources = Nothing
Set qtApp = Nothing
End Function


--------------------------------------------------------------------------------

No comments:

Digital Inspiration Technology Guide

Change the world with your passion