|difference between Action and Function|
Difference between Action and Function:
Action and Functions are two important aspect of UFT or QTP. Here are the difference between them.
This is also a popular UFT or QTP interview question.
1)We can use actions within QTP/UFT where as we can use functions anywhere(i.e. in any programming language ) very bad difference but somebody may prefer.
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.
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
Another API implementation- How to Call Reusable API Script From GUI Script in UFT
The popular use is to connect QTP with QC.
Actions – Return values are difficult to understand and read in the syntax.Mostly UFT/QTP can understand that.
Functions – Return values work like they do in other languages as I wrote earlier this depends on parameter value.
- 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.
- 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.
- 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.