3

I have SpecFlow tests in a Visual Studio project and I'd like to get code coverage for those tests.
The thing is that I can't seem to get SpecFlow tests listed in Visual Studio Test Explorer for some reason, which is a prerequisite for running Visual Studio provided code coverage.
Just as a note, all other tests (regular and not SpecFlow) from other test projects are listed in the test explorer.

So, effectively, this question comes to:
How to get SpecFlow tests listed into Visual Studio Test Explorer window?

dragan.stepanovic
  • 2,955
  • 8
  • 37
  • 66
  • Which testrunner are you using? NUnit, XUnit, SpecFlow+Runner/SpecRun? – Andreas Willich Feb 26 '16 at 11:34
  • I'm using: NUnit v2.6.4, SpecFlow v2.0.0, SpecFlow.NUnit v1.1.1, SpecRun.Runner v1.3.0 – dragan.stepanovic Feb 26 '16 at 12:35
  • As you are using SpecRun as Unit Test Runner, did you have a look at http://www.specflow.org/plus/documentation/Configuring-SpecFlowPlus-Runner-Visual-Studio-Test-Explorer-Integration/ Could you post your app.config and SRProfile-Files? – Andreas Willich Feb 26 '16 at 12:52
  • ` ` this is present in App.config file of the unit test project that contains SpecFlow tests – dragan.stepanovic Feb 26 '16 at 14:11
  • 1
    Ok, so you are using NUnit as Unit Test Runner. The Visual Studio Test Explorer does not support NUnit tests without special Test Adapater. – Andreas Willich Feb 26 '16 at 14:56
  • I've tried with as well, but didn't work out. Also, I have NUnit Test Adapter installed as VS extension. What do I need to do? – dragan.stepanovic Feb 26 '16 at 15:00
  • Specflows tests are no different from any other tests (specflow is a unit test generation tool). Can you get nunit tests displayed in the test explorer without specflow involved. I think when you solve that problem, the specflow tests issue will be solved... – Sam Holder Feb 26 '16 at 16:37
  • This help you my be? http://stackoverflow.com/questions/24897979/getting-list-of-tests-from-test-explorer-in-vs – Jan Regent Feb 27 '16 at 06:19
  • @SamHolder I have a couple of tests projects that have pure NUnit tests and tests from those projects are listed in Test Explorer without problems. It's just that test project that has SpecFlow tests that, for some strange reason, can't be listed – dragan.stepanovic Feb 29 '16 at 10:50
  • have you checked the feature.cs files to check that the generated tests are in the same NUnit format as the other tests? – Sam Holder Feb 29 '16 at 10:59
  • 1
    Yup, it was the same. I've created a separate test project, installed SpecFlow and SpecFlow.NUnit, created one SpecFlow feature and it was listed in the Test Explorer :) Then, I've removed a couple of NuGet packages from the original test project with bunch of SpecFlow tests and suddenly they showed up in Test Explorer. Definitely there's some collision with the nuget packages that were installed. Once I detect which one, I'll post an answer here. – dragan.stepanovic Feb 29 '16 at 12:01

0 Answers0