Associating library files in UFT

We can associate library files with UFT test in 2 ways.
  • Through test testings dialog
  • by using code
Below code shows how to associate a library file with UFT test. We can add VBS library files to the UFT test as shown in below code.
 
Set objQTP = CreateObject(“QuickTest.Application”)
objQTP.Launch
objQTP.Visible = True
objQTP.Open “MyTest”, False, False
Set objLib = objQTP.Test.Settings.Resources.Libraries
If objLib.Find(“libraryfile1.vbs”) = -1 Then
objLib.Add “libraryfile1.vbs”, 1
End

If you want to add library file at run time, you can use below line of code.
 
LoadFunctionLibrary “xyz.vbs”
LoadFunctionLibrary “f1.vbs”, “f2.qfl”, “f3.txt”    

Complex problems, Simple Solutions