On Thursday evening I attended the Skills Matter event In The Brain of Gojko Adzic: Testing Web Applications with Selenium & Selenium Remote Control which was a great follow up to Kerry Buckley's Web Testing with Selenium talk he did at Barcamp Brighton last September.

Richard has been to a few Skills Matter Java & JEE events before and had thought them useful, so when I spotted the Selenium talk I thought I'd go along and see what I could gain from it. My previous experience with Selenium had involved the Selenium IDE for firefox and recording various scripts to be used as a very basic regression suite - intended to be ran after a new deployment to a live server to ensure that the deployment hadn't broken anything and that response times were acceptable. So, I felt my knowledge was pretty basic and that this event should broaden my appreciation of the various aspects of Selenium as a tool.

The evening was broken into 3 parts, presented by 3 people and in total lasting an hour and a half, from 6.30pm to around 8pm.

Part One was an introduction to Selenium by Gojko Adzic and introduced the concepts and associated tools. Gojko has put together a blog entry detailing all the links he mentioned, and also links to the other speakers. From this introduction I heard about a few tools I didn't know off:

  • StoryTestIQ - a mashup of Selenium and FitNesse which sounds like it is more tester friendly but with the ability to script database access for setup and teardown tasks
  • WebTest Fixtures - an extension to FitNesse that implement a customer-friendly language for web testing, utilising Selenium Remote Control

Part Two was Milan Bogdanovic, a tester from SQS-UK. This talk focussed on the Selenium IDE, which, as I mentioned above, is the only bit of Selenium I've every really played with and so I didn't gain as much from this part. I did, however, learn about the ability to use XPath expressions as the target and also got pointed at a useful Firefox extension XPath Checker to help work out the correct XPath expression for an element to check or select. I also found out about the ability to make use of the user-extensions.js file to store javascript functions and execute them via the IDE.

Part Three was Ivan Sanchez and was focussed on Selenium RC. As with Gojko he has put together a blog post of links based on his session. I knew very little about this, although I knew that Emily had made some good progress using it. There were quite a few hints and tips coming out of this session, many relating to the architecting of the tests:

  • Ideally start a new browser for each test - this ensures a clean base, but does make the process slow
  • Extract configuration details into an external properties file - otherwise, as with all other areas of development, your code ends up littered with "special" values
  • Make use of the PageObjects design pattern which presents each page as an object comprised of the services that the page offers - thus decoupling the HTML elements from the functional elements
  • Think carefully about when and how often these tests get run, as mentioned above they can be slow to execute so don't put them into a continuous integration environment to be run at each check-in, instead do them in batch overnight or a couple of times during the day
  • Consider using the Selenium Grid option to perform the tests across multiple machines to reduce the time to execute - this can also work using Amazon's EC2 service

All in all a good evening, well worth attending and I'll be keeping an eye on future events being run by Skills Matter as part of the Open Source .NET series