--- cucumber version 4 Wed Feb 24 09:43:27 -0800 2010
+++ cucumber version 8 Wed Feb 01 16:39:20 -0800 2012
@@ -1,120 +1,120 @@
INSTALL
=======
INSTALL cucumber & webrat (rspec rspec-rails)
=============================================
$ [sudo] gem install rspec rspec-rails cucumber webrat
Starting from Cucumber 0.4.5 you will need the cucumber-rails gem
INSTALL DEPENDENCIES
====================
$ [sudo] gem install term-ansicolor treetop diff-lcs nokogiri
BOOTSTRAP THE APP
=================
script/generate cucumber
HOW TO USE
==========
RAILS
=====
# Generate a basic feature and its step file,
# its better to make your own!
script/generate feature post
# run your features
- rake features
+ rake cucumber
# run a specific feature
- rake features features/authentication.feature
+ rake cucumber features/authentication.feature
COMMAND LINE
============
# run a specific scenario (this scenario starts on
# line 5 of authentication.feature)
cucumber features/authentication.feature:5
SAMPLE FEATURE DEFINITION
=========================
Feature: [feature name]
In order to [goal]
As a [stakeholder]
I want [behavior]
BUILT-IN WEBRAT STEPS
=====================
Given I am on [page_name]
When I go to [page_name]
When I press "[button]"
When I follow "[link]"
When I follow "[link]" within "[parent]"
When I fill in "[field]" with "[value]"
When I fill in "[value]" for "[field]"
When I fill in the following:
| field | value |
When I select "[value]" from "[field]"
When I select "[time]" as the date and time
When I select "[datetime]" as the "[datetime_label]" date and time
When I select "[time]" as the time
When I select "[time]" as the "[time_label]" time
When I select "[date]" as the date
When I select "[date]" as the "[date_label]" date
When I check "[field]"
When I uncheck "[field]"
When I choose "[field]"
- When I attach the file at "[path]" to "[field]"
+ When I attach the file "[path]" to "[field]"
Then I should see "[text]"
Then I should see "[text]" within "[selector]"
Then I should not see "[text]"
Then I should not see "[text]" within "[selector]"
Then the "[field]" field should contain "[value]"
Then the "[field]" field should not contain "[value]"
Then the "[label]" checkbox should be checked
Then the "[label]" checkbox should not be checked
Then I should be on [page_name]
Then show me the page
Developing with Cucumber and BDD
================================
Business value and MMF
======================
You should discuss the “In order to” part of the feature and pop the why
stack max 5 times (ask why recursively) until you end up with one of the
following business values:
* Protect revenue
* Increase revenue
* Manage cost
If you’re about to implement a feature that doesn’t support one of those
values, chances are you’re about to implement a non-valuable feature.
Consider tossing it altogether or pushing it down in your backlog. Focus on
implementing the MMFs (Minimum Marketable Features) that will yield the most
value.
Outcomes and bottom-up scenarios
================================
The value provided by a system is what you can get out of it – not what you
put into it (Chris Matts said that). Just like the value is expressed at the
top of a feature (In order to…), the value should be in the steps of a
scenarios too, more precisely in the Then steps.
When you’re writing a new scenario, I recommend you start with the
formulation of the desired outcome. Write the Then steps first. Then write the
When step to discover the action/operation and finally write the Given steps
that need to be in place in order for the When/Then to make sense.
Read more about cucumber:
- * http://wiki.github.com/aslakhellesoy/cucumber
+ * http://github.com/cucumber/cucumber/wiki/
* http://cukes.info/