SpecFlow: "Step bindings are still being analyzed. Please wait."

Viewed 5413

I keep getting the same message whenever I right click a scenario and "Generate Step Definitions" or "Go To Step Definition".

It worked the first time I tried, but it hasn't since.

I've filed a bug report, but in the mean time, anyone know how to solve this?

8 Answers

Over five years later and I'm getting the same problem... Here is the solution that worked for me:

  1. Close the solution in Visual Studio.
  2. Go to your temp directory in Windows Explorer (enter %temp% in the location bar).
  3. Delete the 'specflow-blah-blah.cache' file.
  4. Reload the solution in Visual Studio, rebuild the solution and give SpecFlow a bit of time to sort itself out.

I got the the same issue when I moved external assemblies to specflow.json file from app.config

1) Turned out that I got an assembly reference which didn't even have specflow nugets.

2) I renamed one assembly, but for some reasons the old name wasn't replaces in AssemblyInfo.cs file. I changed it manually, cleaned the project. Cleaned the specflow cache (see previous answers how to do this) and it worked.

So, check if all the references and assembly names are correct.

Cheers

P.S. Don't forget to setup "Copy to Output Directory" option for specflow.json :D

If you are still unable to force the steps to bind, but just need to get to the definition of a given step:

  1. Place a breakpoint on the first step of the scenario
  2. Debug test
  3. Step into the function (F11 by default)
  4. There you are! VS navigation may not work but the debugger knows the way:)

I get this may not be a direct solution to the original issue with steps not binding, but I think it gets where the OP wanted to go...

The root cause of this issue is your code has poor performance and that cause the slowness and hangs your Visual Studio or due to low performance of code Visual studio moves in unresponsive state.

The solution is improve the performance of your code. You need to optimize your code in all the possible ways:

  1. Use less inputs in each step
  2. Use less parameters in your parametrized methods
  3. Avoid unnecessary loops
  4. Divide the number parameters into more methods if taking more than 5 parameters. It will improve the performance.
  5. Divide the input values into more sub-step or separate steps, it will improve the performance and speed of the code.
  6. Use switch case instead of if else statements if there are more cases.
  7. Free up the occupied memory if the reference variables or objects are no more of use.
  8. Read data from external sources and store them into objects or lists locally and minimize make it one time read from external source once and access the values copied locally in the lists or any other objects/variables.
  9. Close or quite the external files or call to them after use.

Hope this is the best way to improve the performance of code and this issue will not happen for sure and your steps bindings and definition will be more smooth and easy.

We fixed it like this:

  1. close Visual studio
  2. Deleted the obj and bin folders under the project(s),
  3. open Visual studio again.
  4. rebuild

After that the .feature files "came back to life"

Related