How to Associate Function Library in QTP

Well - we can associate function library to QTP Test either manually or by automation code.


  • Manually with Test Settings - In this method you have to go to Test Settings->Resources and add any library file. library File can have 3 extentions - .vbs, .qfl or .txt
  • By Automation Code, You have to use below code.

    Set App = CreateObject("QuickTest.Application")
    If App.Launched Then ' If QuickTest is  open
            App.Quit
    End If
    App.Launch
    App.Visible = True
    App.Open Testpath
   
    Set qtplib = App.Test.Settings.Resources.Libraries
   
    qtplib.RemoveAll   
    qtplib.add "c:\lib1.vbs"
    App.Test.Save


This code will associate lib1.vbs file with test viz. Testpath