In the world of automated web testing, Selenium 2/WebDriver is the new kid on the block, but it is also arguably the most compelling web testing tool around at the moment. Selenium 2/WebDriver is the result of the merging of two popular open source web testing frameworks: Selenium 1 and WebDriver, in an effort to learn the lessons gleaned from both of these older libraries. And the teams have learned their lessons well, and come up with a slick, elegant and functional testing framework.
Selenium 2, like Selenium, is a cross-browser tool – it is equally happy to run through both Firefox and Internet Explorer. But it also works with HTMLUnit which simulates a browser by sending HTTP requests and analyzing the HTML responses. You can pick from several drivers, including HTMLUnit (which great for fast testing of more conventional web applications), as well as browser-based drivers for Firefox, Chrome and InternetExplorer. The basic API is identical, though milage will vary from one driver to another, particularly if you are testing AJAX-based applications – for example tests for some AJAX apps will work with the Firefox browser, but not with the HTMLUnit browser. The good news is that it is trivially simple to switch between drivers.
Advances in Selenium 2 allow Selenium to work more tightly with browsers, offering high fidelity emulation of interactions such as clicking and typing so companies can ensure the performance of their web applications across the diverse base of browsers in use today. Key advances include:
Support for iPhone and Android testing – Selenium 2 includes built-in Android and iPhone emulators to allow developers and QA teams to expand their use of Selenium to support the growing demand for mobile applications.
New API – The Selenium 2 API is more developer friendly and is also conceptually simpler because it directs users to focus on only two basic objects: WebDriver (browsers) and WebElements (anything on a web page) to construct tests. Selenium provides API libraries for most modern programming languages. In Selenium 2, every API library has been tailored to each programming language for easier usability.
Improved architecture – Selenium 2 now features more advanced automation bindings for each browser to provide the best, most stable way to test applications. The low-level approach that Selenium 2 uses to control browsers is a more solid base for the project to add features for currently supported browsers, and provides a better framework for supporting more browsers in the future.
Enhanced scalability – The new Selenium 2 architecture allows developers and QA teams to “scale up and down”. When a developer or QA wants to test locally on a single machine, Selenium 2 is more streamlined and “scales down” — no longer requiring the use of a background server process to control the browser from their test scripts. Therefore, simple test scenarios only call for a simplified test infrastructure. However, when teams want to run tests across multiple machines with multiple browser configurations, Selenium still retains the power necessary to handle upward scaling needs.
« GTAC 2010: Turning Quality on its Head World’s “Largest” Performance Testing Platform »