Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do my SpecFlow tests not show up in Visual Studio Test window?

I have gone through the Getting Started tutorial for SpecFlow. Everything worked fine except that I have the @SpecRun test because I have not entered a demo key.

But in our main project we use NUnit instead of SpecFlow+ Runner. So I tried to mimic that project. If you use NUnit you won't need the demo key. So I changed the Unit Test Provider to:

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

I also compared my tutorial references to the main project's references. I find that I can take out TechTalk.SpecRun and the project will still compile. Of course TechTalk.SpecFlow is needed.

If I take out SpecRun.SpecFlowPlugin, no tests show up except @SpecRun which is the tests delay without the demo key.

I also see in the main project a csharp file called: SpecFlowNUnitExtension.cs. I brought in this file but my tests still do not show up in the Visual Studio Test window. Is there something I need to do to register this file?

like image 446
Sam Avatar asked Aug 15 '16 13:08

Sam


2 Answers

You need a test runner adapter for Visual Studio to get the tests in the test explorer. They are distributed by NuGet packages. Add the package for your test runner to your test project.

  • SpecFlow+Runner: SpecRun.Runner
  • NUnit2: NUnitTestAdapter
  • NUnit3: NUnit3TestAdapter
  • XUnit: xunit.runner.visualstudio
  • MsTest: no additional adapter needed
like image 87
Andreas Willich Avatar answered Nov 15 '22 11:11

Andreas Willich


Update your NUnit Test Adapter to NUnit3 Test Adapter. Restart Visual Studio and rebuild the tests should show up.

like image 38
codester Avatar answered Nov 15 '22 10:11

codester