Follow @endyourif rss Facebook LinkedIn

Specflow Steps are not binding or show up red Specflow Steps are not binding or show up red

Published on Apr 11, 2019

I love SpecFlow, in fact I use it everyday and depend heavily on it to test my code. Blogging about my use of SpecFlow has long been on my to-do list, but for some reason I haven't got to it... On the rare occasion though Visual Studio loses my step bindings and they appear red. Luckily there is a simple fix for this.

Regenerating the SpecFlow .cache files

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."

Once SpecFlow rebuilds the .cache files everything will be back to normal.

Tags: ASP.NET MVC and Web API Tutorial | Testing | specflow

My Books
ASP.NET MVC 5 With Bootstrap and Knockout.js
Knockout.js Building Dynamic Client-Side Applications
20 Recipes for Programming MVC 3
20 Recipes for Programming PhoneGap
Rapid Application Development with CakePHP