I am getting this error: "Ambiguous Step Definition Found For Step...." on running my Specflow Test. The code is for the client that I am working for, thus I am not permitted to provide code sample.

However, let me give you a background into what I am doing and the particular issues that I am running into at the moment.

The code is referring to a Given statement in my Feature File. I have checked this website and searched over the Internet as well for possible solutions.

So far, I have found some pointers but no solution yet. They are:




Thank you.

  • May be it is worth providing some representative example that does not resemble the real code but spots the same issue? – Alexey R. Jan 31 '18 at 9:04
  • @AlexeyR... Thanks for the comment. What I have in the Steps Definition File is: [Given(@"I have GMail Account")] public void GivenIHaveGMailAccount() { ScenarioContext.Current.Pending(); } – OA345 Jan 31 '18 at 9:09
  • I have edited the code so that it is not a replica of the code that I am working on. Thanks – OA345 Jan 31 '18 at 9:11

Specflow generates nunit tests from the gerkhin feature files by generating a code behind file. This process is often quite sketchy and sometimes creates broken files. If you delete the .cs file with the same name as the .feature file it should get regenerated.

Be aware that specflow doesn't work on dotnet core , only framework.

It doesn't work particularly well in anything that isn't visual studio either.

I have often spent hours chasing whitespace around to ensure that the regexes that are used to match the steps work correctly. If you are having trouble with these I would recommend pasting them into regex101.com with the subroutine names, this site will explain what the regex matches in the context of the example data you give it.

  • Thanks for the response. I have deleted the file, but I have not been able to re-generate it. I tried re-starting and refreshing the project. It still does not generate the file. Your thoughts are welcome. Thank you – OA345 Feb 2 '18 at 10:43
  • Right click the feature file , run special tool – Amias Feb 2 '18 at 11:07
  • That worked with generating the file. Thanks. However, I am writing the implementation in F#. So, that seems to have been the cause of the error. Many Thanks! – OA345 Feb 2 '18 at 15:58
  • Specflow doesn't work with f# afaict – Amias Feb 2 '18 at 17:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.