1

This question is related to how should I approach with creating selenium automation framework.

I googled and studied few frameworks. Also, I created my own framework in which I was taking input from excel and executing the steps accordingly.

I came to know about dictionary concept of QTP in selenium using Hash Map Util.

Can anyone please provide input about how to implement this Hash Map dictionary or any reference.

  • 3
    Interresting question, but its now two in one, could you split up the QTP and the Selenium design technique questions into two, for now I would vote to close it as too broad. – Niels van Reijmersdal Mar 3 '15 at 21:29
  • Selenium does not have a hash map feature, but your programming language (java? C#?) does. – user246 Mar 4 '15 at 13:32
  • Agree. Using JAVA as programming language, I will be using hashmap to store test steps in hashmap. – Gaurav Khanna Mar 9 '15 at 8:01
1

I want to share more general answer to this question.

An absolutely must-have book which should be read by anyone touching the topic of designing the architecture of automated testing framework (regardless to programming language) is Experiences of Test Automation: Case Studies of Software Test Automation by Dorothy Graham and Mark Fewster.

Based on real experience from a big number of software development projects, the authors have prepared short and concrete summaries on each of the aspects of test automation framework: from design to management issues.

You'll also find there a lot of insights, success and fail stories, and I hope it will be useful to you in the matter of avoiding the basic mistakes when designing your framework.

0

TL;DR: How to minimize maintenance - short summaries of best practices.

Best way is to create test suite for an application. Abstract out generic parts. Then try to use generic parts on different test suite, and generalize what you need to.

After three apps, you have a base for framework - you separated generic parts from specific parts.

Another option is to have incredible design skills - if you have those, you don't need to ask how.

Let me explain in more details:

If someone HAS skills to design framework upfront, s/he is one of a million and very likely will not waste time here to ask how.

And if does not have skills, trying to start with framework BEFORE you solved special cases for few applications and developed a "feel" for problem area will end up in failure: you will add many features you THINK you need, or looks cool, or are good fit for different application, but fail YAGNI: you ain't gonna need it.

So IMNSHO starting with framework is wrong and waste of time. Framework is a result of abstracting common parts from few solution you designed and proven to work. Yes, it helps to use good design patterns from the beginning, but there is NO REPLACEMENT of solving real life problems.

Of course OP might be incredible skilled designer way beyond my skill level, and I am wrong. But i like my chances.

I am currently doing similar thing: building bunch of tests, and adding generic methods, so writing tests is getting easier. I already did big global refactoring three times, and maybe 30% of original design is preserved. Maybe OP has better skills than I do, and could foresee all that changes, and could have started with better design. Or maybe not.

  • I'm -1-ing this because it's not a very well thought of answer. It looks like it was put together in a haste to answer an unanswered question. And it was a worthy effort at a joke, but, yeah... no. – Hannibal Mar 3 '15 at 16:12
  • I disagree, and added bit more meat – Peter M. Mar 3 '15 at 17:12
  • Yeah now, that "you added bit more meat...". – Hannibal Mar 3 '15 at 17:13
-1

It depends on your language, and building tools choices.

For Selenium, look into the PageObject model. That pattern will provide you with a very good starter point about how to structure and group your test cases.

Building a framework is indeed, not an easy task. You have to have an eye for the future of what you would like to achieve and how far do you want that framework to take.

Indeed, you have several options:

  • Actor / Command pattern
  • Mixing things up with Cucumber
  • Mixing things up with Spock
  • Include it into the build process
  • Make it live next to the application's own code base

To list a few. Cucumber and Spock will give you the ability to use Given When Then style test cases which will make your tests more understandable. The more you understand them, the easier it will be to maintain and group them properly. The Actor / Command design pattern will give you some flexibility if you are testing a REST API for example.

You have your actors who will "execute()" certain commands which all implement a common interface called Command.

Also, grouping can occur at project level. If you have a multi layered application with parts that differ, for example a portal for one time, or language, customer; another portal for admin users; a portal for various minuscule items. In that case, I would suggest creating a CORE library which is shared between INDIVIDUAL application relating projects. Building these could be achieved very easily with Gradle / Grails / Maven. The Core can be a shared library as well.

There are ample of things in design and I think I only scratched the surface here, though I hope I could provide you with some starter points.

Cheers!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.