Skip to content

Instantly share code, notes, and snippets.

@jbpros
Created May 30, 2011 14:51
Show Gist options
  • Save jbpros/999006 to your computer and use it in GitHub Desktop.
Save jbpros/999006 to your computer and use it in GitHub Desktop.
Cucumber implementation-independent feature ideas
Feature: Basic feature execution
In order to do BDD
As a cucumber afficionado
I want to run basic cucumber features
# 1. Not abstract enough: first step is language dependent
Scenario: Simple flat steps
Given the following step definition:
"""
When(/a step passes/, function() {
callback();
});
"""
When I run the following feature:
"""
Feature: Simple flat steps
Scenario: Simple flat step
When a step passes
"""
Then the feature should have run successfully
# 2. Language dependence is gone, that's better. But specifying a
# whole feature source each time seems a bit redundant between
# scenarios.
Scenario: Simple flat steps
Given a step definition matching /a step passes/
When I run the following feature:
"""
Feature: Simple flat steps
Scenario: Simple flat step
When a step passes
"""
Then the feature should have run successfully
# 3. Redundancy between scenarios is gone and the useful statement
# from step 2 (i.e. the name of the called step) is not lost.
# Note: I didn't include the "When" keyword in the name of the
# step for briefness, it could be there of course.
Scenario: Simple flat steps
Given a step definition matching /a step passes/
When I run a feature with a step called "a step passes"
Then the feature should have run successfully
# 4. Highest level of abstraction.
Scenario: Simple flat steps
Given a passing step definition
When I run a feature using the step definition
Then the feature should have run successfully
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment