Loading function libraries at runtime was introduced in QTP-11. This feature enables loading of libraries when step runs instead of at the beginning of Run session.
This is helpful incase you need only particular set of function libraries based on the environment of AUT.
For example:- we are doing localization testing of our AUT, so instead of associating all the function libraries to the test, we’ll use only required set of libraries based on localization of AUT and that will be added at the run time.
This is helpful incase you need only particular set of function libraries based on the environment of AUT.
For example:- we are doing localization testing of our AUT, so instead of associating all the function libraries to the test, we’ll use only required set of libraries based on localization of AUT and that will be added at the run time.
Syntax:-
LoadFunctionLibrary (Path of the function library)
Example:-
‘Loading function libaries based on the localization of AUT
Dim sLocal
‘Tkaing value of AUT Enviornment from Datatable or external database
sLocal= DataTable(“Enviornment_AUT”,1)
‘Based on the enviornment concerned library will be laoded at runtime
If sLocal=“Dutch” Then
LoadFunctionLibrary(“C:FunctionsDutch.qfl”)
Else
LoadFunctionLibrary(“C:FunctionsEnglish.qfl”)
End If
Important:-
- As we are adding this at Runtime, so it wont be visible in Resources,Missing Resources,To do panes
- Performance of UFT can be affected as Function libraries are getting loaded at Runtime
- At the end of Run, all the dynamically loaded libraries are unloaded.
- Incase function Name is same inthe associated and dynmically loaded libray than Dynamically loaded function will be given preference
- Another way of loading libraries at runtime is using “ExecuteFile” statement in vbscript.
- ExecuteFile “C:Functions.vbs” (Now all the functions inside this file are available for usage in the script)
2 replies on “How we can load function libraries at Runtime in UFT?”
What's the reason of giving preference to the dynamically loaded function library?
Hi,
I have a question, if there are two function librarys with two different extensions like 1) FL1.qfl 2) FL_2.vbs how can i load these two FL's in runtime can anyone explain.