Geb (pronounced “jeb”)

very groovy browser automation… web testing, screen scraping and more

Testing

Geb provides integration modules for popular testing frameworks such as Spock, JUnit, TestNG and Cucumber (via Cuke4Duke)

While Geb works great with all of these frameworks, it really shines with Spock. Spock is an innovative testing framework that is a great match for using with Geb. Using Spock + Geb gives you very clear, concise and easy to understand test specifications with very little effort.

import geb.Page
import geb.spock.GebSpec

class LoginSpec extends GebSpec {
    def "login to admin section"() {
        given:
        to LoginPage
        
        when:
        loginForm.with {
            username = "admin"
            password = "password"
        }
        
        and:
        loginButton.click()
        
        then:
        at AdminPage
    }
}

See the manual section on testing for more information on using Geb with Spock as well as other testing frameworks.