Specflow error: Force regenerate steps possible?

Ibexy I picture Ibexy I · Jun 18, 2013 · Viewed 31.7k times · Source

Is it possible to "force" regenerate step definitions for a specflow feature file? I have created this feature file but cannot generate all steps. Am getting a message that all steps are already bound but when I run the test, I get an error that the same steps are not bound. I have cleared everything and recreated both feature and step definition but now I cant event generate ALL the steps because specflow says they are bound already.

Answer

Ryan Lundy picture Ryan Lundy · Feb 3, 2014

SpecFlow creates a .cache file in your Temp folder that holds these bindings to speed things up. If that file gets out of whack, you can delete it:

  1. Exit Visual Studio.
  2. Open Windows Explorer.
  3. In the address bar, type %TEMP% and hit Enter to go to your temp folder.
  4. Find the files whose names start with "specflow-stepmap-YourProjectName" with a .cache extension.
  5. Delete those files.
  6. Start Visual Studio again.

If you do this, it'll take a little time for SpecFlow to regenerate the bindings. Until this is done, if you right-click on a step and select "Go To Step Definition", Visual Studio will reply "Step bindings are still being analyzed. Please wait."

I most commonly use this for the opposite case, where SpecFlow shows that nothing is bound even though the steps exist. But I think it's likely to work for your case as well.