Script To Load Library Files into Test in QTP at RunTime

QTP Script to load library file at run time in particular test.

But before that just check this post where we loaded library file into test through Navigation

Open notepad and paste the following code

Function f1
msgbox "first function"
End Function

Function f2
msgbox "second function"
End Function

save notepad as fff.vbs in C drive.

We created library file,now we have to load this file into our test through script.

Syntax:ExecuteFile "path of file"

ExecuteFile "C:\fff.vbs"

The above statement loads library file into our test.

If u want to call function in the test just write function name.

f1
f2

1 comment:

Anonymous said...

FYI - Libraries Loaded as a resource can not access functions loaded via Execute File. Items created via the ExecuteFile function are in the scripts local scope vs items loaded in the Global Scope via the resources.

Another method could be to start the script from an external vbs file..

Set App = CreateObject("QuickTest.Application")
App.Test.Settings.Resources.Libraries.Add(LibraryDirectory&"globalvars.qfl")

Related Posts Plugin for WordPress, Blogger...

More Scripts