GeekInterview.com
Series: Subject: Topic:
Question: 85 of 785

QTP User Defined Functions

How to write and where we call user defined functions in QTP? Give an example.
Asked by: sirin321 | Member Since Sep-2008 | Asked on: Sep 4th, 2008

View all questions by sirin321

Showing Answers 1 - 4 of 4 Answers
govindraj

Answered On : Sep 7th, 2008

View all answers by govindraj

We can write user define functions in QTP Editor or in notepad also. when we write funtions in notepad we have to save file with .vbs extention. and close notepad then we can use that file in qtp resources. in resources we give notepad file path. than we can use funtion directly by functions name....

Yes  1 User has rated as useful.
  
Login to rate this answer.

Using QuickTest, you can define and store your user-defined functions either in a function library (saved as a .qfl file, by default) or directly in an action within a test. A function library is a Visual Basic script containing VBscript functions, subroutines, modules, and so forth. You can also use QuickTest to modify and debug any existing function libraries (such as .vbs or .txt files). 

When you store a function in a function library and associate the function library with a test, the test can call the public functions in that function library.  Functions that are stored in an associated function library can be accessed from the Step Generator (for tests and function libraries) and the Operation column in the Keyword View, as well as being entered manually in the Expert View.

When you store a function in a test action, it can be called only from within that action—the function cannot be called from any other action or test. This is useful if you do not want the function to be available outside of a specific action.

You can also define private functions and store them in a function library. Private functions are functions that can be called only by other functions within the same function library. This is useful if you to reuse segments of code in your public functions.

Yes  3 Users have rated as useful.
  
Login to rate this answer.
subhan0103

Answered On : Jun 1st, 2011

View all answers by subhan0103

user defined functions are the functions defined/designed by the user for re-usability. to create a UDF first write the function in qtp(to avoid syntax mistakes) then copy , past the same in Note Pad and save the file with .vbs extension. Now to associate it in qtp, go to-file-settings-resources-click on + button and browse the .vbs file-click apply-click "ok".

  
Login to rate this answer.
chenna

Answered On : Sep 8th, 2011

function name of the function
list of the statements
.
.
.
.
end function

  
Login to rate this answer.

Give your answer:

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

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.