how to create user defined functions in QTP? can any one
expalin me with example..
Thanks in Advance for help

Answer Posted / prashanth chenna

Creating User defined Functions:
Open QTP and Application --> type function header along
with Unique function name and arguments --> Record
repatable operations in application as function body -->
follow above navigation to create more then one functions --
> Save that functions in a file using 3rd party s/w with
Extension .vbs( Copy the script, genarated in QTP and paste
in Notepad, MS.Word etc.) --> now goto Resource menu in
QTP --> object Repository --> file menu --> Export Local
Objects --> Enter file name with Extension .tsr --> click
Save.

Calling User defined Functions:
In QTP --> type Useer defined function name along with
argument values --> file menu --> settings --> Resources
tab --> click + icon -->browse the path of the file -->
click apply --> click OK --> Resources menu in QTP -->
Associate Repositories --> Click + icon --> browse the path
of references file --> select current action --> click OK.


Example:( Creating User defined Function )
Public function login(x,y)
Dialog ("Login").winedit("User name").set x
Dialog ("Login").winedit("Password").setsecure
crypt.encrypt (y)
dialog ("Login").winbutton("OK").Click
End Function

( Calling User defined Function in a test )
login "prashanth","testing"

Is This Answer Correct ?    15 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When I click on a link in web page.Link should open in new window.can anyone please let me know the script for this ---Koti

2481


What is the use of ordinal identifier in qtp?

601


what are the challenges you have faced while testing web based application using the automation tools ?

587


Discuss quicktest professional (qtp) environment?

570


Hi any body pls help me for QTP 11.0 software free demo version. i have to practice. Kindly send the link.or where i have to download.

1613






What is the extension of the qtp local repository? If it is .mtr then what is .bdb extension stands for?

561


Can the user toggle between using Local OR and shared OR for the same action?

551


what is the difference between development and testing

2356


Where to use function or action?

664


Which advantages helping QTP to hold the position of "Market Leader" for such a long period?

1374


What is quick test pro?

583


How to explain a banking project in interview as a test engineer???

2589


Will there be any standards or requirements for page appearance and/or graphics throughout a site or parts of a site?

596


How to upload excel files into Quality Center using QTP Script and how to delete excel files from Quality?

606


How to use setroproperty?

564