Cucumber Setup and Excution command

To install Cucumber, first add the cucumber-rails gem and a utility gem called database_cleaner to the :test group in the Gemfile

.
.
group :test do
  .
  .
  .
  gem 'cucumber-rails', '1.4.0', :require => false
  gem 'database_cleaner', github: 'bmabey/database_cleaner'
end
.
.

Then run these two following commands in your project directory through terminal:

  $ bundle install
  $ rails generate cucumber:install

This creates a features/ directory where the files associated with Cucumber will live.

Example cucumber feature:
In features/signing_in.feature

Feature: Signing in

  Scenario: Unsuccessful signin
    Given a user visits the signin page
    When he submits invalid signin information
    Then he should see an error message

  Scenario: Successful signin
    Given a user visits the signin page
      And the user has an account
    When the user submits valid signin information
    Then he should see his profile page
      And he should see a signout link

To run the features, we use the cucumber executable:

  $ bundle exec cucumber features/

OR

  $ bundle exec rake cucumber

Ref: http://ruby.railstutorial.org/chapters/sign-in-sign-out#sec-installation_and_setup

——————————-In progress———————-
Cucumber books:
http://www.amazon.com/gp/product/1934356379
http://www.amazon.com/gp/product/1934356808

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s