How to call function lib at run time from an action - 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 call function lib at run time from an action (/Thread-How-to-call-function-lib-at-run-time-from-an-action) |
How to call function lib at run time from an action - anilyad - 09-01-2010 Maybe silly, but i have developed an automation framework where in i need to call a Demo.qfl (runtime) from an ACTION. If i use the following funcLibraryFile() , it fails to call since QTP doesnt know which lib to check this function since qfl is not loaded atall. I can not use Absolute file path. Call funcLibraryFile("Demo.qfl") My Sub is and i am using executeFile Code: sub funcLibraryFile(libFile) Any ideas? thanks-anil RE: How to call function lib at run time from an action - PrabhatN - 09-02-2010 Hi Anil, First of all, I would like to know why you want to call a Function Library. As far as I know, Libraries are not meant to be called, rather it are meant to be attached to the test and the Functions inside the library are to be called. So you can attach the Function Library(.qfl file) to your test prior to test run.You can anyway call any function inside the library from your script. For attaching library files during run time you can try the following code: Quote:Set qApp = CreateObject("QuickTest.Application")Please let me know.. RE: How to call function lib at run time from an action - anilyad - 09-02-2010 Thanks for your response. I need it at runtime since when checked in Clearcase, other folks in the project get 'Missing Resource' when they access the Test/ACTION. Thus if it is at runtime, no missing resources. Also for the framework, there is a requirement not to add them through IDE but to call all components of framework at runtime. I have put msgbox and corrent path is shown from the ACTION (when not called from the function ) I will try your solution and respond again later. But if i make your code a function and call in ACTION, will i be able to? thanks-anil RE: How to call function lib at run time from an action - PrabhatN - 09-02-2010 Yes, you should be able to use these codes inside a function. RE: How to call function lib at run time from an action - supputuri - 09-02-2010 Hi, You can use the "ExecuteFile" method in order to load the library function dynamically while running the script. Code: ExecuteFile "..\..\..\LibraryFiles\MyLibrary.vbs" 'Enter your path here Let me know if you need any more information. RE: How to call function lib at run time from an action - anilyad - 09-03-2010 SUpputuri/Prabhat , thanks for the response but how can i call this in isolation. I need Environment.Value("TestDir") to get the current path and then use BuildPath to build the path. Remember its a framework and if i need to put all this in a function ( in a vbs file) , how will i call this from ACTION since the lib is not loaded yet. regards-anil |