Feature files lose track of step bindings

14,995 views
Skip to first unread message

timhardy

unread,
Dec 5, 2013, 1:08:12 PM12/5/13
to spec...@googlegroups.com
When I'm in a feature file, the Gherkin phrases lose track of their step bindings.  They turn the color indicating there's no matching binding, and selecting "Go to Definition" pops up a dialog with "No matching step definition found for this step!"  Only, there is a matching definition, and everything was working fine for months, but the VS plugin just now lost track of the binding.  The tests can even run and succeed just fine.

It does seem to be limited to steps that are defined in other files though.  If I have an Activities.feature file with an ActivitiesSteps.cs file, the steps defined in ActivitiesSteps show up as bound.  Any steps in CommonSteps.cs or elsewhere are the ones that do not show up as bound.  All of these files are in the same test project.

Let me reiterate, this does not always happen.  Everything was working great for awhile, then it just kicks in.  It started immediately for a coworker who we got up and running with VS and Specflow, and it just started happening to me recently after not seeing any issues for months.  Restarting VS doesn't fix it.  Re-running the custom tool for feature files doesn't fix it.

I'm starting to see this happen more consistently, but it does not always happen.  Once it starts, however, it seems to always happen.  Any clues on how to fix it will be greatly appreciated.  As the number of our specs grows, using the Go to Definition feature has become invaluable, but now it's useless.


timhardy

unread,
Dec 5, 2013, 1:12:19 PM12/5/13
to spec...@googlegroups.com
I'm using Visual Studio 2012, btw, with SpecFlow 1.9.2.

Craig Shea

unread,
Sep 1, 2014, 2:56:17 PM9/1/14
to spec...@googlegroups.com
Not to resurrect a possibly dead thread, but I had a similar experience recently using SpecFlow 1.9.3 and VS2013 Premium. In my case, I had begun defining StepDefinition methods in a file. I decided to move the file to a folder within the project. After moving the file, the feature file showed all scenario steps as "unbound". Furthermore, in my case, when I clicked "Go to definition", SpecFlow was telling me that there were 2 (or more) definitions avaliable and it was taking me to the first one. However, it wouldn't go anywhere. That's because the first one no longer existed (I moved it, afterall!).

The solution was annoying, but simple. Close the feature file and re-open it. SpecFlow found all the step definitions in their new location and the scenario blocks were properly highlighted to indicate this.

HTH.

Danny Woolston

unread,
Nov 24, 2014, 3:29:54 AM11/24/14
to spec...@googlegroups.com
I am too experiencing this same issue, closing and opening doesn't solve my issue also reinstalled spec flow no joy, a colleagues machine can see open them and see the mappings just fine which is very frustrating.

Any advice would be appreciated. 

Rob Huson

unread,
Jan 14, 2015, 11:01:36 AM1/14/15
to spec...@googlegroups.com
I have had this issue before too, here is how I (eventually) resolved 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."

Sap S

unread,
Apr 12, 2017, 5:12:30 AM4/12/17
to SpecFlow
Thanks a lot Rob - your advice worked :)

Mohan Kumar

unread,
May 11, 2017, 3:46:27 AM5/11/17
to SpecFlow
Thanks a lot Rob..Your advice worked for me too !! Thanks a ton !!

Indranil Das

unread,
Jun 6, 2017, 11:13:14 AM6/6/17
to SpecFlow
Thanks Rob. It worked for me.

Regards,
Indranil Das.

Sukriti Kumari

unread,
Jun 16, 2017, 12:23:33 AM6/16/17
to SpecFlow
I tried all possible option mentioned but it did not work for me

Alexey Kozlov

unread,
Nov 27, 2017, 9:21:27 AM11/27/17
to SpecFlow
Yes, this helps, only not %TEMP% but %userprofile%\appData\local\Temp

среда, 14 января 2015 г., 19:01:36 UTC+3 пользователь Rob Savage написал:

Shane Williamson

unread,
Mar 19, 2018, 6:50:13 AM3/19/18
to SpecFlow
Many thanks, solution still working in VS 2017 and latest version of SpecFlow.


On Wednesday, January 14, 2015 at 11:01:36 AM UTC-5, Rob Savage wrote:

Asier Leizea

unread,
Nov 15, 2019, 3:09:55 AM11/15/19
to SpecFlow
Thanks Rob. Your solution worked for me!
Message has been deleted

Antonio Chiong

unread,
Jun 2, 2020, 11:46:39 AM6/2/20
to spec...@googlegroups.com
have you tried the deleting the Specflow files in  %temp% described here?  https://specflow.org/documentation/Troubleshooting/

On Mon, Jun 1, 2020 at 6:53 AM khushboo guru <krithi...@gmail.com> wrote:
--
You received this message because you are subscribed to the Google Groups "SpecFlow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to specflow+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/specflow/a1d8170d-b118-4cd3-a1a4-928f36e1cfb7%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages