1

I am looking for most universal, up to date, open source, selenium framework for test automation. Or at least a number of frameworks for different languages. I am surprised as how every company and every test automation developer is building his own framework. It feels like reinventing the wheel over and over again. Even Dave Haeffner jokes about how everyone wants to build their own. Yet in the links provided in the video by him, the framework collection seems poor (one framework per language) and, at least for java, out of date (2 years old), only with 6 contributors, and seems to be copyrighted. In test automation community so many things seem to be de facto standard. Why not pull it all together and have a repository, actvively maintained by test automation developers.

As for this question to not seem too much opinion based: Please provide links for Java-Selenium-JUnit frameworks you know and use and believe in.

1

TL;DR: There is no need for a framework at all. Using frameworks does not speed me up, just adds more complexity. Keep it simple!


Most of the "Frameworks" classes that I build are Domain specific. For example setup test users by code. Clean up environments before test-runs.

I dont like to call it a framework, that would make it bigger than it is. It is not a re-usable chain of tools/libraries. The test boilerplate I use are:

  • A unit-testing tool
  • Simple pageObjects like classes (for views, data-stores and API's)
  • WebDriver

I do have a couple of helper classes that most of my test projects have:

  • environmentUnderTest settings (enabling same tests to run against staging, acceptance and production)
  • WebDriver setup
  • wait Helper
  • tempPath Helper
  • logger

I like to let new projects organicly grow and start with the most simple thing I need. I think I can setup a basic "framework" in a couple of hours.

Software can be complex, and it’s easy for teams to feel overwhelmed. To calm things down, and help deal with overwhelming complexity, one of XPs mantras is to do the simplest thing that could possibly work.

http://www.agilenutshell.com/simplest_thing

I see colegues in other departments trying todo what you suggest, creating an over-engineered and often over-generalized testing framework all teams and everyone can use. Creating a common DSL. Working for months to make the perfect framework. I have never seen it work. It makes building tests much more complex and includes a lot of magic that makes test failure debuging hard. If you need to train people how to use it, stop and think :)

For design that could means starting with something ridiculously simple, and adding more complexity just-in-time, if the next test warrants it.

I just automate tests and let a framework come to life, if it happens at all. If it happens it was needed, if it doesnt it wasnt. I duplicate code like a madmen and refactor/restucture my tests daily when ever I see a good abstraction.

Owh and this XKCD ofcourse, to explain why not:

enter image description here

  • 2
    Not sure why this was downvoted initially, but I upvoted since this is my approach as well. Test Automation should fit the domain/product being tested, not have a "one size fits all solution". Selenium is the one size fits all tool, which is standardized, which then allows for customization per your individual project. – Lee Jensen Nov 1 at 15:17
  • @LeeJensen Thanks. I have had multiple conversations with test automators that asked me if I am building a framework or just automating tests. As if there is a difference. Sometimes including a "Test Architect" role in the discussion and I can understand that if you are a framework building architect you might not like my answer ;-) – Niels van Reijmersdal Nov 1 at 15:22
  • What does "XP" stand for, in the answer? – lucasso Nov 1 at 15:29
  • @lucasso It stands for the eXtermeProgramming method. Its creators took part in the Agile Manifesto creation. (See extremeprogramming.org) XP popularized common practises like TDD, Continous Intregration and PairProgramming. I also added a link to the specific pages about simple design in the quote. – Niels van Reijmersdal Nov 1 at 15:36
  • " I just automate tests and let a framework come to life, if it happens at all. If it happens it was needed, if it doesnt it wasnt. I duplicate code like a madmen and refactor/restucture my tests daily when ever I see a good abstraction.". This is an hectic task, you can't do it as the number of test cases and features increase. – PDHide Nov 1 at 17:09
0

You might be interested in JDI Light framework. This seems to be actively (more or less) maintained and evolved from former JDI that used to feature a lot of useful staff but is no longer supported as far as I understand.

  • I like their Ultimate Goal :) – Niels van Reijmersdal Nov 1 at 16:44
  • @NielsvanReijmersdal yes, they have pretty optimistic view on the future :). I would say that building PageObjects from UI with help of NN looks attainable nowadays. However fixing tests automatically if UI is changed is an arguable feature (nobody would know if that change is planned or is a defect). – wec Nov 1 at 16:52
0

I think you are missing out the definition of "Framework"

https://smartbear.com/learn/automated-testing/test-automation-frameworks/

A framework is comprised of a combination of practices and tools that are designed to help QA professionals test more efficiently.

These guidelines could include coding standards, test-data handling methods, object repositories, processes for storing test results, or information on how to access external resources.

While these are not mandatory rules and testers can still script or record tests without following them, using an organized framework typically provides additional benefits that would otherwise be missed out on.

So test frameworks are not just folder structures, it defines an overall process, tool, rules, technologies, coding standards, and so many stuff

Why we need a framework?

It makes code maintainability pretty easy. Once you have a framework that is efficient, you can code in parallel with high efficiency. For instance, you write code for drop-down selection and another engineer can reuse the code.

If you didn't have an efficient framework(naming convention and directory structure), the engineer should waste his/her effort in finding a solution that was already found out.

Why can't we reuse framework?

That is how all frameworks are being built,we take up existing frameworks and leverage it to create frameworks that are suitable for our project and team. For example TestNG, robot framework, etc.

All the test directory structures for UI tests are almost similar. Most uses page object model with folder structure like util, common, resource, report, etc. We just make changes according to different projects.

Why can't we have one fit solution?

The framework depends on organizational decisions and project complexity. For instance, the organization wants to save money by moving from VMS to containers. They want to run the selenium grid test in containers than in VMs, or sometimes the decisions may be to use the cloud.

So you have to investigate how the test-framework could be made ready for being put in CI/CD or delivering the additional requirements.

But in all cases, there will be a base framework from where we start building it.

And also test frameworks are company proprietary asset, it comes under intellectual property. You can't just share it with the public , the same as any other source code.

Have we ever asked like,

API solutions are already there, why can't we have a common solution to implement API, why can't we just copy paste a common API implementation and use it in our project. Why develop new APIs?

Or

Why we need developers when you can simply have a common repository for components like link, button, logics, algorithms, etc. You can just copy and reuse it, then why reinventing the wheel.?

......

Its the same for test framework development, we start from a base and make changes according to our needs. We cannot just copy paste a single solution and use it as it is. Because things break and we have to make it work.

How to create an efficient framework ?

Start from the base framework, learn from mistakes, keep evolving the solutions.

Most importantly, fail fast, meaning that you should realize the inefficiency of your framework faster. Analyze the drawback and make changes quickly, grow your test suites slowly till you are confident about the implementation.

Any Frameworks recommendation ?

Framework depends on project, budget , organizational decisions and many such things. And as mentioned, frameworks are not just directory structure.

Recommendation for directory structure could be taken from GitHub or any such open source repos. But you have to develop it in the ways you need

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.