ZagNut
ZagNut

Reputation: 1451

NUnit not specified as test runner for SpecFlow

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?

Upvotes: 2

Views: 7304

Answers (4)

user2282496
user2282496

Reputation: 235

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.

Upvotes: 5

Chris Edwards
Chris Edwards

Reputation: 8720

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

Upvotes: 0

Void Ray
Void Ray

Reputation: 10219

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

Upvotes: 1

Jason Evans
Jason Evans

Reputation: 29186

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.

Upvotes: 1

Related Questions