Run Specflow with Xunit but gives error nunit.framework
I ran into this before but found that my problem was a mismatch between the feature text vs. the signature in the step, e.g.
Feature text:Given I have a widget id "123"
Step signature:Given I have a widgetid "123"
Ensuring all feature texts and step signatures matched solved the problem for me.
I don't know why the error was about a missing nunit dependency though, since I was using xunit.
So, I had this happen to me. It was a self-inflicted wound, as it turned out.
The problem was that, in a post-build event, I was copying the config file from the application under test to be the config file of the test project. In the post-build event for the app, I had this line, which copies the config to the Tests folder.
copy "$(ProjectDir)"\App.config "$(SolutionDir)"\ReleaseImagesWreckersTests\App.Config
The config file being copied from the application under test did not have the lines in them that tell SpecFlow to use xUnit. The copy was occurring before the SpecFlow tests were being built.Eventually, I figured it out and added these lines to my app.config for the application (assembly) under test:
<specFlow> <unitTestProvider name="xUnit" /> </specFlow></configuration>
After doing that, everything worked fine. The app under test was building successfully and then copying its config, with no specFlow section, over the top of the test assembly's config, which had the proper specFlow section before getting copied over.