2
votes

I was cleaning up an inherited test automation project and fixed some spelling errors in scenario names in a SpecFlow feature file, then started receiving this error:

CS1029
#error Generation error: Interface cannot be resolved: TechTalk.SpecFlow.Generator.UnitTestProvider.IUnitTestGeneratorProvider('custom')

There is no customer unit test provider.

Things I have tried:

Now, all my feature files are showing that error, not just the one I fixed spelling errors in. I'm using VS2015. Any ideas what could cause this error?

2
Do you have any custom plugins? Could you post your complete specflow section of the app.config?Andreas Willich
And which version of SpecFlow+ are you using?Andreas Willich
@AndreasWillich, Per below, was using 2.2, reverted back to 2.1 and the problem went away. The app.config section looks like this: <specFlow> <unitTestProvider name="MsTest.2010" runtimeProvider="TechTalk.SpecFlow.UnitTestProvider.MsTest2010RuntimeProvider,TechTalk.SpecFlow" /> <!-- For additional details on SpecFlow configuration options see go.specflow.org/doc-config --> </specFlow>Kevin McDowell

2 Answers

1
votes

In the app.config, make sure the unit test provider name you're using corresponds to an actual test framework. Ex:

<specFlow>
   <unitTestProvider name="nUnit" />
</specFlow>

My suspicion is that the tests were generated using a valid app.config, but the app.config is no longer valid. When you changed the feature file(s), it caused it to attempt to regenerate the tests using an invalid test framework provider name, leading to the error message you're seeing.

1
votes

This seems to be some issue with corruption of SpecFlow 2.2 feature files.

With 2.2, deleting and recreating the feature files did not solve the problem. Reverting to 2.1 did.

After reverting to 2.1, the errors still occurred UNTIL I deleted the feature file then recreated it. I had 8 feature files, all reporting the error. After deleting and recreating each one, all 8 errors went away.