Micro Focus QTP (UFT) Forums
How to associate Function Libraries, OR's during Run Time? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: How to associate Function Libraries, OR's during Run Time? (/Thread-How-to-associate-Function-Libraries-OR-s-during-Run-Time)

Pages: 1 2


How to associate Function Libraries, OR's during Run Time? - qtpdeepak - 09-12-2009

Can anyone breif me ,How to associate Function Libraries, OR's during Run Time?


RE: How to associate Function Libraries, OR's during Run Time? - sreekanth chilam - 09-12-2009

Hi ,

You can associate Func. Libraries using 'AOM' & OR's by using 'RepositoriesCollection' during RunTime.

Search in the forums , you can get it.


RE: How to associate Function Libraries, OR's during Run Time? - Anshoo Arora - 09-12-2009

At run-time, libraries cannot be associated with a test. You will have to use one of the Execute (ExecuteFile, ExecuteGlobal) functions to load them dynamically.


RE: How to associate Function Libraries, OR's during Run Time? - azeem - 09-12-2009

Hi Anshoo,

Could you please provide us the code to load functions dynamically.

Thanks,
Azeem


RE: How to associate Function Libraries, OR's during Run Time? - Tarik Sheth - 09-13-2009

Hi,

Use following code example for excuting function from library.

Code:
'Use executefile function to load library files.
'Example:
executefile "C:\Documents and
Settings\tsheth\Desktop\Sample123.vbs"
x=50
y=50
result=Sum(x,y)
msgbox(result)


'Code in External Library file(.vbs file).
Public function Sum(a,b)
Dim sum
sum=a+b
Sum=sum
End Function



RE: How to associate Function Libraries, OR's during Run Time? - azeem - 09-14-2009

Hi Tarik,

Thanks for your code, how to load OR's(more than one) dynamically at run time to a test.

Thanks
Azeem


RE: How to associate Function Libraries, OR's during Run Time? - Tarik Sheth - 09-14-2009

Hi,

To associate Object repository dynamically use the following code.
Try this for attaching Object repository at run time.

Code:
Dim qtpApp
Set qtpApp = CreateObject("QuickTest.Application")
Dim qtpRepositories
Set qtpRepositories = qtApp.Test.Actions("Main").ObjectRepositories
qtpRepositories.Add("C:\ts.tsr")



RE: How to associate Function Libraries, OR's during Run Time? - Saket - 09-14-2009

There is another easy of doing the same using 'RepositoriesCollection.Add'

I feel we should avoid using QuickTest application object during runtime


RE: How to associate Function Libraries, OR's during Run Time? - azeem - 09-14-2009

@Tarik @Saket - Thanks for the Code both are working fine, But I want upload repositories dynamically using the "ObjectRepositoryUtil" object

Could you please let me know how to use the above object to load.

Thanks,
Azeem


RE: How to associate Function Libraries, OR's during Run Time? - Saket - 09-15-2009

Hi Azeem,

Please open a new thread for your new question.