Meet the Author of the Selenium Refcard
Meet the Author of the Selenium Refcard
Join the DZone community and get the full member experience.Join For Free
Get the Edge with a Professional Java IDE. 30-day free trial.
Recently DZone released the Selenium Refcard, written by Frank Cohen. Selenium seems like a vital tool for test driven development of web applications. I spoke with Frank to find out more about Selenium, how it all works and what we can expect from it in the future.
DZone: Can you introduce yourself please?
Frank Cohen: I am the CEO and Founder at PushToTest, the open source application performance management and load test solution company. I am author of books on the topic of scalability and performance in Rich Internet Applications, Service Oriented Architecture, and Business Process Management applications. I often speak and write how-to and best practice articles to the software developer, tester, and operations manager communities. I am the maintainer of the TestMaker open source test (OST) platform. TestMaker repurposes Selenium tests to be load and performance tests. This is an entirely new approach to testing that saves organizations time, energy, and budget in their pursuit of avoiding service outages and bad customer experiences.
DZone: What exactly is Selenium?
DZone: How long has the project been around? And how long have you been using it?
Frank Cohen: Selenium had its start at ThoughtWorks, a system integrator and global consulting firm. The core developers released Selenium into an open source distribution in 2006. I have been using Selenium since 2007. I was looking for a way to repurpose Selenium tests as load and performance tests, and business service monitors when Olivier Dony and Dominique de Waleffe contributed a TestMaker package to run Selenium tests using the HtmlUnit headless high performance browser. We enhanced this work to make the Selenium tests data-driven, to provide root cause analysis and results analysis functions, to provide compatibility to test Ajax applications, and to run these tests in a Cloud testing Environment. This has been hugely beneficial to organizations needing to reduce costs and take advantage of Selenium's easy-of-test-authoring features.
DZone: What are the basic steps involved in getting setup with Selenium?
Frank Cohen: Setup to record and playback tests of Web browser-based applications using Selenium takes about 5 minutes. The Selenium IDE plugs into Firefox as a standard add-on using XPI installation techniques. To playback the tests in Internet Explorer, Opera, Safari, Chrome and other browsers requires installation and configuration of Selenium RC. Selenium RC uses a daemon architecture. Start the daemon using a simple command-line call to start Java and run the Selenium RC JAR package. Selenium RC installations take an hour or less. Selenium Grid installs Selenium RC services on a farm of servers.
DZone: What language is used to write the tests?
Frank Cohen: Selenium implements a domain specific language (DSL) for testing Web applications. For example, the DSL implements commands to click a button, type characters into a test field, and wait until text appears in the page. Selenium implements the DSL as class library in Java, package in Python, and Ruby, Groovy, C#, Perl, and PHP. The DSL has approximately 200 commands. PushToTest teaches a 3-day introductory class in Selenium. It takes 2-3 days for most students to become proficient in the Selenium DSL.
DZone: How well does the record/playback function work?
Selenium IDE record/playback does not work well for tests that require looping and conditional branching. These are possible by manually coding Selenium DSL commands in a Java or other scripting language environment. The solution is to use Selenium IDE's record feature to create simple test use cases, transform them into a Java class, and treat each use case as a component incorporated into a test suite. There are emerging frameworks to help implement a component approach to Selenium test authoring.
DZone: Is there a coverage tool that plugs into Selenium?
Frank Cohen: ThoughtWorks Twist is a tool to facilitate a continuous test and integration methodology built on Selenium tests in a team-oriented development environment. There may be others. There is a lot of excitement and energy in the Selenium space so I wouldn't be surprised to find coverage tools.
DZone: Are there any missing features in Selenium? Is there a new release due soon?
Frank Cohen: A key drawback is Selenium's requirement to playback tests in a real browser. When the browser needs to interact with a user the Selenium test stops running. For example, when a browser moves from an HTTPS secured page to an HTTP page many browser's security policy kicks in and the browser asks the user to confirm the action. The Selenium project is working on a next generation technology called WebDriver. WebDriver uses each browser's native API to operate the test commands.
Selenium lacks a data production library system to provide operational test data, lacks a way to repurpose tests into load tests, lacks a platform to manage Selenium tests as test assets, and lacks a way to derive the root cause to functional and performance issues. Thankfully these are provided by many side projects in the Selenium biosphere, including PushToTest, BrowserMob, SauceLabs, and others.
The words "coming soon" and Selenium are mutually exclusive. It took the Selenium project 18 months to move from "beta" to "release candidate." I'm optimistic but not hopeful that Selenium 2.0 with WebDriver technology will appear in 2010.
Opinions expressed by DZone contributors are their own.