Pages

Sunday, March 13

How to design Automation Frameworks in QTP


Hello Friends!

In this post, we are going to discuss about Automation Framework! I'm not going to write any bookish definitions here. It's all what I learned from practical experience.

Okey!

First thing first...


What is framework?


Do you watch movies in Cinema Hall? I know you do!!

Take a moment and think about what happens starting from the point you enter in Cinema Hall to the point you come out. Here are few typical steps..

- You enter in hall >> go the ticket window >> pick a movie broacher somewhere nearby ticket window

- Choose a particular movie you wanna watch (decision influenced by the choice of wife/girlfriend!!)

- Come in the queue and wait for your turn, pay by card and get the ticket.

- On ticket you find some very important information i.e. show start time, Audi No. (Hall No.) etc.

- You go into the given sign-posted Audi, 5-10 minutes earlier then show time, watch the movie (along with other activities ;) ...... and so on....

Everything is planned.. In order!!  Isn’t it? This is nothing but a framework..


Automation Framework is a set of guidelines and process you use to manage and optimize your automation testing. 

In simple words, Framework is a way to do the things in fashioned and organized manner! Framework is nothing but a concept.


 
Why I need a Framework?:

Now assume that Cinema Hall doesn’t follow any framework.


- You enter in Cinema Hall, go the ticket window, - but there is no movie broacher nearby ticket window??

- You go to the ticket window, but they don’t accept credit/debit cards?? (and you don't carry cash..)
- Okay! You somehow managed to buy ticket, but ticket doesn’t tell you show time and Audi/Hall No.??

- You reached into the Audi but movie has not been started on time??

Would you like to go again in this Cinema Hall?? I'm sure not..

It's always possible to work without framework but you'll be doing a lot of rework, everything will be here & there and in most of the time you will end-up with a mess, especially in the large projects.



Framework lets you predefine your automation plans, strategies and how you are going to proceed.



Types of Framework:

Framework can be of several types, but here are three main types of frameworks-

1. Keyword driven framework
2. Data driven framework
3. Hybrid framework

But this is only theoretical. Practically, there is no 'Chinese Wall' between the framework types.

In every organization you work, you'll find that it's quite different from the other and not only on organization level, you can feel the difference within different projects!

Yess, but most of the them could be mapped with Hybrid type and I like it!! :)
Hybrid framework has no boundaries and open to take benefit of all possible type of frameworks.



How to design a framework?

I have done a lot of automation projects and designed a lot a frameworks, but seriously guys, I never used any particular type of framework!

Practically, every application/project has its own expectation. You just need to start your work in organized way and believe me friends, at the end of the day; your framework will be ready automatically!! Sounds crazy??

You can't design a complete framework and then start automation! You start automation and framework will start building simultaneously. 

The first step of any test automation framework is to do a quick POC with few high priority test cases aka 'smoke tests'. By doing POC, you will identify the object identification issues, challenges, complexities, required test-data and limitation you have. Once you are ready with this information, you can proceed with next steps. On the basis of above information, you can decide what type of framework is most suitable to you.


But before starting, you must take some time to decide your strategies about..

1. Object Identification
2. Test-Data
3. Function Library
4. Error Handling
5. Controller/Driver script
6. Documents and Manuals
7. Test Reults

1. Object Identification:
One of the most important aspect of QTP automation is - How to identify objects i.e. using Object Repository(OR) or Descriptive programming(DP) or both. As per my understanding, dont't try to stick on one particular. Depending on the application/object types, mixed approach is most fruitful most of the time.

Although  both OR and DP have their own pros n cons, but remember, you get full benefit of QTP only when you use OR like debugging, chechpoints etc. So make sure how to identify objects.

Many claim that DP should be used for whole project without using any OR approach, but I disagree. DP is nice thing to use but should be used only when required like if your application is having dynamic objects etc. Doing whole automation using DP without any solid reason is not sensible (personal opinion!).

2. Test-Data:
How to manage you data? DataTable or Excel or may be flat/csv files.

3. Function Library:
Function library could be QTP specific (.qfl) or external (i.e. .vbs). Be clear about what type of function libraries you are going to use and why.

