What is the difference between functions and actions in
QTP?
Answers were Sorted based on User's Feedback
Answer / sreeprasad
Reusable Action is peice of code that perform an action on
the application , which has application logic.
On the other hand , Functions does not have the application
logic . It performs a specific action on the data retrieved
from the application and returns the result to the calling
action.
For Ex: Your application has TextBox and Button,
Input : In the textbox we need to enter a numeric value
say 5.
Action : Calculate the Factorial
Expected : Factorial value should be displayed in the
textbox.
Here setting a value to textbox , performing the click
operation and corresponding verification is maintained in
the Action , calculation of the factorial value to arrive
at the expected output we use a Function.
| Is This Answer Correct ? | 7 Yes | 2 No |
Answer / buvan
Action can contain Object Repositary, Data Table and Active
Screen etc....
Function doesn't have these features
Action is Internal to QTP
Function is Just Lines of code.
Action Can/Can't be Resuable
Functions are always Resuable
Action Paramenter have default values
Function don't have any default value
Action parameter type are ByValue
Functions can be passed ByRef
Action can have multiple returning values
Function can return only single value
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / deven
♦It returns single value.
♦ we can call functions within actions but we can't call
actions within functions
♦ Generally functions are saved with ".vbs" extension
whereas actions will save with ".mts".
♦ Every Action will have its own Datatable whereas function
does not.
♦ Action can have a object repository associated with it
while a function can't. A function is just lines of code
with
some/none parameters and a single return value while an
action can have more than one output parameters.
♦ Action can contain Object Repository, Data table, Active
screen etc. whereas function do not have these features.
♦ Action is internal to QTP whereas Function is just lines
of code with some/none parameters and a single return value.
♦ Action can/cannot be resuable whereas functions are
always reusable.
♦ Action Parameter have default values whereas VB script
functions do not have any default values.
♦ Action parameter type are byvalue only where vbscript
functions can be passed byref.
♦ Action can have multiple output(returning) values whereas
function can return only single value.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / uday kumar_anem
Both Actions and Functions are used to access a peace of
code, that is frequetly used.
The main difference is :
Functions have only application logic, means that we dont
have access to the resources of a test.
For ex: we need to write a script to access Object
Repository, Data Table etc....
Actions also have application logic and the resources
associated with that action.
For Ex:
Say if you want to call a function, here you need to pass
function name and all other resources like(OR, Data Table
etc...).
Where as if you call an action, all these resources come
with action(based on the type of the action).
| Is This Answer Correct ? | 4 Yes | 4 No |
Answer / bhanu prakash
1. Actions can take any no of inputs and it gives any no of
output also, but functions can take any no of inputs but it
will gives only one out put
2.
| Is This Answer Correct ? | 5 Yes | 5 No |
Answer / ram balamuri
Action is internal to QTP whereas functions are generic and
are coded in VBscript. The main difference between an
action and a function is that "an actions contains an
Object repository." An action can also be shared; it can
also use different shared reposiroties. A function on the
other hand doesn't have an object repository and is just
merely a code that returns some desired value(s).
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / mohammed
The Main differeence between Action And Function
1
1)Action is having it's own Objecr repositary ,datasheet in
datatable and also in results window action is having it's
own node.
2)Action execuetes it self.
3)Action is slow in execution.
1)Function is not having his own OR and datasheet in
datatable.
2)Function executes from action only.
3)Functions are faster in execution.
Kindly let me know any Mistakes.
Thank you.
| Is This Answer Correct ? | 0 Yes | 2 No |
What is the current version of QTP and now it is the product of Mercury or HP
What is API
Discuss QTP Environment.
Hi I have created a table in the MS access database. I want to access the table in this database through QTP. The code is given below. The code is not working.The following error is displayed "Data source name not found and no default driver specified". Any one can correct the code. Thanks in advance. Dim dbconnection, rs Dim ca, sname Set dbconnection = createobject("ADODB.Connection") Set rs = createobject("ADODB.Recordset") dbconnection.open "DSN = MS Access Database","", "" rs.open "select * from Research", dbconnection rs.movefirst If rs.EOF <> True AND rs.BOF<> True then ca = rs("order_number") sname = rs("customer_number") rs.movenext msgbox ca msgbox sname End If
what are the limitations of automation testing?
How we can merge the object repositories?say if we have 2 or 3 object repositories then how we can merge them?Is there any option in QTP to merge the object repositories?
Hi All, I am new to QTP but i was trained on winrunner before. My problem is..QTP 8.2 was unable to record my application which is a java app. By selecting smart identification, i was somehow able to record the test BUT QTP cant run the test! Can anyone help me in walking through this problem..Is java addin really necessary for this?? Is there anyways i can run the test successfully? I am not sure whats going wrong in my testing.Please do help me asap as i need to submit the report early. Thanks in advance
what are inputs for automation?
How to test results for qtp ?
Hi all, i have installed QTP8.2 in my system. but script is not generating while recording. What is the problem? is any file missing? pls let me know anybody...Thnaks
my assignment is,how can i differentiate between readed & unreaded mails in my inbox ?, since for both readed & unreaded having same properties for both test objects &run time objects
I open login gmail page after that QTP is not able to identify the object present in it then what u will do