Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Answers were Sorted based on User's Feedback



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

Answer / chandu

u can create user defined functions by saving the file
as .vbs..just open notepad and write as below and save the
file with the ext .vbs

public function test
x=6
For i= 1 to x-1
x=i*x
Next
msgbox x
end function
then in QTP goto
File>settings>resources tab..add the .vbs file u created..
and then write call test.....in ur editor.

thanks
chandu

Is This Answer Correct ?    18 Yes 1 No

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

Answer / 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

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

Answer / nina

U can use " Function Definition Generator " to create a new
user defined functions

Is This Answer Correct ?    5 Yes 2 No

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

Answer / manjunathareddy

User Defined functions nothing but A function which is not
related to project.

(Note :- Bulit in functions are Function which are Available
in QTP Library EX:- Len,StrComp etc,etc)

Example :- i will take zip folder function expample as user
defined function.

Function Zipfolder(oSource,oDestination)
On Error Resume Next
Err.CLear
Set Fso=CreateObject("Scripting.FileSystemObject")
Set oFile=Fso.OpenTextFile(oDestination,2,True)
oFile.Write "PK" &Chr(5)&Chr(6)&string(18,Chr(0))
oFile.Close
Set oShell=CreateObject("Shell.Application")
oShell.NameSpace(oDestination).CopyHere
oShell.NameSpace(oSource).Items
Do until
oShell.NameSpace(oDestination).Items.Count=oShell.NameSpace(oSource).Items.Count
WScript.Sleep 100
Loop
End Function

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More QTP Interview Questions

How to add Dynamic Objects to Object repository?

5 Answers  


What is Descriptive Programing? In which cases, we will go for descriptive programing?

2 Answers   CTS,


WHO TAKE DECISION TO RELEASE THE BUILD

2 Answers   IGT,


What is the Dynamic Scenario in QTP? And also anybody give the example for this?

3 Answers  


WHAT IS THE FUNCTION (HOW TO DO) THE BATCH TESTING IN TEST DIRECTOR USING MANUAL TESTING PROCEDURE?

1 Answers   CTS,


how can we test load time of an page in webtesting?

3 Answers   Ordain Solutions,


What is the need and applications of learning VB script for a automation(QTP) engineer ain Realtime ?

2 Answers  


Hi Guys, I am very new to QTP tool , In real time environment how to test the application with this tool, 1. How to load application in QTP tool 2. How to write test script in QTP. 3. In manual testing we test login box (user id , password) how can we test this kind of testing with QTP tool with examples . Please guys put some focus on my questions , real time ecperienced answers would be appreciate, advance thanks ,please guys i am expecting ur answers as soon as posible

1 Answers   IBM, INCA,


what is the difference between QTP 8.0 & 9.0?

4 Answers  


Hi can anyone pls suggest how to fetch username(system login name)and system name in to qtp.I am not using TD or QC.Thx

5 Answers  


Can we check environment variable value without existing of environment variable

2 Answers   NIIT,


What is the regular expression for Yahoo mail Inbox?

2 Answers  


Categories