Function library, What is the extension, live real world examples for a function library in QTP



Function library, What is the extension, live real world examples for a function library in QTP
What is the extension for a function library ?
The extension of Function Library is '.QFL'
  • Function Library have following types: function.txt, function.qfl, function.VBS.
  • All mentioned above can be treated as the function library of QTP.
    By default QTP functions library is .qfl file, but we may save it in any of the above mentioned three format.
    All should depends on the type of function developed into it.

Function Libraries in QTP:-
Simply when you required some steps or code are going to repeat every time then you required to create user defined function. Such type of user defined functions will help you to make your test shorer and easier to maintained, It will also become easy to design and read. Then a user defined functiion can be called from any other functions or actions.


Advantages of Function Library:
  1. User defined functions are time saver and reusable. We can save our time and resources with the help of these functions libraries.
  2. User defined function can be saved in the function library or with in an action in the testing scenarios.
  3. These type of functions can be registered as the functions for any QTP testing object.
Function in an associated functions libraries are accessible -:
a. From Step Generator (For test and Functions library)
b. From the Operation column in the keyword View
  1. IT can be manually entered in Expert View


Live Real life Example of Function libraries:
1. Open some new tests. Go to File → New → Test.
2. Open new function library. Go to File → New → Function library.
(Now both new tests and functions libraries are open at the same time and you are in function library now.)
3. Now Go to Insert → Function Definition Generator.
4. Now inside the Function Definition Generator window, input the name of the function like my_sumfunc.
5. In the Argument area clicks on ‘+’ and input the name of first arguments as ‘varc1’ and then again clicks on ‘+’ and input the name of second or next argument as ‘varchar2’ and let the Pass Mode be the default which is the ‘By Value’.
6. In Additional Information area, enter the Descriptions as ‘addition function’. Let the ‘Documentation’ become empty. Click on Ok and let close that Function Definition Generator window.
7. Now it will submit the function to our already open Library.
8. Now we required to write the functions body (where it says TODO so on:)
9. At Last it will looks like following.
'@Description addition function
Public Function my_sumfunc(var11, var22)
sum = var11 + var22
msgbox sum
End Function
10. Now finally Save it. (Save it by assigning any appropriate name and extension either .qfl (it will by default) or .vbs or .txt)
11. Associate to it. (File → Associate Library with Tests)
12. In expert view of Associated test type:
my_sumfunc 2, 3
Function library
Function library

live real world examples for a function library in QTP
live real world examples for a function library in QTP






Advantages and Disadvantages of Automation Testing













Virtual Objects with Example in QTP
Cross Platform Testing


What is Object Spy in QTP Ordinal Identifiers Alone can Make an Object Unique



Test Automation Frameworks Types



No comments:

Post a Comment

Popular Posts