Geeks Talk

Prepare for your Next Interview




User defined function in QTP library

This is a discussion on User defined function in QTP library within the QTP forums, part of the Software Testing category; How to put any user defined function in QTP library? Now this function should become inbuilt function and can be used anytime I use QTP. Is this possible? If yes ...


Go Back   Geeks Talk > Software Testing > QTP

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 01-09-2007
Expert Member
 
Join Date: Oct 2006
Posts: 690
Thanks: 0
Thanked 49 Times in 41 Posts
JobHelper is on a distinguished road
User defined function in QTP library

How to put any user defined function in QTP library? Now this function should become inbuilt function and can be used anytime I use QTP. Is this possible? If yes then how?

NOTE : [This question was asked by Renu]
Reply With Quote
The Following User Says Thank You to JobHelper For This Useful Post:
Sponsored Links
  #2 (permalink)  
Old 01-09-2007
Junior Member
 
Join Date: Apr 2006
Location: Bangalore
Posts: 7
Thanks: 1
Thanked 1 Time in 1 Post
prasanna.sabat is on a distinguished road
Re: User defined function in QTP library

Yes this possible..
You have to write the function in a note pad and save it in Test settings >resource tab as an attachment.
Then you can call the function in ur program.
You can write as many functions as u can in that note pad nas save.
Thanks
Prasanna
Reply With Quote
  #3 (permalink)  
Old 01-16-2007
Junior Member
 
Join Date: Jan 2007
Location: hyderabad
Posts: 3
Thanks: 0
Thanked 1 Time in 1 Post
ramugogurla is on a distinguished road
Thumbs up Re: User defined function in QTP library

Quote:
Originally Posted by JobHelper View Post
How to put any user defined function in QTP library? Now this function should become inbuilt function and can be used anytime I use QTP. Is this possible? If yes then how?

NOTE : [This question was asked by Renu]
hi friend this is ramu iam happy to answer u r question .first let me explain what is function the actions which are more repeatable for that we are defyining as in function and we are calling that functions very freequently whereever we want . the main advantage of function is code reasubility
to make use define function first of all make one script with function and run it in qtp to find logical errors and copy that script and paste it in notepad file with .vbs extention again come back to qtp and load that script using
executefile"filepath" u can load this file any where i hope u got the answer
if u have any query please consult me
Reply With Quote
The Following User Says Thank You to ramugogurla For This Useful Post:
  #4 (permalink)  
Old 06-23-2008
Junior Member
 
Join Date: Aug 2006
Location: Bangalore
Posts: 7
Thanks: 0
Thanked 1 Time in 1 Post
jitendramishra is on a distinguished road
Re: User defined function in QTP library

Hi Prasanna,
A very good thing you have mentioned in your above post.

But i don't think this is the reply to the post. The approach you said is "adding a user defined library function or functions to your script."
We can have a library file and we can use it at any time.

But now my concern is how can we make a permanent function like "MsgBox".
We can use it in any script, no need to attach any file.
are you getting me,..

I think there might be some approach for creating any ".dll" file and to register..
I hope people will come up with any idea for this post.

Let me know if i am wrong.

Thanks, Jitu
Reply With Quote
The Following User Says Thank You to jitendramishra For This Useful Post:
  #5 (permalink)  
Old 07-05-2008
Expert Member
 
Join Date: Nov 2006
Location: Hyd-IND
Posts: 520
Thanks: 1
Thanked 53 Times in 45 Posts
sutnarcha is on a distinguished road
Re: User defined function in QTP library

Hi All,

There is an alternate way to make available a user defined function for all tests (as a build-in function). This approach doesn’t require a function library to be associated to a test. We need not to work with .vbs files and execute or include them in our QTP script either. This is a good approach but could be risky.

We can copy our function definition (in VBScript) to common.txt file in Program Files\Mercury Interactive\QuickTest Professional\dat\BPT_Resources. We may even register this function to a windows or web object. Be careful not to change any other content from the text file. This is a text content, but it contains the definitions of the built-in functions for QTP. Don’t do it if you don’t know VBScript coz if you change any other content from the file knowingly or unknowingly, you should be able to correct the changes. It is better to keep a copy of the original file before you copy your function definition into the file… just in case.

After you copy your function definition, save and close the file. Close QTP and restart it again. Now, your user defined function should be available for all tests as a built-in function.
__________________
Lack of WILL POWER has caused more failure than
lack of INTELLIGENCE or ABILITY.

-sutnarcha-
Reply With Quote
  #6 (permalink)  
Old 09-23-2008
Contributing Member
 
Join Date: Jun 2008
Posts: 67
Thanks: 4
Thanked 0 Times in 0 Posts
learqtptesting is on a distinguished road
Re: User defined function in QTP library

prasanna.sabat ,

If I have a function "test" in a file which saved as myfunctiontest.vbs and loaded to test|Setting|Resource, How do I call the function?
Reply With Quote
Reply

  Geeks Talk > Software Testing > QTP


Thread Tools
Display Modes


Similar Threads

Thread Thread Starter Forum Replies Last Post
Pre-defined and post-defined value JobHelper Seibel 0 12-30-2006 04:51 PM
Rules for user defined words Bessie MainFrame 1 10-09-2006 04:04 PM
Why are Levels defined like this GregMark MainFrame 0 10-01-2006 05:33 PM
How do you Implement Class Library Object GeekAdmin VB.NET 0 05-28-2006 11:14 AM
Explain about .NET Framework Class Library GeekAdmin VB.NET 0 05-17-2006 11:47 PM


All times are GMT -4. The time now is 12:57 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Copyright © 2008 GeekInterview.com. All Rights Reserved