Babies and bath water

I’m sure most of us have been told at some point to not throw the baby out with the bath water. And for the one person who has not, wikipedia has a nice description of the expression.

An idiomatic expression used to suggest an avoidable error in which something good is eliminated when trying to get rid of something bad, or in other words, rejecting the essential along with the inessential.

A slightly different explanation suggests that this flexible catchphrase has to do with discarding the essential while retaining the superfluous because of excessive zeal. In other words, the idiom is applicable not only when it’s a matter of throwing out the baby with the bath water, but also when someone might throw out the baby and keep the bath water.

As a Selenium consultant, I spend a lot of my day talking to people about Selenium, technology choices/trade-offs and answering questions that start with ‘So I heard…’. Over the last month or so I’m really starting to feel like Selenium is right now holding both the baby and the wash tub out the window with the whole Se2/WebDriver thing.

Selenium 2 is best thought of as the merged product of the Se-RC and WebDriver products. Literally it was a mashing together of the svn repos. But along with that came the official decree that the way forward was the WebDriver-esque APIs. But as a result of that, development on the Se-RC APIs has been discontinued / frowned upon. And has resulted in at least one fork of one of the official drivers; a trend I expect to continue.

WebDriver is seriously cool tech, but it is not the Baby in this scenario. Selenium has got the market-share that it has not by being cool tech, but by being able to run the same scripts against a variety of browsers and that had bindings in multiple languages that provided the same capabilities. The current state of Se2 does not address either of these adequately.

The new Selenium Server (what used to be called the Selenium RC Server) is fully backwards compatible with Se 1.x style scripts. And will be for the foreseeable future. (Which is why you should be running the latest server version even if you are not using the WebDriver parts.)

From my vantage point, the most important contribution the Se2 stuff has had to the larger community is the introduction / popularization of the Page Object pattern. This pattern can, and should, be applied to any automation effort regardless of whether you are creating 1.x or 2.x style scripts. I have yet to recommend using the WebDriver APIs to a client, but I explain Page Objects to each and every one of them.

Page Objects let you not only hide all the implementation details of scripts in reusable classes, but also you to swap out implementations of the actual driver when it is appropriate. To keep with the metaphor, this is the equivalent of keeping the baby in the wash tub while pouring out the cold, dirty water with new, warm water. (Must resist spelling that as watir. Whoops. Didn’t resist hard enough.)

Even then, there needs to be a way to do the replacement in a gradual manner. Ripping out one API to put in another is the equivalent of the tipping bucket at a water park. I’m pretty sure there exists a way to gently replace the water in the Java bindings and C# (though grudgingly) but there is not currently one for Ruby nor Python (though I believe it will be forthcoming).

How do we make sure that the baby stays with the bath water (in the tub; and not out the window)? I don’t know. But the following things stress me out (as someone whose mortgage is now tied to the success of Selenium).

  • What is the Safari story for Se2? From what I understand this is a Googlers’ 20% time project but is in an unknown state and their time commitment to it is also unknown. It would be fantastic if someone from Apple took this on. Having seen some of the conversations around dealing with browser stuff that a vendor would be best positioned to deal with, it seems this is the logical path for things.
  • Lift the blanket moratorium on evolving the 1.x APIs. They are going to be around for a long time.
  • A documented upgrade path from 1.x to 2.x for each officially supported language
  • Feature synchronization between all official driver language

Surprisingly, the fact that Se2 doesn’t really like Alerts and Pop-ups yet doesn’t scare me at all. I have no doubt that it will come. My fears are in the other stuff.

How these are all solved, I don’t have a clue. Selenium is Open Source so there is no manager saying you must implement x, y and z. (Or for that matter me figuring out how things are wired together and just doing it myself.) But the next year I think will be an important one for Selenium and how it, as a project and as a user community responds to these challenges will decide whether baby is nice and comf in the house or out in the shrubs under the window.

Post a Comment

Your email is never published nor shared. Required fields are marked *