Give me Example for Generic Functions in QTP
Framework....Anybody please answer me..Thanks in Advance

Answer Posted / vijay chourasiya

Generic Function:
Generic function means the conman functionality in the application.Example
button, Edit box, Combo box and Radio button,Dropdown,Click on link,Login,Logout,Verifypage.
So if you want to create the generic function/Reusable function in the application only change the object not the logic in the function.
For Example:
In framework you have Button so you have to create:
Function buttonclick(obutton)
sobjname = obutton.tostring
sstepname = "Buttonclick"
bexists = obutton.Exist(0)

If bexists Then
smsg = sobjname&" Exists"
reporter.ReportEvent micPass,sstepname,smsg
else
smsg = sobjname&" does not Exists"
reporter.ReportEvent micFail,sstepname,smsg
Exittest
End If

bdisabled = obutton.getroproperty("disabled")
If bdisabled = 0 Then
smsg = sobjname&" is enabled"
reporter.ReportEvent micPass,sstepname,smsg
else
smsg = sobjname&" is disabled"
reporter.ReportEvent micFail,sstepname,smsg
Exittest
End If

smsg = "clicking on "&sobjname
reporter.ReportEvent micPass,sstepname,smsg
obutton.click
End Function
* so here you have to change only (obutton) in the repository or from Util file.
#===================================================================
Project specific functions:
Project specific function is related to the only your project prospective.Example:
login page loading so you will not use wait because you don't know the loading time.
so for this you have to create DynamicLoad Function.and this function also resusable
2)Example:The framework contains input from the XML so you have to create project specific function
3) Example: Suppose you want to manipulate the scripts as per the requirement then you have to create Project specific functions and its control by Driver Script.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I need Major Help with a Script I recorded in QTP 9.5. I am recording scripts for a Web-based application(s) I have all the URLs for each application in Excel spreadhsheet so that QTP can pull that particular application from the spreadsheet and run it. The problem is QTP isn't recognizing one particular URL so when I hit run in QTP to run this script it opens the internet Explorer but isn't open the URL I have in the Excel spreadsheet. I've retyped the URL and still QTP won't open this Particular one for some reason. The site its self is working fine but for whatever reason QTP won't open it. How do I resolve this? I have a deadline of next Friday the 7th to complete this task so please help me in any way you can. Thanks in advance

1715


why text area checkpoints cannot used for web applications

1883


What is Curd testing?

1884


how do u manipulating INI, DLL and / or registry files in support of your test environment? actually what do u mean by INI and DLL or registry files. plzzz its urgent do answer

1449


What are the different types of functions available in qtp and explain ?

570






How to release all resources file from the QTP?

1055


hi guys, pls tell me for testing institution training hub, hitech city is best or not?

1321


Hi Friends, Would be great if you can provide the Model Question paper, Web site link or any reference s. Thanks & Regards, Byzoor,

1348


Can we Test Welcome Screens and Process Images with QTP

1429


How to record application running on the Virtual machine?

644


How you calling actions in qtp?

630


what is clean sweep?

1887


Does QTP run in any environment?

614


how to do the batch testing in test director using manual testing procedure?

1778


In Test Directory, What are the contents in test case designing? if you prepare in excel sheet how u use thrw Test Directory?

1510