Facebook, Watir And Testing

Written by: Jarmo Pertman on October 5, 2011

Originally posted at itreallymatters.net by Jarmo Pertman.


I’ve known some time now that Facebook has been using Watir as their integration testing tool. Hell, there’s even a Facebook logo on the main page of watir.com. But today was a special day because i had to read one article about Facebook moving away from Watir.

Confusions

Since i’m one of the few core developers of Watir then this article made me notice statements which are not true or are just misleading. It seems to me that the author of that post doesn’t know the insights of Watir and other tools he’s mentioning or just uses wrong terminology by accident.

Watir & JavaScript

First statement which forced me to questioning myself was the following: “Watir automates the browser with JavaScript…”.

It took me some time before i understood that the author had FireWatir in his mind and not the Watir itself. FireWatir was used to automate Firefox browser and it truly used JavaScript as it’s engine to perform all the automations. Watir on the other hand controls Internet Explorer and uses it’s OLE interface instead to control the browser. This means in effect that there’s almost no JavaScript used in Watir.

Watir != Watir-WebDriver != WebDriver

The next statement causing confusion is: “The Watir we adopted in 2009 has since been improved, integrating a new protocol called WebDriver which allows you to automate the browser more accurately and with more power than could previously be done with straight JavaScript.”

First - Watir has been improved indeed when compared to year 2009 :) This is a good thing and a true statement. Second - Watir doesn’t integrate with the new protocol called WebDriver - it does still use OLE. I’m not exactly sure what the author means by the end of his statement about more accuracy and power. And of course - third - as mentioned already, Watir itself doesn’t use JavaScript and didn’t even do that in the year of 2009.

I think that you can call the WebDriver as a protocol, but the most famous implementation of that protocol is for sure Selenium-WebDriver aka Selenium 2. Watir-WebDriver is a library written on top of Selenium-WebDriver’s Ruby bindings. In other words it is an improved API over Selenium’s API. At least this is the way, we, Watir-loving people like to think. It does even have some API improvements which vanilla Watir doesn’t have yet. There is a project called WatirSpec, which is the specification for Watir’s API. Even Watir itself doesn’t conform to that yet. But the ultimate goal is to make Watir-WebDriver and Watir 100% compatible with each other. Latest releases of Watir have been moving towards that goal.

Abandoning Watir

And then i have to read the saddest statement of that article: “Once I understood all these factors, my course of action seemed clear: Abandon Watir, create a WebDriver client in PHP, and reuse our mature PHP unit test system for our browser tests. The WebDriver protocol was straightforward enough that I had a fully featured client in PHP by the end of a weekend’s work.”

On the one hand i’m happy that the engineers in the Facebook try to make things better - having the same technologies used between different projects is always a good thing. On the other hand i’m not sure i understand as to why they had to create a new PHP WebDriver bindings. Looking from the main page of Selenium 2 i can see that there’s already two seemingly active projects doing just that - php-webdriver-bindings and WebDriver-PHP. Maybe engineers at Facebook had good reasons why not to use something already existing. Maybe they just like to feel more challenged and want to invent few bicycles in a while. I don’t know.

Conclusion

After all it was an interesting read. Since i’ve used Watir about 4 years now then it’s nice to read that someone else had similar or completely different solutions to the same problems. I like the thing about Facebook that it tries to be more open to the world when it comes to the topics of the tools and processes used to make, maintain and release such a widely used product.

On the other hand, posts having false information in them tend to have a strong effect on people using the tools under fire. Especially if this kind of information is originating from a trustworthy source. From that post it seems that it is time to abandon Watir since it is too old and not developed anymore. That’s just plain wrong. Watir is still actively developed and one of the biggest reasons why not to abandon Watir at this moment is that it is still the best automation tool for Internet Explorer. Watir-WebDriver’s IE driver is just not mature enough. Sorry, WebDriver guys. I would be happy to run all my tests with Watir-WebDriver since that would give me an opportunity to test with different browsers, but as long as IE is not working properly, then i just can’t do that. Since IE is the brittlest and still most used browser, then testing with that browser just seems to be mandatory.

I have to agree that if the person is not tied with all or some of these projects on a daily basis then it is hard to understand the difference between Watir, Watir-WebDriver and WebDriver. Maybe the biggest problem is just that the topics aren’t documented enough?

Tags: