Testing intuitive and highly responsive systems is a big challenge. Tools like Quick Test Professional were not fully equipped to handle AJAX/GWT based applications. Selenium WebDriver, an open source automation framework, quickly became the choice of automation engineers. Cost effective (no licensing fee), ready for AJAX/GWT based web applications and a rich framework to handle scenarios introduced by modern web UI are some of the key benefits.
Modern GWT/Ajax based applications have a UI that gets updated dynamically by making asynchronous requests to the server. These requests result in the view (widget/page content) to be updated. Changes to the view are done through DOM manipulation. Using DOM manipulation, new rows can be added to a table dynamically (like new mail in Gmail Inbox or building a table to display search results).
Keeping the dynamic nature of web applications in mind, here are some key points to consider when automating GWT/Ajax applications using WebDriver.
Page Object Model
In order to make automation scripts easy to maintain and easy to read, page object model can be used. WebDriver has an inbuilt support for this model.
In a page object model, a java class is written to model a particular page/UI. This class contains dedicated methods to identify and manipulate each UI control on a page. This allows a framework designer to hide implementation details, and at the same time makes the code reusable and readable.
Example: Normally, WebDriver script for entering login name would look like:
txtLogin = driver.findElement(By.Name(“editLogin
I love reading, especially reading between the lines. I love to observe, especially, that is yet to occur. I love when I find exceptions, if I don't find one, I cause one. That's me - Suyog