Tuesday, July 12, 2011

AOM to load Object Repository (Shared) at Runtime. How?

Reference : HP QTP Automation Object Model - What & Why?

Now to load shared object repository runtime, we need to use the AOM approach. You can write the script inside QTP however it is not the right approach and not intended to be used this way.

Advantage: Using this approach you can import the OR just like your datatable at runtime. This will give flexibility when you are designing an automation framework

Be sure of the path of the OR 'path of shared OR tsr file' where you have saved the file

You can now add the necessary step in the generated script (in the last Script looks like in the Launch.vbs):

Script:

Dim qtApp 'Declare the application Object Variable

Dim qtObjRep 'Declare the object repository object

Set qtApp = CreateObject("QuickTest.Application") 'Creating and setting the QuickTest Application object to qtApp

Set qtObjRep = qtApp.Test.Actions().ObjectRepository 'Get the object repository collection collection object for the test action

qtObjRep.Add "Path of the Shared OR .tsr file",1

OR

qtApp.Test.Settings.Resources.ObjectRepositoryPath = “Path of the shared OR .tsr file



No comments:

Post a Comment