Look how clean the BDD portion of the cucumber tests are, compared to something like GEB:

Cucumber:
Feature: User searches for book on Amazon.com
  Scenario: User searches for the book Cucumber
    Given a user goes to Amazon.com
    When they input the title Cucumber in the Amazon search field
    And they click submit
    Then  they should see a results list with Cucumber in the title

   Scenario: Amazon user adds The Cucumber Book to their shopping cart
     Given an Amazon user who has selected the Cucumber book
     When they click add to cart
     Then the book is added to their shopping cart

GEB:
 given: “a newly registered user”
            user = newUser(GENDER, USER_DETAILS, [country: cy, postalCode: postalC])
            def locales = [us: “US”, aa: “Austrailia”, gb: “England”, ca: “Cananda”, gr: “Germany”]
            getBrowser().reportGroup(getBrowser().reportGroup + “/” + locales[cy] + “/” + pMethod)

        when: “he attempts to purchase product #1”
            login()
            productAd.click()
            sleep 500
            $(“input#prod_price”).click(ProdPage)
            $(“input.agree-accept”).click(BillingPage)
            submitBillingInfo(paymentMethod)
                    .confirmPurchase()
                    .completeProductFlow()

…man, that’s a lot of ubly BDD code, lets just stop there.  Each of those calls goes to a class or page, that has all the core functions.  So you’re looking at lots of code and ugly BDD tests with GEB.

While GEB is readable, it’s messy.  Consider Cucumber and how clean it is.  In Cucumber all the real code is in the step_definitions.  It makes the BDD tests so nice to see and read. 

Leave a Reply

Your email address will not be published. Required fields are marked *