4. Error Handling:
What's your plan for handling errors? Be clear about it. Are you going to use QTP's Recovery Scenarios or you will be writing your own .vbs functions?

5. Controller script:
Design a controller script, which will control all your automation. It should be neat. This helps to understand what actually you are going to call.

6. Documents and Manuals:
Keep all the documentation, user guide/manuals, keywords descriptions here.
 
7. Test Results:
Result is probably most important part of the framework. Put extra attention to results.. always!!

Why? Because result is the face of your framework! This is what you show to world. If your result is fantastic, nobody bothers what type of framework you use, what the hell you have written in your functions!! :) But if results are not flashy.. then.. you know!!

So never underestimate the importance of the results. It must be very well presented.


Create different folder for the these seven things and keep data in folders accordingly.

This was the one part.

Apart from this, from first day of your automation, keep only one thing in your mind.. follow general good practices!

Here are few points need to be take care in designing successful framework.

  • Try to document each and every thing, as much as you can! like comments in script, modification etc.
  • Don't stick with any particular object identification, use mix of OR and DP
  • While using OR, don't use record and playback, just add object in the object repository and code the script manually.
  • Follow proper Naming-Conventions for all your variables, functions, files.
  • Define all the variables in you scripts, use Option Explicit.
  • Try to keep you functions small to enhance reusability and portability.
  • Never hard code any data in the scripts, use parametrization.
  • Take regular back-up of your work.

Okey guys! Please share your views by posting comments.


Related Posts:

QTP - General Tips

 

