I have the following (Gherkin) scenario outline (using Specflow v1.9):
Scenario Outline: Add section title to report
Given I have "<section titles>" in a form:
When I edit the layout of the XX page
Then I should see the "<section titles>" as available columns for customizing the layout
When I add "<section titles>" to the list of selected columns
And save the changes
Then the "<section titles>" are added to the report
And shows a color-coded view of the total applicant score categorized as follows:
| score_min | score_max | color |
| 0 | 25 | red |
| 25 | 75 | yellow |
| 75 | 100 | green |
Examples:
| section titles |
| MyTitle1 |
| MyTitle2 |
However, in the last "And" step definition, the table is never passed in the argument. Here's the code that is generated by Specflow:
[Then(@"shows a color-coded view of the total applicant score categorized as follows:")]
public void ThenShowsAColor_CodedViewOfTheTotalApplicantScoreCategorizedAsFollows()
{
//Note missing 'Table' in argument
ScenarioContext.Current.Pending();
}
However, the autogenerated feature file's code-behind seems to have this table, but it's not part of my step definition:
#line hidden
TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
"score_min_percentage_equal_to",
"score_max_percentage_less_than_or_equal_to",
"color"});
table1.AddRow(new string[] {
"0",
"25",
"red"});
table1.AddRow(new string[] {
"25",
"75",
"yellow"});
table1.AddRow(new string[] {
"75",
"100",
"green"});
#line 14
testRunner.And("shows a color-coded view of the total applicant score categorized as follows:", ((string)(null)), table1, "And ");
#line 19
It looks like there "should" be a table argument for the step definition, but it seems to be missing when the steps are generated. What am I missing?
UPDATE: 5/13/2016: The bug was raised and resolved by the Specflow devs: https://github.com/techtalk/SpecFlow/issues/487
Table applicantScoreTable
argument to the method signature. – AutomatedChaosScenario Outline
is used and there is anExamples
table present. The location of the step with a normal table doesn't matter, it does not have to be the last step before theExamples
table and can be a Given, When or Then step or And/But placeholder. – AutomatedChaos