J OpenDock
J OpenDock

Reputation: 59

Specflow calling steps within steps causes “No matching step definition” error

I have the following specflow which causes a no matching step definition error. I'm not sure what is wrong with the following. Any help would be appreciated

Feature: SpecFlowFeature1

Scenario: Successful brushing
Given there is toothpaste on the brush
    And the mouth is open 
When the back teeth are brushed
    And the front teeth are brushed
Then the teeth look clean
    And the mouth feels fresh
    But the braces aren't damaged 

Upvotes: 0

Views: 1804

Answers (1)

Eric
Eric

Reputation: 58

As mentioned, it is difficult to fully know what that issue may be with your steps, but I have found at times that the caching feature for SpecFlow in Visual Studio sometimes can have issues. Assuming your step definitions are properly setup and it isn't working then you have a few options different options that are better defined at: http://brantleytec.blogspot.com/2014/08/specflow-force-step-definition-rebinding.html.

For convenience, I have copied the suggested troubleshooting to this response:

Option 1: Run Binding Tool

  1. Right-click on the feature file
  2. Select "Run Custom Tool"
  3. This causes the SpecFlowSingleFileGenerator to regenerate the code-behind for your test framework.

Option 2: Restart Visual Studio

  1. Close Visual Studio
  2. Open Visual Studio
  3. Reopen solution
  4. This causes any bindings that haven't been cached to rerun.

Option 3: Clear SpecFlow Step Mapping Cache

  1. Close Visual Studio
  2. Open Windows Explorer
  3. Type %TEMP% in Address Bar and hit Enter
  4. Search for "specflow-stepmap-*.cache"
  5. Delete those files
  6. Open Visual Studio
  7. Reopen solution

Upvotes: 4

Related Questions