Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specflow custom tool error when adding "Examples:"

I have this specification:

Feature: Homepage
    As a webiste user
    I want to see a pretty homepage

Scenario: Homepage Display
    Given I am on an ecommerce <website>
    When I look at the content
    Then I should see a swiper

Examples: 
| Description | website             |
| Local       | localhost:9000      |
| Development | dev.mysite.com      |

But Visual Studio 2015 won't build it says:

Custom tool error: (10:1): expected: #EOF, #TableRow, #DocStringSeparator, #StepLine, #TagLine, #ScenarioLine, #ScenarioOutlineLine, #Comment, #Empty, got 'Examples:'

If I remove Examples: it is OK.

As far as I can tell the specification looks to be the correct syntax, but I only started to explore this yesterday so I've probably made a basic error. I can right click on the scenario and generate step code OK, which all looks reasonable.

I am using, from NuGet:

  • SpecFlow 2.0.0
  • SpecFlow.MsTest 2.0.0

and from Extensions and Updates:

  • SpecFlow for Visual Studio 2015, version 2015.1.2

and I Used "Unit Test Project", Framework 4.5.1 to create my project.


What am I doing wrong?

like image 380
NikolaiDante Avatar asked May 11 '16 16:05

NikolaiDante


People also ask

Can not find custom tool SpecFlowSingleFileGenerator on this system?

Cannot find custom tool SpecFlowSingleFileGenerator If Visual Studio displays the error message Cannot find custom tool 'SpecFlowSingleFileGenerator' on this system. when right-clicking on a feature file and selecting Run Custom Tool , make sure the SpecFlow extension is installed and enabled.

How do I enable SpecFlow in Visual Studio?

To enable the extension in Visual Studio, select Tools | Extensions and Updates…, select the “SpecFlow for Visual Studio” extension, then select Enable.

How do I update SpecFlow feature file?

make sure spec flow is installed: Tools->Extensions and updates -> SpecFlow for Visual Studio 2015. set Tools->Options->SpecFlow->Legacy->Enable SpecFlowSingleFileGenerator CustomTool = TRUE. Uninstall Tools->Extensions and updates -> SpecFlow for Visual Studio 2015. Restart Visual Studio.

How do I add a feature in SpecFlow?

1) Now that you have the environment setup, you can actually use SpecFlow. To create your first feature file, you can right click on the project and select Add –> New Item... from the context menu. Select SpecFlow Feature File, give it a logical name and click on Add button.


1 Answers

Examples can only be used with Scenario Outlines. Scenario Outlines are ways to run a scenario with different data sets.

If you change Scenario to Scenario Outline your example will work:

Feature: Homepage
    As a webiste user
    I want to see a pretty homepage

Scenario Outline: Homepage Display
    Given I am on an ecommerce <website>
    When I look at the content
    Then I should see a swiper

Examples: 
| Description | website             |
| Local       | localhost:9000      |
| Development | dev.mysite.com      |

The GitHub Cucumber page has a good explanation of Scenario Outlines: https://github.com/cucumber/cucumber/wiki/Scenario-outlines

like image 57
devtony Avatar answered Oct 19 '22 07:10

devtony