How to add my own function in QTP.when I run my function in QTP then its throw an error "Error in library file. Your function library may not be valid.Do you want to continue running the test?"Now how to add library file & which file. DO u have any example of function how to write in QTP

Showing Answers 1 - 3 of 3 Answers

Guest

  • Feb 16th, 2006
 

For Ex:Create a VBS file and save the below mentioned statement as example.vbs.

msgbox "Hi,Im execueted from VBS library"

Open QTP>>New >>type

msgbox "Hi,Im execueted from QTP"

Open QTP>>test>>Settings>>Resources>>Try to click "+" button and add the example.vbs

now when u execute,the text -

"Hi,Im execueted from QTP"

"Hi,Im execueted from VBS"

are displayed.

  Was this answer useful?  Yes

varija

  • Feb 21st, 2006
 

First create a VB script file say "test.vbs" with the below function and save it on your desktop:

  function myfunc()
        msgbox "I am executing from vbscript"
  end function 

Open QTP application and the first statement of the script should be

ExecuteFile("C:\Documents and Settings\Administrator\Desktop\test.vbs") 'this statement loads the functions, sub-routines contained in your VBscript file

msgbox("I am executing from QTP")

Call myfunc() 'call your own function here

Save the script and click on run icon.

The output will be:

I am executing from QTP

I am executing from vbscript

Let me know if this helps you.

- Varija.

govindraj

  • Sep 11th, 2008
 

Whatever function you write in vbs file , it might be possible some keyword are wrong or wrong property may be used.

  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