2
votes

For the life of me I cannot get SpecFlow configured to use NUnit as the test runner. NUnit is not listed in the Tools > Options > SpecFlow test runner dropdown, and the "auto" setting doesn't find NUnit.

I've tried reinstalling both NUnit and SpecFlow multiple times. Tried installing SpecFlow 1.8.1 and 1.9 to no avail. Tried using app.config. I've even tried re-installing Visual Studio 2010.

I just want SpecFlow to use NUnit (2.6.1). Can anyone help?

4

4 Answers

5
votes

Visual Studio->Tools->Extensions and updates->Online->search "Test Adapter"->install.

http://visualstudiogallery.msdn.microsoft.com/6ab922d0-21c0-4f06-ab5f-4ecd1fe7175d

better late than never.

1
votes

Try editing the config file of your unit test project:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections>
    <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
  </configSections>
  <specFlow>
      <unitTestProvider name="NUnit" />
  </specFlow>
</configuration>

Check out the config documentation here.

1
votes

SpecFlow itself does not provide a test runner and if you want to right click on the .feature and run it, you'll have to re-configure SpecFlow to use MSTest, which should use built-in VS runner.

If you want to use NUnit, then additional tools are required. I would recommend Resharper, but it's not free. This article should help you choose a way to run NUnit tests from VS.

Good luck

0
votes

To get integration with Visual Studio, you need to install the SpecFlow Extension. SpecFlow comes in 2 parts.

  1. The NuGet package contains the dlls necessary to author and run the tests.
  2. The Visual Studio Extension which gives you Intellisense, syntax highlighting, code navigation, and the ability to run tests by right clicking and choosing "Run SpecFlow Scenarios".

I am guessing you have installed the Nuget package, but haven't installed the extension.

To install the extension:

  1. Open Visual Studio
  2. Choose Tools -> Extension Manager
  3. Search for the SpecFlow extension
  4. Click install