Problems with Scenario Outlines in SpecFlow

815 views
Skip to first unread message

David Razzetti

unread,
Aug 20, 2015, 5:18:05 AM8/20/15
to SpecFlow
Hello,
Something has broken in SpecFlow recently.  Steps associated with tables in Scenario Outlines no longer get given Table parameters when the step definitions are generated.
I am using Visual Studio 2013 Update 5 along with Specflow for Visual Studio 2013 version 2015.1.2.

Here is a simple feature file that demonstrates the problem.  Ignore the fact that the features themselves are meaningless:

Feature: MyFeature
In order to write good code
As a developer
I want SpecFlow to work properly so that I can develop using BDD.

@mytag
Scenario: Scenario with a table
Given I have entered into the calculator
| Hello | Goodbye |
| Mum   | Dad     |
And I have entered 70 into the calculator
When I press add
Then the result should be 120 on the screen

Scenario Outline: Scenario outline with tables
Given a table
| Leg1         | Leg2         | Leg3         |
| <Leg1Values> | <Leg2Values> | <Leg3Values> |
And an automatic polisher
| RPM | Voltage | Grade        |
| 600 | 250     | 200WetAndDry |
When I sit on the table
Then the table does not break
Examples: 
| Leg1Values | Leg2Values | Leg3Values |
| 2          | 250        | 405        |
| 2          | 250        | 406        |

Scenario: Doing stuff
Given stuff
When I do stuff
Then stuff happens

In the first scenario, the step "Given I have entered into the calculator" causes a step definition method with a Table parameter to be created when the step is generated.  This is as expected:

        [Given(@"I have entered into the calculator")]
        public void GivenIHaveEnteredIntoTheCalculator(Table table)
        {
            ScenarioContext.Current.Pending();
        }

In the second scenario, the step "Given a table" causes a step with no parameters to be generated.  This is incorrect:

        [Given(@"a table")]
        public void GivenATable()
        {
            ScenarioContext.Current.Pending();
        }

The step should have a Table parameter as before.  When the scenario is executed, a SpecFlow binding exception is thrown.

TechTalk.SpecFlow.BindingException : Parameter count mismatch! The binding method 'MyFeatureSteps.GivenATable()' should have 1 parameters

The same problem occurs with the step "And an automatic polisher".  This issue is reproducible on three different development PCs within my team running SpecFlow for Visual Studio 2013 version 2015.1.2.  It is also present on a PC with the previous version of the add-in (1.9).
This used to work properly.  I have not been able to isolate a cause.
Can anybody else reproduce this issue?
Does anyone know of a work-around, short of manually adding the missing Table parameters following the generation step?

Regards
David Razzetti

David Osborne

unread,
Aug 27, 2015, 10:53:39 AM8/27/15
to SpecFlow
I've noticed this also. The only work-around I have is to manually edit the step and add the table parameter.

Darren Cauthon

unread,
Aug 27, 2015, 8:37:56 PM8/27/15
to SpecFlow
Id recommend taking this to GitHub.
Reply all
Reply to author
Forward
0 new messages