I'm Daniel Anjos, a Web Tester in Aqris In this short talk, we will see a little of - what is Selenium - Past (what problems selenium came to solve) - Present (problems of today, problems of selenium) - Future (problems of tomorrow, Selenium 2.0)
Selenium is a Open Source suite of tools to automate web app testing across many platforms, Created in 2004 by Jason Huggins Goal: testing tool that can test JavaScript UI features in all browsers on all platforms - Selenium Core is pure DHTML/JavaScript that controls your browser - Selenium IDE is a Firefox add-on that makes it easy to record and playback tests in Firefox. You can even use it generate code to run the tests with Selenium Remote Control - Selenium RC is a client/server system that allows you to control web browsers locally or on other computers, using almost any programming language and testing framework - Selenium GRID runs RC tests on many servers at the same time, cutting down on the time it takes to test multiple browsers or operating systems.
Don't worry if you got lost. The basic is: - Selenium core is the javascript that controls your browser (under the hood) - Selenium IDE is the Firefox plugin (image on left) - Selenium RC is a tool to control your browser with a programming language (right) - Selenium GRID is just like RC, but running tests in parallel (at same time)
These are some of the companies that adopted Selenium (on some extent) Google and ThoughtWorks also contributes to the OS code improving the tool
Let's make a brief overview of the history of Web Frameworks: Before the year 2000, everything was more simple. Simple server-side architecture (Perl, ASP , PHP …) Only 2 main browsers
From 2000 – 2003, you have - more Internet browsers (Opera, Safari, Firefox 2004) - DHTML / Javascript to make Rich Client – Interactive Web Pages - Very different javascript support from browsers
The problems that Selenium came to solve (2004) for Web Development: - Web 1.0 = Very different support of HTML / Javascript - Multiple OS compatibility - Multiple Browser Compatibility - Testers want to use different languages to automate tests
To tackle this problems with Selenium, you can start by using the Selenium IDE to practice, record the test structure, replay and modify it.
As you feel confident, you may move to Selenium RC with a programming language As the test base grows, use refactoring to improve test readability. After some time, some problems appear with this approach: - Code inconsistency (Helpers/Selenium) - Duplication - Hard to change / maintain
Going forward in time, you can see - Increase of web frameworks - Adoption of Javascript (AJAX) - Development of Rich Internet Applications (RIA) - Development of Rapid Application Development (RAD)
Today the web is composed of many different frameworks, with many browsers for many different versions of OS. This is a much more complex scenario
So, what changed since 2004? What are the problems we face today? - Web 2.0 - Adoption of AJAX
Also, different development methodologies since the Agile Manifesto (2001): - XP, Scrum, Kanban, Lean... - Fast changes
Today, there are several strategies to cope with this problems using selenium: - Good automated test structure (Java or any other language) - Page Object Design Pattern For more on page objects, see: http://www.aqris.com/display/DEV/2010/02/05/PageObjects+and+how+to+make+functional+tests+fun!
Selenium has its limits, and its problems, as any tool. - Poor interaction with dialogs (alerts) - Basic authentication is enforced in dialogs in modern browsers - Complex AJAX - Handling Browser crashes This problems come from the basic architecture of selenium (Javascript)
There are also some new problems that we will have to handle soon: - Rich Internet Applications written in HTML5 / Adobe Flex / Silverlight or JavaFX - Cloud computing (Amazon, Google, …) - New platforms: Mobile, Netbooks, TVs, Video Games,
From the version 2.0, WebDriver and Selenium are merging. Webdriver addresses some shortcomings in selenium (by being able to bypass the JS sandbox, for example. And we’ve got a gorgeous API), Selenium addresses some shortcomings in webdriver (such as supporting a broader range of browsers) You should investigate webdriver: * Mult-browser testing (functionality for browsers not well-supported by Selenium 1) * Handling multiple frames, multiple browser windows, popups, and alerts. * Page navigation * Drag-and-drop * AJAX-based UI elements
Still, there always will be problems that the tools cannot solve. What should be automated? Bugs / Features / Main Path / Corner cases When to stop automating? How much is enough? Who writes the automated tests, developers or testers? For whom are the automated tests? QA team, Business representative (acceptance)
Thank You Any questions?
The sources of some of the works included in this talk, and some other good sources too