7
votes

I have bindings in an external assembly (As per the specflow docs here)
We need this, as we are making a generic library of Step Definitions that can be used in any of our test suites.
It works, however some specflow functionality does not appear to work.
Namely:
All steps are highlighted purple (Indicating that it cannot be matched with a binding)
If you select a step and hit F12 or right-click and select "Go To Step Definition", it says it cannot find a matching binding.
However, the code runs OK, and if you debug it, you can step from the feature file into the step definition file, so it appears that the problem is only with the Specflow plugin, not with the nuget package?
Does anyone know how to fix this?
I uploaded the test SLN used in the video here. Specflow broken Go To Step Definition enter image description here

4

4 Answers

12
votes

You need to clear your SpecFlow .cache file in your Temp folder.

In Windows Explorer, go to %TEMP% and then locate and delete your .cache file. It will have a pattern of "specflow-stepmap-[projectname].cache". Restart Visual Studio and the definitions will be recalculated and a new .cache will be created.

1
votes

Steps to resolve

  1. remove [Binding] attribute in step definition and save the file
  2. Again add [Binding] attribute as it is and save step definition file
  3. Now compile the solution hopefully it will get resolve the solution
1
votes

For me, restarting Visual Studio and opening the solution again did the trick.

0
votes

In my case SpecFlow it was because I had to build the project before I had opened the *.feature file for the first time. This happened on a freshly cloned repo, even without external assemblies.