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.
Asked
Active
Viewed 3,479 times
7

Clive Galway
- 482
- 4
- 13
-
Related post - [Specflow error: Force regenerate steps possible?](https://stackoverflow.com/q/17167820/465053) – RBT Mar 09 '21 at 07:42
4 Answers
13
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.

Etienne Morin
- 473
- 4
- 8
-
I found that by using VS2015 this issue did not happen, I still have VS2013 installed, so I will try after the weekend to repro this on VS2013 and see if it fixes it, thanks for the input! – Clive Galway Apr 29 '17 at 12:39
-
Thinking about it, is this linked to other similar issues - eg I see this sometimes with step definition files that are in the same project. The normal fix we do is to edit the regex of one of the definitions (put a space at the end, delete it, save), but I am wondering if this may also be another solution for that. – Clive Galway Apr 29 '17 at 12:46
-
If you still can not step in after clear .cache file, you can delete all auto-generated .feature.cs files, and right click project -> "Regenerate Feature Files", and do clear .cache files again. – Steven Chou Oct 12 '18 at 01:57
1
Steps to resolve
- remove [Binding] attribute in step definition and save the file
- Again add [Binding] attribute as it is and save step definition file
- Now compile the solution hopefully it will get resolve the solution

Bhushan
- 11
- 1
1
For me, restarting Visual Studio and opening the solution again did the trick.

RBT
- 24,161
- 21
- 159
- 240
0
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.

sashoalm
- 75,001
- 122
- 434
- 781