How do you call functions in QTP Project without adding test settings, resources(library functions).Is there any other way around?

Questions by ypraveen_77   answers by ypraveen_77

Showing Answers 1 - 12 of 12 Answers

Ravi

  • Feb 20th, 2007
 

Add your library path which has all your VBScript files or functions to
tools-->options-->folders

lib_path = PathFinder.Locate("filename.vbs")
Call executefile(lib_path)

Then u can call functions which are defined in the filename.vbs file. You need not to have this in Test-->Settings-->resources

Ex : Login(username,password)

Login is the function which is defined in the "filename.vbs"

Please correct me if iam wrong.

  Was this answer useful?  Yes

we can use functions without adding them to resources:

suppose there is function as follows in a file NameTesting.vbs

Public Function Testing(Name)

MsgBox "Your name is " &Name

End Function

we want to use the function Testing in an action1

Please Execute the vb script in the desired action "action1" and then use the function

ExecuteFile "Complete path for vb script NameTesting.vbs"

'Now you can use all the functions written in the vb script

Testing "Abhishek"

If you run the test then u should get a message box alert

Your name is Abhishek

I think this should be helpful

  Was this answer useful?  Yes

You can load function library at run time using following code..

Dim qtpApp
Dim funcLib

Set qtpApp = CreateObject("QuickTest.Application")
qtpApp.Launch
qtpApp.visible = True
qtpApp.Open "c:Test1",False,False
set funcLib = qtpApp.Test.Settings.Resources.Libraries

If funcLib.Find("c:func1.vbs") <> -1 then
 funcLib.Add "c:func1.vbs",1
End If

I thinks this will help....
 
-Aditya

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions