Making Web Tests Readable, Robust and Rapid

Tutorial: Groovy Functional Testing with Geb - Part 2


What is Geb?

Despite the focus of this article, it is important to establish straight away that Geb (pronounced “jeb”) is a browser automation tool, not a testing tool. Geb can be used to programmatically automate a web browser for any purpose whatsoever; it just so happens that web testing is the most common need the average programmer has for browser automation.

Geb is built on top of the WebDriver browser automation library, which is the successor to the popular Selenium Remote Control (RC) testing framework. Unlike the original Selenium RC, which uses JavaScript to interact with page content and control the browser, WebDriver utilizes native browser drivers to perform its automation. This is an important distinction for purposes of web testing—using Geb and WebDriver gives you the assurance that your application is behaving correctly in the browsers you test it on. It also provides access to browser commands that are simply inaccessible without native driver support.

What sets Geb apart from just using WebDriver on its own? From Geb’s home page: “It brings together the power of WebDriver, the elegance of jQuery content selection, the robustness of Page Object modeling and the expressiveness of the Groovy language.” Furthermore, Geb provides first class support and integration with common testing frameworks and build tools, including JUnit, Spock, Grails, Maven and Gradle.

It should be noted that Geb’s user manual is top notch; any developer looking for more examples, detailed API documentation or setup guides would be well advised to check it out.


Ellery Crane

What do you think?

JAX Magazine - 2014 - 06 Exclucively for iPad users JAX Magazine on Android


Latest opinions