Wednesday, April 28

QTP Actions VS Functions

 There has been debate over on whether to use QTP actions or Functions. Before presenting my opinion, let me present what they are and how they stand out.



QTP actions
- Are of three types Non reusable, reusable and external.
- Each action has local respositary associated with it
- Each action has local datasheet attached with it
- Each action call has to be inserted and cannot be dynamically called. There is concept of having relative path with QTP components, but it hardly works consistently with QC ( Where you require most as it is difficult move scripts around in QC)
* In QTP 10, there is new feature introduces which is called LoadandRunaction. There gives relief to folks who were using relative path for referring actions or have storage and development of scripts in different location



Functions

- They have just the code associated with it and nothing else.
- They are two type : Sub procedure, Function

Comparision

With reusable action , one can only open one script at a time . This is first and foremost disadvantage I felt as I need to keep on switching the scripts to make modification.If the scripts/actions are going to be in QC, then it would eat lot of time to swtich the scripts. While with functions, You can open many function files at same time with test script and you switch easily among them.

With reusable action, every action comes with local sheet and if you using many reusabale action, it would take heavy footprint in memory. Whiel with functions, it just the code and it is as light as it appears too.

With reusable action,it can accept only scalar data like String, Boolean, Number, Password. etc. While with functions , it can accept any type like objects, classes, and even functions.

*Well if you think you do not ever require to pass objects, then I would say you are just working with what QTP gives basically. I was very immensly helped when I replaced data base checkpoints with functions/classes that store and compare data. This made my script execute faster and better.

One point where actions score over fucntions is they have got some intellisense(like showing object names, function syntax when typing code) which is kind of helpful while development. But again it is how you get accustomed to. I felt I can trade off this with other advantages which I get and helps me do development faster.

No comments:

Post a Comment

---------------------------------------------

Related Posts Plugin for WordPress, Blogger...