ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Testing  >>  Automation Testing  >>  QTP
 
 


 

 
 WinRunner interview questions  WinRunner Interview Questions
 Load Runner interview questions  Load Runner Interview Questions
 QTP interview questions  QTP Interview Questions
 Test Director interview questions  Test Director Interview Questions
 Rational TestSuite interview questions  Rational TestSuite Interview Questions
 Silk Test interview questions  Silk Test Interview Questions
 Automation Testing AllOther interview questions  Automation Testing AllOther Interview Questions
Question
how to create user defined functions in QTP? can any one 
expalin me with example..
Thanks in Advance for help
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: how to create user defined functions in QTP? can any one expalin me with example.. Thanks in Advance for help
Answer
# 1
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 ?    4 Yes 0 No
Chandu
 
  Re: how to create user defined functions in QTP? can any one expalin me with example.. Thanks in Advance for help
Answer
# 2
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 ?    4 Yes 0 No
Prashanth Chenna
 
 
 
  Re: how to create user defined functions in QTP? can any one expalin me with example.. Thanks in Advance for help
Answer
# 3
U can use " Function Definition Generator " to create a new
user defined functions
 
Is This Answer Correct ?    1 Yes 0 No
Nina
 

 
 
 
Other QTP Interview Questions
 
  Question Asked @ Answers
 
How u do the back end testing in QTP? SunGard2
what is smart identification?  1
While scripting do we use any reference. may be we have 2 0r more same objects that time how do we write scripts  2
what is descriptive.create()in qtp? IBM2
I have java based application on my computer. Can I install QTP on it? What are system requirements for installing QTP?  3
Can we set a timeout for the msgbox.I want the msgbox to disappear after 2 seconds during the script execution without clicking on the OK button manually.  4
Is there anyway to have QTP go into a website and map out every object before I actually record any tests? I basically want to map out a website with all the objects and build a complete repository. The reason is because I'm running into issues with hierarcical objects. for example: Browser("ABC company- Home").Page("ABC company - Home").Link ("About Us").Click Browser("ABC company - Page 2").Page("ABC company - Page 2").Link("About Us").Click Both these links ("objects" and I use that term loosely as I'm trained mostly in OO programming) go to the same place but but the object heirarchies (pages) are different. I want a repository that will find any possible link on any possible page without having to manually record it. Is there a way to do this?  1
Hi friend I have query regarding QTP datatable. I want to insert data in datatable during runtime. suppose i wrote datatble.value(1) = "Test data" so when i run the script it says column(1) doesn't exist. Then i write something in column A1 manualy and run the script again. Now it works fine. Pls clarify how i can put value in blank cell of datatable. Apex8
Hi, Can anyone help me in esimating time for an application using QTP tool.. What factors should be considered while calculating the estimation time for QTP... Thanks in advance... Prasad Gali  2
pls tell me different type of automation frame works in QTP and which one need to select in client server application Syntel6
hai friends i'm learning qtp now where we r using only record &playback frame work.and people r saying in realtime they won't use this frame work. if so what frame work actually using in realtime .and could you give explanation comaparing the record &play back fm and what ever FWyou r using in your organization. hoping cool response. thanx in advance  2
Hi All Below is my script which i made for lgin into Flight.exe. SystemUtil.Run "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\","open" Dialog("Login").WinEdit("Agent Name:").Set DataTable ("p_Text", dtGlobalSheet) Dialog("Login").WinEdit("Agent Name:").Type micTab Dialog("Login").WinEdit("Password:").SetSecure DataTable ("p_Text1", dtGlobalSheet) Dialog("Login").WinButton("OK").Click If Dialog("Login").Dialog("Flight Reservations").WinButton ("OK").exist Then Dialog("Login").Dialog("Flight Reservations").WinButton ("OK").Click datatable.Value(3)= "Incorrect password. Please try again" Dialog("Login").WinButton("CANCEL").Click elseif Dialog("Login").Dialog("Flight Reservations").WinButton("OK").exist Then Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click datatable.Value(3)="Please enter agent name" Dialog ("Login").WinButton("CANCEL").Click elseif Dialog("Login").Dialog("Flight Reservations").WinButton("OK").exist then Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click datatable.Value(3)= "Please enter password" Dialog("Login").WinButton ("CANCEL").Click else Window("Flight Reservation").Move 309,146 datatable.ExportSheet "C:\Raj\Result.xls" ,1 Window("Flight Reservation").Close End If I want to capture the Message string from Dialog("Login").Dialog("Flight Reservations" Also pls let me know if this is the right way to do the script for login. Pls provide some script for login Flight.exe Thanks in advance Raj Dhiman  1
i have data in excel sheet.i imported the data in data table.while doing parameterization,how the code knows it is a valid or invalid data? Fiserv2
Discuss QTP Environment.  1
How to connect to oracle(sqlserver) database to QTP CTS3
in qtp wha t is synchronisatin pt,what is the maximam time out  3
Hi. plz expalin abouit SetToProperty, SetRoProperty, GetToProperty, GetRoProperty,GetToPrperties. with examples.  3
what is L-trim function will do?  1
1. IS A VIRTUAL OBJECT USED WHEN THE LABEL IS NOT RECOGNIZED BY QTP Ordain-Solutions6
How exactly you start scripting in QTP? In the interview he was not satisfied with my answer.Please post what is correct answer.  2
 
For more QTP Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com