Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specflow Binding from External Assembly always purple

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

like image 839
Clive Galway Avatar asked Apr 20 '17 19:04

Clive Galway


People also ask

What is binding attribute in SpecFlow?

The automation that connects the specification to the application interface has to be developed first. The automation that connects the Gherkin specifications to source code is called a binding. The binding classes and methods can be defined in the SpecFlow project or in external binding assemblies.

Can not find custom tool SpecFlowSingleFileGenerator?

Cannot find custom tool SpecFlowSingleFileGenerator To enable the extension in Visual Studio, select Tools | Extensions and Updates…, select the “SpecFlow for Visual Studio” extension, then select Enable.

What language does SpecFlow use?

SpecFlow tests are written using Gherkin, which allows you to write test cases using natural languages. SpecFlow uses the official Gherkin parser, which supports over 70 languages.


1 Answers

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.

like image 115
Etienne Morin Avatar answered Oct 18 '22 00:10

Etienne Morin