Header Ads

what is the difference between Action and Function

Action VS Function:

1)We can use actions within QTP where as we can use functions anywhere(i.e. in any programming language )

2)We can call functions within actions but we can't call actions within functions

3)Generally functions are saved with ".vbs" extention (if written in an external file)we execute those file or add in the test and call the function. where
as actions will save with ".mts".
4)Actions - can only accept primative data types as parameters (strings, integers, etc)

Functions - can accept anything depending on its parameter value and usage.
5)Resource Usage

Actions - For each action, there’s a folder, three separate vbs files, a local Object Repository, a subfolder containing snapshots, an Excel spreadsheet, and a few
seconds of load time.

Functions - There’s the code contained in the Function.


Actions - You cannot insert calls to Existing Actions through the QTP API, you can only do it through the interface

Functions - You can attach Function Libraries to Test Scripts through the QTP API
The popular use is to connect QTP with QC.
7.Return Values

Actions - Return values are difficult to understand and read in the syntax

Functions - Return values work like they do in other languages as I wrote earlier this depends on parameter value.
1). we enhasing the scripts(Check points, output values)insert in the action the actions allows but in the case of functions it doesn't allow the enhasing the scripts.

2) in the case of call copy action it won't reflect into the child action to parent action but functions it will reflect in to the child action to parent action.

4). Mainly very important use:
if at all call the Action the particular object information stored into the object repository but in the case of function when ever we call the function it doesn't stored into the object repository.
Powered by Blogger.