Visual studio 2017 Specflow无法检测到我的测试VS 2017

Visual studio 2017 Specflow无法检测到我的测试VS 2017,visual-studio-2017,nunit,mstest,specflow,Visual Studio 2017,Nunit,Mstest,Specflow,我尝试了很久,但还没有成功。我创建了新的单元测试项目,并添加了以下内容: 套餐: Nunit - 3.10.0 Nunit3TestAdapter - 3.11.0 SpecFlow - 2.3.2 SpecFlow.Assist.Dynamic - 1.3.1 App.Config: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <sect

我尝试了很久,但还没有成功。我创建了新的单元测试项目,并添加了以下内容:

套餐:

Nunit - 3.10.0
Nunit3TestAdapter - 3.11.0
SpecFlow - 2.3.2
SpecFlow.Assist.Dynamic - 1.3.1
App.Config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="specFlow"
             type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow"/>
  </configSections>
  <specFlow>
    <unitTestProvider name="MsTest" />
  </specFlow>
</configuration>

我也试过使用Nunit进行上述配置。

还添加了specflow默认要素文件和步骤定义文件。但是VS2017仍然无法检测到我的任何测试

始终作为输出获取:NUnit在…中找不到任何测试


我已经为Visual Studio 2017安装了Specflow。

Specflow.Tools.MSBuild.Generation中有一个bug版本=2.3.2

一种解决方法是编辑.csproj并在UpdateFeatureFilesinProject之后添加一个节

<Target Name="AfterUpdateFeatureFilesInProject">
  <ItemGroup>
    <Compile Include="@(SpecFlowGeneratedFiles)" />
  </ItemGroup>
</Target>

<!-- Workaround Specflow 2.3 MSBuild bug. SpecFlowGeneratedFiles is not set if UpdateFeatureFilesInProject is up-to-date
   causing tests not to be discovered, as they are not included in the project -->
<ItemGroup>
  <Compile Include="**/*.feature.cs" Exclude="@(SpecFlowGeneratedFiles)">
    <DependentUpon>%(Filename)</DependentUpon>
  </Compile>
</ItemGroup>

%(文件名)

我们这里提供了不同测试运行者的示例:我建议您将您的项目与这些进行比较。请注意,它们适用于最新版本的SpecFlow。SpecFlow 2.3.2非常古老。特别是如果您拥有Visual Studio的最新SpecFlow扩展。默认情况下,feature.cs文件使用MSBuild生成,而不是v2.3使用的自定义工具生成。尝试
工具
->
选项
->
SpecFlow
并将
启用SpecFlowSingleFileGenerator自定义工具
设置为