We can use Function libraries to write all our
functions and then we can associate these function libraries and use in the
test, below is the example to create a VBS (Function library) and call it in
test.
There are 2 ways we can associate Function library in
any test.
1. By
Code using Executefile function
2. By
adding library in function.
Step 1
File -> New -> Function library
Step 2
Add a function a below to return some value as
showing the input 2 times.
Public function funadd(str)
str=str+str
funadd=str
End Function
Save the function library with extension .VBS.
Step 3
3.1 Now we can call Executefile as below
executefile ("C:\QTP Test Class\Manu\misc\callfun.vbs")
x=funReturnDoubleInputValue("Manu")
msgbox x
3.2
There is an alternate
also, we can add using Home -> Settings -> Resources-> Associate
function library.