Test Cleanliness – GEB vs Cucumber

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

Feature: User searches for book on
  Scenario: User searches for the book Cucumber
    Given a user goes to
    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

 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”
            sleep 500

…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. 

What do you think?

0 points
Upvote Downvote

Total votes: 0

Upvotes: 0

Upvotes percentage: 0.000000%

Downvotes: 0

Downvotes percentage: 0.000000%

Written by Admin

I work for a Telecom company writing and testing software. My passion for writing code is expressed through this blog. It's my hope that it gives hope to any and all who are self-taught.


Leave a Reply


Cucumber set up and sample test

Video of Cucumber Test Running