I have associated the function library with my test and I'm able to call other functions from the action. Also, when I tried calling the function using getref within the function library, it worked fine. Your own function libraries in Micro Focus UFT can contain VBScript functions, subroutines, modules etc.
You need to follow 3 simple steps to use a function from a library in your test. Step 1) To create a new function library in HP QTP. Select File New Function Library. It opens as a new tab in QTP. In QTP, you have two different types of procedures Sub Procedures and Functions. Both of them work the same way expect for some minor differences. Both of them work the same way expect for some minor differences. Using QTP Automation Object Model, you can write a code which would open a QTP test and associate a function library to that test.
Example: Using the below code, you can open QTP, then open any test case and associate a required function library to that test case. To do so, copy paste the below code in a notepad and save it with a. vbs In order to modularize the script, library files are added to the QTP Script. It contains variable declaration, Functions, Classes etc.
They enable reusability that can be shared across test scripts. They are saved with an extenstion. vbs or. qfl A new Library file can be created by navigating to Your function library may not be valid. Do you want to continue running the test? " Now how to add library file& which file. DO u have any example of function how to write in QTP Interview Candidate Jan 27, 2008 Advantages of Function Library (functions) 1.
Time and resources can be saved by implementing and using userdefined reusable functions. 2. Userdefined functions can be stored in a function library or within an action in the test. 3. Userdefined functions can be registered as a method for a QTP test object.
Answer vikrant. There is one more to add function liabraryright click on scriptselect associate function library option It will associate script with function liabrary Feb 03, 2011 Yes but in my case I want to have QTP recorded operation in the function Login.
So I guess the function library needs to then know about the Object Repository. The Test Case would just call a function called Login in the function library and the Login screen operation would occur.