简体   繁体   中英

SpecFlow feature not found by Visual Studio Test Explorer

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

测试浏览器

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.

在此处输入图片说明

NuGET Package

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

如果您将此nuget 包Specflow.Tools.MSBuild.Generation添加到您的项目中, .feature.cs在您重建时将自动生成.feature.cs文件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM