How to add function library at runtime in UFT

Function library is the backbone of any test automation framework. It is designed to handle all the inputs, outputs, exceptions and what not. 

In UFT, there are mainly two types of function libraries supported. 

  1. In built function library in UFT- This written with extension .qfl file
  2. VBScript function library- This is written with extension .vbs

Unlike object repository, both of these library types can be added as an external dependency file into UFT.

This can be achieved either through settings window of UFT by providing location of the file or at runtime through code.

In order to add the function library at runtime, first you need to create an object of Settings

Set qtLibraries = qtApp.Test.Settings.Resources.Libraries

Now you can add function library to this object by using add method of this object like below:

qtLibraries.Add "D:\libraary.vbs", 1 

Please find below the complete example code snippet on how to add function library at runtime in UFT.

How to add function library at runtime in UFT- Code Snippet

Must Read
Subscribe for updates