2
votes

After installing SpecFlow via extensions into VS2013 Ultimate, and added SpecFlow and NUnit to the current Class Library project, creating a feature, and building successfully, the scenarios do not show up in Test Explorer as expected. I've restarted Visual Studio, cleaned and rebuilt, nothing causes the scenarios to show up in Test Explorer.

Any tips?

Feature: SpecFlowFeature1

@mytag
Scenario: Scenario A
    Given X
    When Y
    Then Z

Scenario: Scenario B
    Given X
    When Y
    Then Z

Scenario: Scenario C
    Given X
    When Y
    Then Z

Test Explorer

3
If I am reading your question correctly, I believe that you should be using a Blank Project not a Class Library Project. If you are creating Library functions, you'll just create those as C# files in the project in a "Lib" (or similar) folder.Sam
what test framework is specflow configured to use?Sam Holder
Assuming nunit, have you verified that plain nunit tests show up in the explorer?Sam Holder

3 Answers

1
votes

As well as writing the features, you need to actually generate the code before they will show up in Test Explorer.

Go to your feature file, and right-click on the page, then select the 'Generate Step Definitions' option. This will then create the actual test code. Then when you compile, the tests will show up in Test Explorer.

enter image description here

1
votes

NuGET Package

Until Specflow.Tools.MSBuild.Generation is added, the testsuit wont appear. Once added, only build will reflect the autogenerated class and methods

0
votes

If you add this nuget package Specflow.Tools.MSBuild.Generation into your project, .feature.cs files will be generated automatically when you rebuild.