Selenium Q&A
Appvance, the commercial application performance management, and load test solution company, participate in the Selenium project. Many times Appvance's response to 5a customer issue is in the form of an improvement to Selenium itself. The following questions and answers originally appeared in DZone.
What exactly is Selenium?
How long has the project been around? And how long have you been using it?
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. Appvance began using Selenium in 2007. Appvance 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 an Appvance Enterprise package to run Selenium tests using the HtmlUnit headless high-performance browser. Appvance enhanced this work to make the Selenium tests data-driven, to provide root cause analysis and results in 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.
What are the basic steps involved in getting set up with Selenium? (jars/server setup etc)
Setup to record and playback tests of Web browser-based applications using Selenium take about 5 minutes. The Selenium IDE plugs into Firefox as a standard add-on using XPI installation techniques. To playback, the tests in Edge, Safari, Chrome, and other browsers require the 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.
What language is used to write the tests?
Selenium implements a domain-specific language (DSL) for testing Web applications. For example, the DSL implements a command to click a button, type characters into a text field, and wait until text appears on the page. Selenium implements the DSL as a class library in Java, package in Python, Ruby, Groovy, C#, Perl, and PHP. The DSL has approximately 200 commands. Appvance teaches a 3-day introductory class in Selenium. It takes 2-3 days for most students to become proficient in the Selenium DSL.
How well does the record/playback function work?
Selenium IDE is designed for Web 1.0 applications. In Web 1.0 environments Selenium's record/playback function works very well. For Rich Internet Applications that use Ajax techniques and widgets, not so much! Ajax is the Wild West of software development. Everything goes, there is no sheriff, and no standards body exists. Consequently, Selenium does not know how to handle asynchronous applications where objects load at their own pace and there is no "wait until idle" function. Selenium misses Javascript-driven clicks, Javascript-created frames, and pop-up windows. Each miss means the test author needs to manually add Selenium DSL commands.
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.
Is there a coverage tool that plugs into Selenium?
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 Appvance wouldn't be surprised to find coverage tools.
Are there any missing features in Selenium? Is there a new release due soon?
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 of functional and performance issues. Thankfully these are provided by many side projects in the Selenium biosphere, including Appvance, BrowserMob, SauceLabs, and others.
The words "coming soon" and Selenium is mutually exclusive. It took the Selenium project 18 months to move from "beta" to "release candidate." Appvance is optimistic but not hopeful that Selenium 2.0 with WebDriver technology will appear in 2010.