Permalink
Browse files

Remove incidental details

  • Loading branch information...
1 parent 29bd628 commit df3f67a2f1d22bee9e98aa4de70c0756a737b9bc @jbpros jbpros committed Oct 28, 2011
Showing with 22 additions and 27 deletions.
  1. +15 −15 core.feature
  2. +1 −1 doc_strings.feature
  3. +2 −2 failing_steps.feature
  4. +4 −9 step_definitions/cucumber_stepdefs.rb
View
@@ -14,48 +14,48 @@ Feature: Core: Scenarios, Steps, Mappings
executed, and the result is communicated to the user.
Scenario: All steps passing means the scenario passes
- Given a scenario "Basic Arithmetic" with:
+ Given a scenario with:
"""
When I add 4 and 5
Then the result is 9
"""
And the step "I add 4 and 5" has a passing mapping
And the step "the result is 9" has a passing mapping
- When Cucumber executes the scenario "Basic Arithmetic"
+ When Cucumber executes the scenario
Then the scenario passes
Scenario: Failing step means the scenario fails
- Given a scenario "Basic Arithmetic" with:
+ Given a scenario with:
"""
When I add 4 and 5
Then the result is 9
"""
And the step "I add 4 and 5" has a failing mapping
And the step "the result is 9" has a passing mapping
- When Cucumber executes the scenario "Basic Arithmetic"
+ When Cucumber executes the scenario
Then the scenario fails
And the step "the result is 9" is skipped
Scenario: Pending step means the scenario is pending
- Given a scenario "Basic Arithmetic" with:
+ Given a scenario with:
"""
When I add 4 and 5
Then the result is 9
"""
And the step "I add 4 and 5" has a pending mapping
And the step "the result is 9" has a passing mapping
- When Cucumber executes the scenario "Basic Arithmetic"
+ When Cucumber executes the scenario
Then the scenario is pending
And the step "the result is 9" is skipped
Scenario: Missing step mapping means the scenario is undefined
- Given a scenario "Basic Arithmetic" with:
+ Given a scenario with:
"""
When I add 4 and 5
Then the result is 9
"""
And the step "the result is 9" has a passing mapping
- When Cucumber executes the scenario "Basic Arithmetic"
+ When Cucumber executes the scenario
Then the scenario is undefined
And the step "the result is 9" is skipped
@@ -71,7 +71,7 @@ Feature: Core: Scenarios, Steps, Mappings
Then the feature passes
Scenario: Simple flat steps
- Given a scenario "Calculate PI" with:
+ Given a scenario with:
"""
Given a calculator
When the calculator computes PI
@@ -81,7 +81,7 @@ Feature: Core: Scenarios, Steps, Mappings
Then the scenario passes
Scenario: Given, When, Then, And and But steps
- Given a scenario "Simple math" with:
+ Given a scenario with:
"""
Given a calculator
When the calculator adds up 1 and 2
@@ -93,7 +93,7 @@ Feature: Core: Scenarios, Steps, Mappings
Then the scenario passes
Scenario: Failing steps
- Given a scenario "Too simple math" with:
+ Given a scenario with:
"""
Given a calculator
When the calculator adds up 3 and 0.14
@@ -103,7 +103,7 @@ Feature: Core: Scenarios, Steps, Mappings
Then the scenario fails
Scenario: Single-parameter step
- Given a scenario "Calculate PI" with:
+ Given a scenario with:
"""
Given a calculator
When the calculator computes PI
@@ -113,7 +113,7 @@ Feature: Core: Scenarios, Steps, Mappings
Then the scenario passes
Scenario: Two-parameter step
- Given a scenario "Add two numbers" with:
+ Given a scenario with:
"""
Given a calculator
When the calculator adds up "12" and "51"
@@ -123,7 +123,7 @@ Feature: Core: Scenarios, Steps, Mappings
Then the scenario passes
Scenario: Two-parameter step failing
- Given a scenario "Add two numbers" with:
+ Given a scenario with:
"""
Given a calculator
When the calculator adds up "12" and "51"
@@ -133,7 +133,7 @@ Feature: Core: Scenarios, Steps, Mappings
Then the scenario fails
Scenario: Three-parameter step
- Given a scenario "Add three numbers" with:
+ Given a scenario with:
"""
Given a calculator
When the calculator adds up "3", "4" and "5"
View
@@ -6,7 +6,7 @@ Feature: Doc Strings
of their own.
Scenario: Step accepting a DocString parameter
- Given a scenario "Add three numbers" with:
+ Given a scenario with:
"""
Given a calculator
When the calculator adds up the following numbers:
View
@@ -4,14 +4,14 @@ Feature: Failing steps
I want to see the details about failing steps
Scenario: see exception message
- Given a scenario "Basic Arithmetic" with:
+ Given a scenario with:
"""
When I divide 10 by 0
Then the result is 9
"""
And the step "I divide 10 by 0" has a mapping failing with the message "Divide by 0, uh?"
And the step "the result is 9" has a passing mapping
- When Cucumber executes the scenario "Basic Arithmetic"
+ When Cucumber executes the scenario
Then the failure message "Divide by 0, uh?" is output
Scenario: see failing scenarios
@@ -5,9 +5,8 @@
World(CucumberMappings)
-Given /^a scenario (?:"([^"]*)" )?with:$/ do |scenario_name, steps|
- @scenario_name = scenario_name || DEFAULT_SCENARIO_NAME
- scenario_with_steps(scenario_name, steps)
+Given /^a scenario with:$/ do |steps|
+ scenario_with_steps(DEFAULT_SCENARIO_NAME, steps)
end
Given /^the following feature:$/ do |feature|
@@ -55,18 +54,14 @@
write_custom_world_constructor
end
-When /^Cucumber executes the scenario(?: "([^"]*)")?$/ do |scenario_name|
- run_scenario(scenario_name || DEFAULT_SCENARIO_NAME)
-end
-
-When /^Cucumber runs the feature$/ do
+When /^Cucumber (?:runs|executes) the (?:feature|scenario)$/ do
run_feature
end
When /^Cucumber runs the scenario with steps for a calculator$/ do
write_calculator_code
write_mappings_for_calculator
- run_scenario(@scenario_name)
+ run_feature
end
When /^Cucumber executes a scenario that increments the World variable by (\d+)$/ do |increment_value|

2 comments on commit df3f67a

Contributor

msassak replied Oct 28, 2011

You need to identify a scenario by name when you have to execute two in the same scenario. Having a convention where an unnamed scenario will just get a default name is fine, but there are other use cases for those steps.

Contributor

jbpros replied Oct 28, 2011

That's right but there is no such case in the suite so far. I've gone through each related scenario and the name of the created scenario was systematically not adding any value (well I think, correct me if I'm wrong).

I thought it was better to simplify the step definitions until we reach a real need for something more fine-grained and we'll exactly know how we express them.

Please note that I left the scenario_with_steps(scenario_name, steps) mapping signature unchanged. Therefore, there should be no impact on current implementations.

Please sign in to comment.