WebDriver

Faster than a speeding bullet! Easier to maintain than something that’s really easy to maintain! Reliable! That’s what we want from our tests, but how do we get there? This presentation covers key strategies and patterns for writing test suites using WebDriver, a developer focused tool for web application testing similar in spirit to Selenium RC. We’ll cover why it was written, the problems it addresses and how to integrate it into your projects and testing process.

This talk presented by Simon Stewart, creator of WebDriver, still serves as a useful introduction to the tool, even though the talk itself is a couple of years old and WebDriver has moved on since then.

I’ve been experimenting with WebDriver as an alternative to Selenium/Selenium RC, although it is worth bearing in mind that both projects are merging. I’m enjoying getting to grips with WebDriver and am finding that the tight integration between WebDriver and each of the browsers it automates is much faster than Selenium, since it uses the mechanism most appropriate for controlling that browser. For example in Firefox, WebDriver is implemented as an extension, whereas in IE, WebDriver makes use of IE’s Automation controls. In addition to Firefox and IE, WebDriver also supports the following:

  • Safari 3 on OSX
  • iPhone
  • Selenium Emulation

It’s the Selenium Emulation I’d like to touch upon here, what this basically means is that the Java version of WebDriver provides an implementation of the existing Selenium API, and therefore can an be dropped in as a substitute for the Selenium Driver. Here’s an example of how you’d do this:

  1.  
  2. // You may use any WebDriver implementation. Firefox is used here as an example
  3. WebDriver driver = new FirefoxDriver();
  4.  
  5. // A "base url", used by selenium to resolve relative URLs
  6. String baseUrl = "http://www.google.com";
  7.  
  8. // Create the Selenium implementation
  9. Selenium selenium = new WebDriverBackedSelenium(driver, baseUrl);
  10.  
  11. // Perform actions with selenium
  12. selenium.open("http://www.google.com");
  13. selenium.type("name=q", "cheese");
  14. selenium.click("name=btnG");
  15.  
  16. // And get the underlying WebDriver implementation back. This will refer to the
  17. // same WebDriver instance as the "driver" variable above.
  18. WebDriver driverInstance = ((WebDriverBackedSelenium) selenium).getUnderlyingWebDriver();
  19.  

This allows for WebDriver and Selenium to live side-by-side, and provides developers with a simple mechanism for a managed migration from the existing Selenium API to WebDriver. I’m still experimenting with it but I have to admit I really like it simplicity.

Yusuf Islam, the Cat of Old

You ever had one of those days when you get home from work, your tired, but you carry on working because there always seems far more to do than time to do it in? you feel like you want to find a way of picking yourself up out of whatever temporary rut you feel yourself in? Well yesterday was like that I think I must have stopped around 11ish. Rather than hit the sack I made myself some tea ( courtesy of Zach ), and started to flick through channels. I’ve noticed that I have a tendency to do that, a lot! there’s nothing you actually want to watch, so you just flick through until something vaguely interesting catches your eye. And something did, I stopped on BBC Four and caught the last few minutes of Alan Yentob’s Interview with Yusuf Islam (formerly known as Cat Stevens), from 2006.

I’d never seen the full interview before, and yet the image I was confronted with on the screen, of this bearded man playing this acoustic guitar and singing in this beautifully melodic voice just made me want to listen (at the 45 minute mark). It was curious I suppose that I’d tuned in just in time to listen to Alan Yentob ask him the question”:

“After all those years of resistance you’ve now picked up the guitar again. Do you think you have allowed yourself to sort of take a position you didnt feel this literalism about Islam which a lot of people find difficult to accept. Some people might say to that extent you’ve been brainwashed perhaps?”

Yusuf Islam:
“The positions that I took previously, I held fast to them because I believed them to be true. However, one only has to look at history, it wasn’t long ago when we discover, guess what, the guitar was probably introduced to Europe, through Spain by the Muslims. Now I’m saying, hang on, What? you know… and thats a reality. When I learned something better I moved, and that’s what you’ve got to do. I think we must not, ever, take the position that we know it all. God may show you something you never knew yesterday,we’ve got to be ready for that” …

Alan Yentob:
“Is there a message in these songs as you pick up this guitar again?”

Yusuf Islam:
“There is certainly a change in the wind and the way in which there is now a chance for a new understanding of the moderate middle path of Islam because the extremes have been exposed. A lot of people have missed the whole point, including some Muslims, who have gone off on some kind of..their own..strategy of trying to improve the world through some kind of devious means that has nothing to do with Islam, and yet is supposed to be in the name of Islam. The word Islam itself comes from the word ‘peace’ now that is the heart and soul of this religion. I discovered that, I’ve done that journey and perhaps I can help others to feel a bit more assured that in fact a lot of Muslims in this world, the vast majority just want to live a happy life and be at peace with the rest of the world”

I think there’s something wonderfully uplifting in his words, and in his music. His sentiments are nothing new to many muslims yet sadly social the perception of Islam and Muslims seems to be growing more and more negative as the actions of an extremist minority are used to label all Muslims are radicals. In fact I remember storming off in a rage as I watched the European election results and listened to Nick Griffin, the leader of the BNP, explain that stopping the spread of radical Islam was one of the reasons people had voted for him.

After the interview ended the BBC aired a hour long ‘BBC Four Session’ featuring Yusuf singing a number of his songs, both old and new, from a concert in Porchester Hall several years ago. I stayed up and watched the show and found myself being moved more and more by his songs and their message. I even ended up downloading several of his recent albums on iTunes as I watched the performance on tv – although I’m not sure if my colleagues appreciated that since I was humming, and singing along to them as I worked in the office today 🙂

Rather than pick up the laptop and work this evening, I decided to see if I could find that interview and watch it all, sadly BBC iPlayer doesn’t have it, however it does still have the ‘BBC Four Session – Yusuf Islam‘ which is available to watch – it’s a wonderful concert, an inspired performance which I certainly recommend.

After searching on Google I did eventually find the Interview, there’s a copy hosted on Google Video ( disclaimer: it’s hosted by an organisation called ‘Turn To Islam’. I have no idea what this organisation is, I simply wanted to link to the video). I’m glad I watched it all Yusuf describes his early life, his celebrity status, his, his conversion to islam, and his return to performing. Perhaps the most moving part of the interview is when he describes his battle with tuberculosis – which will resonate with anyone who has ever found themselves lying in a hospital bed reflecting on their life, and where they are headed, particularly when he says “.. in that hospital I developed some insights which then later fed into my music … into my journey” … a poignant sentiment that touched me deeply given my own experience.

Yusuf Islam is an amazing man, who truly inspires.