Micro Focus QTP (UFT) Forums
Calling a function in a Test Script from a function library - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Calling a function in a Test Script from a function library (/Thread-Calling-a-function-in-a-Test-Script-from-a-function-library)



Calling a function in a Test Script from a function library - anupam4j - 03-25-2014

Hi,

I have a function library that calls a function which is defined in a Test Script.

But its not working. Its giving an error message that the function was not found.
Can a function be called this way?


Thanks,
Anupam


RE: Calling a function in a Test Script from a function library - Ankur - 03-25-2014

Instead of attaching the function library, you should dynamically load the library using ExecuteFile statement or LoadFunctionLibrary statement AFTER your function call in the given script.

Benefit with the latter being you will be able to debug your library.


RE: Calling a function in a Test Script from a function library - inderjeetqtp - 06-16-2015

Hi ,

I have created a a gmail login function and saved in function library of qtp.
Code:
gmaillogin (sUserName,sPassword)

How to call this in test..Please tell me the code..i am new to qtp..
i am calling like :
"
Code:
sUserName = "email id"
sPassword ="xxxx"
Function gmaillogin (sUserName,sPassword)

"
Please let know the code is right or not


RE: Calling a function in a Test Script from a function library - babu123 - 06-26-2015

in Function library function

Code:
public fuction gmaillogin(username,password)
.................
.....................
End function
associate the function to script and use below line to call the function

Code:
sUserName = "email id"
sPassword ="xxxx"
Call gmaillogin(sUserName,sPassword)