What is the difference between functions and actions in

QTP?

Answers were Sorted based on User's Feedback



What is the difference between functions and actions in QTP?..

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

What is the difference between functions and actions in QTP?..

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

What is the difference between functions and actions in QTP?..

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

What is the difference between functions and actions in QTP?..

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

What is the difference between functions and actions in QTP?..

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

What is the difference between functions and actions in QTP?..

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

What is the difference between functions and actions in QTP?..

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

Post New Answer

More QTP Interview Questions

I have the script like this: Browser("Philips Web Login").Page("Philips CL DMS2 Application").Frame("ScopeFrame").Link("DC3701737 (Active)").Click in which the value "DC3701737" will get changed and i have to use the same value in so many places. If i want to get that value "DC3701737" in to a variable, how? pls let me know if you didn't get the question. Help me out in this.

2 Answers  


for example u can take ebay or plifcart online shoping web application--------- write acode in vbscript in qtp---- search box and write (iphone6)and click on go button then opened diff prise iphones in next page but u can select 30,000 to 90,000 list pls write code? 

2 Answers   FFASVA, Genpact, Wipro,


Can any body help me to write descriptive program to find a cell value (say 2 row, 3rd column) in a datatable which is creating dynamically and statically

0 Answers  


How to check feasibility of the appliction?in automation testing?

0 Answers   CTS,


What do you mean by iteration?

0 Answers  


Hi Friends, How to trap an error message on Web page through QTP. Example:- When I put wrong user id or Password on a web page, I get the error message. So when I add the error object in Reposatory, every time it shows as Login Failed Object exist, eventhough using corret login details. And if I do the same without adding the object it shows as object not found. This might be because while recording QTP takes every new page as _1 _2 _3 and so on. as below. Browser("XXXXX").Page("XXXXX_1"). >>login Browser("XXXXX").Page("XXXXX_2"). >>Inbox Browser("XXXXX").Page("XXXXX_3"). >>Sent Items I used below code. Browser("XXXXX").Page("XXXXX").WebEdit("firstname").Set strFN Browser("XXXXX").Page("XXXXX").WebEdit("lastname").Set strLN Browser("XXXXX").Page("XXXXX").WebEdit("userid").Set strUserID Browser("XXXXX").Page("XXXXX").WebEdit("password").Set strPass Browser("XXXXX").Page("XXXXX").WebButton("Login >").Click If Browser("XXXXX").Page("XXXXX_2").Image ("msg_icon_error").Exist 5 Then Reporter.ReportEvent micFail, "XXXXX", "Login Failed!" ExitRun (It shows login failed ever after login is passed. Else Reporter.ReportEvent micPass, "XXXXX", "Login Successful!" End If Please find out a way for me here, and provide me with the correct code. Thanks in Advance.

1 Answers  


I have below user Defained function function AddTwo(ByVal a, ByVal b) Dim Ans Ans=a+b MsgBox Ans End function Now my question comes here...from given below methods which method is right to call above function?Which is Wrong and why? 1. AddTwo(2,4) 2. Call AddTwo(2,4) 3. AddTwo 2,4 4. Call AddTwo 2,4

1 Answers  


1.what is the difference between childobjects and child items in qtp? 2.what is difference between a class and function? 3.can u convert ustimings to indian timings using vbscript? 4.i have scripts in one machine.can i run those scripts in another machine.how?

2 Answers   Genpact, Infosys, Symantic Space, TCS,


PLS REAL TIMERS WRITE THE ANS FOR THIS? WHICH SCRIPT IS USED IN REAL TIME NOW A DAYS 1)SHARED REPOSITORY BASED SCRIPT 2)DESCRIPTIVE PROGRAMMING BASED SCRIPT?

1 Answers  


HOW TO COUNT NUMBER OF ITEMS PRESENT IN WEB LIST

8 Answers  


can u explain about QTP Frameworks? what are the framework types are available? and How to set or create frame work for a application? Explain briefly?(Also give me one example)

1 Answers  


Plz explain about Virtual object? What is the situation u r using , explain with example?

1 Answers  


Categories