2
votes

I have NUnit 2.5.10 and Specflow 1.8.1 installed with VS2010.

Right click on .feature file in VS, there is an item "Debug Specflow Scenarios" in context menu. But I always get "Could not find matching test runner". In Tools/Options/Specflow, there is no test runner option for NUnit.

Am I missing something?

Thanks in advance. :)

4

4 Answers

0
votes

I don't know if NUnit has a seperate GUI for running tests as i use MSTests but this should be how u do it.

  1. Setup a config file in your Test Project to tell Specflow what Test framework to use. https://github.com/techtalk/SpecFlow/wiki/Configuration
  2. The Tools > Options > Specflow > Test Runner tool is the tool that executes the Tests. The fact that nothing is showing here seems like the test runner is not installed. For example i have several, MSTest, Resharper, SpecRun, i normally leave it on Auto and just run the test from the test tool i want to use. I ran installers for these though which should add any VS extensions

You could try using the VS runner, Test > Windows > Test View

VS will just treat a Specflow test as a NUnit as the generated code behind is just an NUnit test (when configured that way). So i think the real question is how to debug an NUnit test in Visual Studio. A quick search suggested attaching the debugger to the NUnit test runner process.

0
votes

Like Ryan I also have no test runner specifically for Nunit. However since I'm also running resharper I get additional resharper runners, and that is what Auto uses to run it.

Have you actually got nUnit installed on your machine? In which case you can test how successful the process is without VS and Specflow-addin getting in the way. If not, well installing may give you the runner you need.

Alternatively, I use nCrunch to automatically run all my tests. I've had it running nunit/specflow for the last few months on multiple solutions with no issues. No need to right click at all then. :-)

0
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. Check out this article for more options to run NUnit tests from VS.

0
votes

Good day. To debug i do the following :

  1. Put a break point on the scenario line that you are interested in
  2. Make sure that you have NUnit running
  3. Attach the NUnit process
    • Go to tools
    • Select attach process
    • In the available processes select NUnit agent.exe
    • Click attach
  4. Run the test you want to debug in NUnit

Hope that helps