113 comments:

  1. Good one and worth... Thanks for sharing your expertise

    ReplyDelete
    Replies
    1. Thanks for your valuable comments over framework.

      Delete
  2. It is very nice. thanks a lot for this information. could you please elabotate about controller script.

    Thanks

    ReplyDelete
  3. Grt...!

    Very much realistic information.

    Thanks..

    ReplyDelete
  4. Thanks for sharing information.

    ReplyDelete
  5. very nice and well structured.. thanks..

    ReplyDelete
  6. Hi

    I would like have some sample code for keyword driven framework.

    ReplyDelete
  7. hey..can u pls explain POC?

    ReplyDelete
  8. Proof of Concept

    ReplyDelete
    Replies
    1. What Exactly is this ? Can u please elaborate it ??

      Delete
    2. This is just like premium show, we just create some automation scripts for that application to check whether this is suitable for automation, if so we will expose to that client saying that we can automate this application. once that is approved by client he will sign for start of automation in detailed

      Delete
  9. Very nice and well structered... will you pls explain more clear for "Controller Script".

    Thanks, Prasad

    ReplyDelete
  10. Its really useful and it is practical also .

    Thanks for posting.

    ReplyDelete
  11. The Concepts are short and Very Effective ,

    Thanks for Posting such a useful information...

    Thank You
    Vilas Rajeshware

    ReplyDelete
  12. Can you please tell what percentage of bugs are generally found using QTP? Is it more/less than Manual testing? Also, what kind of bugs are usually detected using automation?

    ReplyDelete
  13. it is really very useful .thanks for posting

    ReplyDelete
  14. This is the first blog where i have commented till now. Excellent article "How to design Automation Frameworks in QTP". It is appearing as realistic

    ReplyDelete
  15. just tell me i want to prepare frame fork how can i prepare framework.........., plz give me reply

    ReplyDelete
  16. hey!! thanks a lot :) :) i understood the real concept of automation framework after reading your article !!:)

    ReplyDelete
  17. I really like it. its so clear & easy to understand. Thanks Again.

    ReplyDelete
  18. Very Useful even for Beginners also. Thanks a lot...

    ReplyDelete
  19. Thanks for sharing information,its really great support for us.

    ReplyDelete
  20. very useful...

    ReplyDelete
  21. This is the first blog where i have commented till now. Excellent article "How to design Automation Frameworks in QTP". It is appearing as realistic

    ReplyDelete
  22. SuneethaKanchana18 October 2012 at 04:32

    Nice and clear with useful information

    ReplyDelete
  23. I searched many sites for automation definition and not found useful one. I got clear idea after visiting ur site. thanks a lot. very useful info.

    ReplyDelete
  24. Thank you for this real effective information.

    ReplyDelete
  25. Thanks a lot to all of you for your comments.

    ReplyDelete
  26. Really nice...thank you

    ReplyDelete
  27. Very good info, Can you please little bit eloborate with examples of script, folder etc...

    ReplyDelete
  28. This is really Nice

    ReplyDelete
  29. Can you explain the frame work structure/folder?

    ReplyDelete
  30. tell me some sites from where I can download Qtp 10 and 11 on windows xp service pack 2 and 3 on 32 and 64 bit machine

    ReplyDelete
  31. Thank you very much to all of you. I'm glad you liked my posts.

    ReplyDelete
  32. Thanks...it cleared me that framework is just aconcept...thanks it was useful

    ReplyDelete
  33. Nice one.., Thanks for sharing your expertise.. :)
    Can you please share sample framework?
    It will more helpful for us..
    Advance Thanks.. :)

    ReplyDelete
  34. thanks for info...

    ReplyDelete
  35. thnx for good info, itz very useful

    ReplyDelete
  36. Can u plz show the framework using excel and notepad instead of QTP

    Thanks

    Tareq

    ReplyDelete
  37. @divya chum

    Thank you very much. I'm glad you find it useful.

    ReplyDelete
  38. @Tariqul Islam

    I didn't get your query, without QTP? Do you mean Keyword Driven Framework?

    ReplyDelete
  39. Really Helpful. Thank you very much for giving valuable inputs.

    ReplyDelete
  40. I am sick of reading same old answers, definitions every where. Thanks for being so clear. Everybody else just copies and paste in other websites. I hate it so much. Website is full of junk

    ReplyDelete
  41. Can you please tell more about the controller script?

    ReplyDelete
  42. Great...good real time knowledge ...Thanks!!

    ReplyDelete
  43. Great information http://www.couponslake.com/

    ReplyDelete
  44. Really Helpful. Thank you very much for giving valuable inputs.

    Reply

    ReplyDelete
  45. its realistic, even dummies can easily understand.it will be more useful if u explain with examples or by giving an example.

    thanks to the blogger.

    ReplyDelete
  46. i understood what actually framework is...thanks a lot for the blog.. :)

    ReplyDelete
  47. This comment has been removed by the author.

    ReplyDelete
    Replies
    1. superb i have understood very well but can u provide any examples from next time onwards.....

      Delete
  48. Hey Abhikansh, Thanks Dude.....Its very useful. The content on your blog is very good with the real life examples. I learned a lot over here. I will be following your blog in future.

    Thanks a lot,
    Pradeep Kumar

    ReplyDelete
  49. @Pradeep

    Thanks. I am glad you like it :)

    ReplyDelete
  50. Hey Hi...dis blog is useful n worth reading. Can u plz elaborate on controller script

    Thank You:)

    ReplyDelete
  51. Very clearly written, thanks very much.

    ReplyDelete
  52. Awesome..... Hats off :)

    ReplyDelete
  53. its very clear and useful information.Can u tel me how to do keyword driven and data driven frameworks?

    ReplyDelete
  54. IT IS VERY USEFUL THANKS...

    ReplyDelete
  55. Its wonderful and helped me to understand the framework concepts

    ReplyDelete
  56. very usefull to who is gng to start automation Nice...
    thnx,

    ReplyDelete
  57. @Venkateswarlu Gottipati - thank you very much!

    ReplyDelete
  58. Hi I have read all your topics. all the topics are clearly explained with simple examples. it was very useful.... thx..... jayashree

    ReplyDelete
  59. Hi its very easy to understand... thanks...

    ReplyDelete
  60. Great piece of information. Keep posting more such post on framework design

    ReplyDelete
  61. hi Abhikansh Jain, your spooning explanation is excellent...your filling lot of energy in to users,thanks alot...please can u reply this..i have strong knowledge on QTP, i am able to write any test script for any complex scenario,BUT using Linear approach only..... but i am struggling to write Framework based test script.. please reply me, difference between linear script and Frame work based script.
    real time we are following framework based script...recently i saw one script in MNC...that is totally confusing and i didnt understd that script..pls suggest me how can i learn real time script..
    i have 100 % knowledge on Linear manner , may i eligible for Companies, thank u
    waiting for ur favorable reply

    ReplyDelete
  62. very easy to understan any people...thanks bro...

    ReplyDelete
  63. Nice article providing quick understanding of the Framework concept. Also, easily understandable. The tips too are quite helpful. Thanks Abhikansh.

    ReplyDelete
  64. This comment has been removed by the author.

    ReplyDelete
  65. @Dinesh Sorry for replying too late! I don't think there is any specific manner called linear. Do you mean recording? or writing script without using function library or DP? If so, yeah, for complex real time projects, above way of writing script will not yield any fruitful results. To get most out of your automation effort, we should always use proper framework. And as I always say.. "framework is nothing but concept"! Its just doing the things in structured way :) So if you can automate any application without using a framework, you are more then capable of using framework as well. :)

    ReplyDelete
  66. Very nice explanation thanks a lot

    ReplyDelete
  67. Great Knowledge you got in making people understand in a v easy and simple way.

    ReplyDelete
  68. can any one tell How to getPDFtext & stroe in variable

    ReplyDelete
  69. Really very help-ful for New And as well as Automation Testers, Indeed its Nice Explnation ................

    ReplyDelete
  70. Nice information

    ReplyDelete
  71. Thank you very much for your Fabulous Explanation.

    ReplyDelete
  72. Very useful, thx for the good information

    ReplyDelete
  73. Hello

    I am an experience QTP user. I am impressed by your knowledge and willingness to share it with the world.
    Keep up the good work.

    regards
    nimith

    ReplyDelete
  74. nice informatioon

    ReplyDelete
  75. your information and explanation is awesome dude. its really shattered some of my doubts on framework

    ReplyDelete
  76. Abhikansh Jain, my friend went for interview on qtp(3 years fake exp) and he was asked,in your company what is the flow you are using for automating the project.(i am also searching the job with 3 years f e).like how do you work on your project.

    ReplyDelete
  77. any one explain me keyword driven frame work mainly interview point of view

    ReplyDelete
  78. Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog.
    Oracle Training In Chennai

    ReplyDelete
  79. Good starting point. Thanks

    ReplyDelete
  80. Beautifully explained ..Must visit for beginners

    ReplyDelete
  81. Nice information about the automation frameworks My sincere Thanks for sharing this post
    Software Testing Training in Chennai

    ReplyDelete
  82. really have a wonderful post.Thanks for sharing.keep sharing more blogs.Anybody want to learn
    Selenium Training in Bangalore

    ReplyDelete
  83. Thanks for sharing this QTP informative blog. Expecting more Blog Post Best QTP training institute in Bangalore.

    ReplyDelete
  84. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site"Devops Training in Chennai"

    ReplyDelete
  85. Very good informative article. Thanks for sharing such nice article, keep on up dating such good articles.
    Austere Technologies | Best Cloud Solution services

    ReplyDelete
  86. IT'S REALLY GOOD INFORMATIVE POST ABOUT QPT. THANKS FOR SHARING.

    NO.1 IOT SERVICES | Internet Of Things

    ReplyDelete
  87. REALLY VERY EXCELLENT INFORMATION. I AM VERY GLAD TO SEE YOUR BLOG FOR THIS INFORMATION. THANKS FOR SHARING. KEEP UPDATING.

    NO.1 APP DEVELOPMENT SERVICES | MASSIL TECHNOLOGIES

    ReplyDelete
  88. I strongly believe that there will be good opportunities for those who looked at your site...
    Best Online Software Training Institute | Automation Anywhere Training

    ReplyDelete
  89. Nice blog with excellent information. Thank you, keep sharing.

    Choose Avinash College Of Commerce for Best career in commerce

    ReplyDelete
  90. Really excellent information you made, very helpful. Thank you.

    Software Testing Services | Austere Technology

    ReplyDelete
  91. Wow...What an excellent informative blog, really helpful. Thank you.

    chartered accountant | Avinash college of commerce

    ReplyDelete
  92. Hi Thanks for the nice information its very useful to read your blog. We provide best Block Chain Services

    ReplyDelete
  93. Thank you for sharing this valuable information. But get out of this busy life and find some peace with a beautiful trip book best Andaman honeymoon packages

    ReplyDelete