Choosing between these two test automation tools for an automation framework
I recently got started on a client project in which I’m putting together an automation framework, where, luckily, I’ve been given some objectives that are quite clear to fulfill. I want to discuss one of the things that I am considering in regards to the project (in case anyone has some helpful insights!) which is: What automation tool should I use? In the ring, I have Selenium vs Watir.
On the one hand, Selenium seems to me the most natural option, the most popular open source tool for web browser automation. The de facto standard. But, when I was discussing it with my colleagues at Abstracta, they recommended Watir, which is better for Ruby.
So, I started to investigate a little more. Before I start comparing the two tools, I would like to comment on why this particular language choice.
Language
If it were for me, I would program in Java, since that is what I have more experience in, but the client’s team programs in Ruby. But, that’s okay, I can be flexible! Since I hope that the developers consider automation as a value-add to them in the future which they can extend, maintain, improve, utilize, etc., I prefer to stick with Ruby. Even though with automation, when taking a black box approach, the language used for the system code is less important. Anyway, this argument isn’t a minor one— as testers, we should always seek to team up with developers, and not go in a separate direction from them with our technological stack.
We’re all on the same team, right?
Automation Tool: Selenium vs Watir
I started to investigate a bit, focusing on open source web browser automation tools for Ruby that integrate with:
- Cucumber (when thinking about BDD)
- BrowserStack or SauceLabs for cross-browser testing,
- Applitools for visual testing
Here’s a small comparison chart. I also threw Capybara into the ring (but for my purposes, it had much less fighting power than the others).
Watir | Capybara | Selenium | |
Language Approach | Object oriented | DSL | Object oriented |
Original release | 2008 | 2009 | 2004 |
Popularity | 3rd | 2nd | 1st |
Active? Last release | 2 weeks ago | 1 month ago | 2 month ago |
Ease of maintaining test cases | 1st (uses Selenium under the hood, providing a better API) | Worst (read discussion) | 2nd |
Cucumber Integration | Yes | Yes | Yes |
BrowserStack and SauceLabs integration | Yes | Yes | Yes |
Page Object pattern | Yes | Yes | Yes |
Browsers | Chrome Firefox EdgeInternet ExplorerSafari |
Uses different drivers, including Selenium | Firefox latest releases. Internet Explorer 7-11. Safari 5.1+Opera ChromeEdge |
Headless browsers | Yes | Yes | Yes |
Locators | Id, Name, CSS selectors, XPath | Id, Name, CSS selectors, XPath | Id, Name, CSS selectors, XPath |
Conclusion
My conclusion, for now, is that there aren’t any big differences between Selenium and Watir. While I started out wanting to go with Watir, there are other factors that make me think about switching to Selenium:
- Better support (a greater community implies more forums, more resources, examples, problems solved).
- It’s more likely you’ll find someone with experience in Selenium than in Watir (although knowing one, it doesn’t take long to learn the other).
- It’s more popular and more accepted. Every time I tell someone that I’m going to use Watir, I end up saying, “It’s something similar to Selenium.” Why not just use Selenium?
- The reason why someone recommended Watir to me is because it has an API that makes it easier to read, I am not convinced that it really does make it much easier.
So, for now I am choosing Selenium…
What would you do if faced with having to choose between Selenium or Watir? Leave me a comment below!
Recommended for You
The 4 Most Common Test Automation Challenges (and How to Overcome Them)
Losing and Regaining Confidence in Automated Tests
Federico Toledo
Related Posts
Developer’s friendly tools for continuous performance testing
How many times have we seen a test infrastructure and methodology where the team is not able to get early feedback about the performance of the system they are developing? Typically, it is expected to treat performance testing as a “waterfall project” where we, the…
10 Tips for Choosing an Automation Testing Company
Unlock the secrets to finding an automation testing partner that fits your specific needs, for unparalleled software quality. Ensuring the quality and efficiency of your product is paramount. We understand that finding the right automated testing company can be a daunting task. But it is…
11 Comments
Leave a Reply Cancel reply
Search
Contents
thank you so much for sharing this and keep it up, thanks for this post
The point behind this article as well is quite poor. Because Watir “uses” Selenium under the hood. So comparing Watir to Selenium is kind of trivial.
As mentioned before, nearly everyone “shouldn’t” use selenium. They should use either Capybara or Watir. The API handling they provide for even the most basic stuff (Finding / querying), is much more powerful than selenium on it’s own.
Thanks for sharing all of your experiences!
The primary authors of Watir and Capybara are both core contributors on Selenium, and recommend not using selenium-webdriver directly. If you do use selenium-webdriver directly you will just end up writing a lot more code than is generally necessary. The comparison between Watir and Capybara in this chart is also misleading. Both Watir and Capybara can do the same things with code that looks very similar, with the same ease of maintaining test cases. Not really sure what “much less fighting power” means in reference to Capybara since both Watir and Capybara provide basically identical amounts of functionality. Capybara does provide an optional DSL if the user wants to use it, but it is not required. As in everything, Watir and Capybara are just tools – you can write bad tests in either.
Agree!! 🙂
Thank you for your details here, appreciate it!
Very interesting points you have remarked, appreciate it for putting up.
IMO, Selenium is the best option, has a larger community support. I think that the QA people has some freedom about what lenguaje their use, for me is not a must to have the same language that the main project. Think about this: what if the main project has to do a major change or need to integrate another tool with a different language? you will move again in the same direction and rewrite your code?
Hehe, this is a good point 🙂
I used both, but if Ruby is the programming language; watir would be a better option, because it exploit the avantages of Ruby. The code to do the same action use less lines of code, but if you are more familiarized with Selenium, and the facts you mention have more importance for you; go for Selenium.
Thanks for the answer Rodrigo!! Yes, I loved the way Watir is written, it’s shorter, clearer. Anyway, I still value more the mentioned aspects. Regards!