仅安装Specflow.MSTest软件包时,Specflow 3.0会错误地生成NUnit测试

时间:2019-08-20 00:42:22

标签: c# nunit mstest specflow

当MSTest被指定为单元测试提供者时,Specflow在引用NUnit测试属性的文件后面生成代码

// ------------------------------------------------------------------------------
//  <auto-generated>
//      This code was generated by SpecFlow (http://www.specflow.org/).
//      SpecFlow Version:3.0.0.0
//      SpecFlow Generator Version:3.0.0.0
// 
//      Changes to this file may cause incorrect behavior and will be lost if
//      the code is regenerated.
//  </auto-generated>
// ------------------------------------------------------------------------------
#region Designer generated code
#pragma warning disable
namespace Microsoft.Azure.OneIM.Service.AcceptanceTests.Features.OutageAlertRuleManagement
{
    using TechTalk.SpecFlow;


    [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "3.0.0.0")]
    [System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [NUnit.Framework.TestFixtureAttribute()]
    [NUnit.Framework.DescriptionAttribute("Outage Alert Rule Management")]
    public partial class OutageAlertRuleManagementFeature
    {

        private TechTalk.SpecFlow.ITestRunner testRunner;
    ...

我今天通过逐步浏览this documentation

,将相对不符合数据规范的版本更新为3.0。

我们使用MsTest,因此按照指定的方式我安装了Specflow.MSTest软件包。这是我们的package.json

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="BoDi" version="1.4.1" targetFramework="net461" />
  <package id="Bond.Core.CSharp" version="5.0.0" targetFramework="net461" />
  <package id="Bond.CSharp" version="5.0.0" targetFramework="net461" />
  <package id="Bond.Runtime.CSharp" version="5.0.0" targetFramework="net461" />
  <package id="Dapper" version="1.50.2" targetFramework="net451" />
  <package id="DsmsCredentialsManagement" version="2.16.843" targetFramework="net461" />
  <package id="EnterpriseLibrary.TransientFaultHandling" version="6.0.1304.0" targetFramework="net451" />
  <package id="EnterpriseLibrary.TransientFaultHandling.WindowsAzure.Storage" version="6.0.1304.1" targetFramework="net451" />
  <package id="EntityFramework" version="6.1.3" targetFramework="net452" />
  <package id="Gherkin" version="6.0.0" targetFramework="net461" />
  <package id="libphonenumber-csharp" version="7.0.9" targetFramework="net451" />
  <package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net451" />
  <package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net451" />
  <package id="Microsoft.Azure.SqlDatabase.ElasticScale.Client" version="1.1.0" targetFramework="net451" />
  <package id="Microsoft.Cloud.InstrumentationFramework" version="3.0.6.79" targetFramework="net461" />
  <package id="Microsoft.Team.Common.amd64" version="2.3.0.615" targetFramework="net461" />
  <package id="Microsoft.Team.Common.Web.amd64" version="2.4.0.529" targetFramework="net461" />
  <package id="Microsoft.Team.Diagnostics.amd64" version="2.4.0.529" targetFramework="net461" />
  <package id="Microsoft.Team.Storage" version="1.2.0.216" targetFramework="net451" />
  <package id="Microsoft.Team.Storage.SqlServer" version="1.2.0.222" targetFramework="net461" />
  <package id="Microsoft.OData.Client" version="6.14.0" targetFramework="net451" />
  <package id="Microsoft.OData.Core" version="6.14.0" targetFramework="net451" />
  <package id="Microsoft.OData.Edm" version="6.14.0" targetFramework="net451" />
  <package id="Microsoft.ServiceFabric" version="5.6.220" targetFramework="net451" />
  <package id="Microsoft.ServiceFabric.Data" version="2.6.220" targetFramework="net451" />
  <package id="Microsoft.ServiceFabric.Services" version="2.6.220" targetFramework="net451" />
  <package id="Microsoft.Spatial" version="6.14.0" targetFramework="net451" />
  <package id="Moq" version="4.2.1409.1722" targetFramework="net451" />
  <package id="MS.Team.Storage.TestLibrary" version="1.2.0.222" targetFramework="net461" />
  <package id="MSTest.TestFramework" version="1.4.0" targetFramework="net461" />
  <package id="Newtonsoft.Json" version="11.0.2" targetFramework="net461" />
  <package id="SpecFlow" version="3.0.225" targetFramework="net461" />
  <package id="SpecFlow.MsTest" version="3.0.225" targetFramework="net461" />
  <package id="SpecFlow.Tools.MsBuild.Generation" version="3.0.225" targetFramework="net461" />
  <package id="System.Reflection.Emit" version="4.3.0" targetFramework="net461" />
  <package id="System.Reflection.Emit.Lightweight" version="4.3.0" targetFramework="net461" />
  <package id="System.Threading.Tasks.Extensions" version="4.4.0" targetFramework="net461" />
  <package id="System.ValueTuple" version="4.4.0" targetFramework="net461" />
  <package id="Unity" version="3.5.1404.0" targetFramework="net452" />
  <package id="Unity.Interception" version="3.5.1404.0" targetFramework="net452" />
  <package id="Utf8Json" version="1.3.7" targetFramework="net461" />
</packages>

这是完整的csproj:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(PkgSpecFlow_MsTest)\build\SpecFlow.MsTest.props" Condition="Exists('$(PkgSpecFlow_MsTest)\build\SpecFlow.MsTest.props')" />
  <Import Project="$(PkgSpecFlow_Tools_MsBuild_Generation)\build\SpecFlow.Tools.MsBuild.Generation.props" Condition="Exists('$(PkgSpecFlow_Tools_MsBuild_Generation)\build\SpecFlow.Tools.MsBuild.Generation.props')" />
  <Import Project="$(PkgBond_CSharp)\build\Bond.CSharp.props" Condition="Exists('$(PkgBond_CSharp)\build\Bond.CSharp.props')" />
  <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory)\.., root.props))\root.props" />
  <PropertyGroup>
    <ProjectGuid>{36D3E255-D478-42E6-B50F-CBAECCFF2C81}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Microsoft.Azure.OneIM.Service.AcceptanceTests</RootNamespace>
    <AssemblyName>Microsoft.Azure.OneIM.Service.AcceptanceTests</AssemblyName>
    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    <TargetFrameworkProfile />
    <NuGetPackageImportStamp>
    </NuGetPackageImportStamp>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="$(PkgBond_Core_CSharp)\lib\net45\Bond.dll">
      <Private>True</Private>
      <Name>Bond</Name>
    </Reference>
    <Reference Include="$(PkgBond_Core_CSharp)\lib\net45\Bond.Attributes.dll">
      <Private>True</Private>
      <Name>Bond.Attributes</Name>
    </Reference>
    <Reference Include="$(PkgBond_Core_CSharp)\lib\net45\Bond.IO.dll">
      <Private>True</Private>
      <Name>Bond.IO</Name>
    </Reference>
    <Reference Include="$(PkgBond_Runtime_CSharp)\lib\net45\Bond.JSON.dll">
      <Private>True</Private>
      <Name>Bond.JSON</Name>
    </Reference>
    <Reference Include="$(PkgDapper)\lib\net45\Dapper.dll">
      <Name>Dapper</Name>
    </Reference>
    <Reference Include="$(PkgEntityFramework)\lib\net45\EntityFramework.dll">
      <Name>EntityFramework</Name>
    </Reference>
    <Reference Include="$(PkgEntityFramework)\lib\net45\EntityFramework.SqlServer.dll">
      <Name>EntityFramework.SqlServer</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_Azure_SqlDatabase_ElasticScale_Client)\lib\net45\Microsoft.Azure.SqlDatabase.ElasticScale.Client.dll">
      <Name>Microsoft.Azure.SqlDatabase.ElasticScale.Client</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_Team_Storage)\lib\net45\Microsoft.Team.Storage.dll">
      <Name>Microsoft.Team.Storage</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_OData_Client)\lib\net40\Microsoft.OData.Client.dll">
      <Name>Microsoft.OData.Client</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_OData_Core)\lib\portable-net40+sl5+wp8+win8+wpa\Microsoft.OData.Core.dll">
      <Name>Microsoft.OData.Core</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_OData_Edm)\lib\portable-net40+sl5+wp8+win8+wpa\Microsoft.OData.Edm.dll">
      <Name>Microsoft.OData.Edm</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_OneIM_Common_WinFabHost)\lib\net45\Microsoft.OneIM.Common.WinFabHost.exe">
      <Name>Microsoft.OneIM.Common.WinFabHost</Name>
    </Reference>
    <Reference Include="$(PkgEnterpriseLibrary_TransientFaultHandling)\lib\portable-net45+win+wp8\Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.dll">
      <Name>Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling</Name>
    </Reference>
    <Reference Include="$(PkgEnterpriseLibrary_TransientFaultHandling_WindowsAzure_Storage)\lib\NET45\Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.WindowsAzure.Storage.dll">
      <Name>Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.WindowsAzure.Storage</Name>
    </Reference>
    <Reference Include="$(PkgUnity)\lib\net45\Microsoft.Practices.Unity.dll">
      <Name>Microsoft.Practices.Unity</Name>
    </Reference>
    <Reference Include="$(PkgUnity)\lib\net45\Microsoft.Practices.Unity.Configuration.dll">
      <Name>Microsoft.Practices.Unity.Configuration</Name>
    </Reference>
    <Reference Include="$(PkgUnity_Interception)\lib\Net45\Microsoft.Practices.Unity.Interception.dll">
      <Name>Microsoft.Practices.Unity.Interception</Name>
    </Reference>
    <Reference Include="$(PkgUnity_Interception)\lib\Net45\Microsoft.Practices.Unity.Interception.Configuration.dll">
      <Name>Microsoft.Practices.Unity.Interception.Configuration</Name>
    </Reference>
    <Reference Include="$(PkgUnity)\lib\net45\Microsoft.Practices.Unity.RegistrationByConvention.dll">
      <Name>Microsoft.Practices.Unity.RegistrationByConvention</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_ServiceFabric_Data)\lib\net45\Microsoft.ServiceFabric.Data.dll">
      <Name>Microsoft.ServiceFabric.Data</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_ServiceFabric_Data)\lib\net45\Microsoft.ServiceFabric.Data.Interfaces.dll">
      <Name>Microsoft.ServiceFabric.Data.Interfaces</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_ServiceFabric)\lib\net45\Microsoft.ServiceFabric.Internal.dll">
      <Name>Microsoft.ServiceFabric.Internal</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_ServiceFabric)\lib\net45\Microsoft.ServiceFabric.Internal.Strings.dll">
      <Name>Microsoft.ServiceFabric.Internal.Strings</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_ServiceFabric_Services)\lib\net45\Microsoft.ServiceFabric.Services.dll">
      <Name>Microsoft.ServiceFabric.Services</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_Spatial)\lib\portable-net40+sl5+wp8+win8+wpa\Microsoft.Spatial.dll">
      <Name>Microsoft.Spatial</Name>
    </Reference>
    <Reference Include="$(PkgMoq)\lib\net40\Moq.dll">
      <Name>Moq</Name>
    </Reference>
    <Reference Include="$(Pkglibphonenumber_csharp)\lib\PhoneNumbers.dll">
      <Name>PhoneNumbers</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_ServiceFabric)\lib\net45\System.Fabric.dll">
      <Name>System.Fabric</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_ServiceFabric)\lib\net45\System.Fabric.Management.ServiceModel.dll">
      <Name>System.Fabric.Management.ServiceModel</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_ServiceFabric)\lib\net45\System.Fabric.Management.ServiceModel.XmlSerializers.dll">
      <Name>System.Fabric.Management.ServiceModel.XmlSerializers</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_ServiceFabric)\lib\net45\System.Fabric.Strings.dll">
      <Name>System.Fabric.Strings</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_AspNet_WebApi_Client)\lib\net45\System.Net.Http.Formatting.dll">
      <Name>System.Net.Http.Formatting</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_AspNet_WebApi_Core)\lib\net45\System.Web.Http.dll">
      <Name>System.Web.Http</Name>
    </Reference>
    <Reference Include="$(PkgBoDi)\lib\net45\BoDi.dll">
      <Name>BoDi</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_Cloud_InstrumentationFramework)\lib\net40\Microsoft.Cloud.InstrumentationFramework.Events.dll">
      <Name>Microsoft.Cloud.InstrumentationFramework.Events</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_Cloud_InstrumentationFramework)\lib\net40\Microsoft.Cloud.InstrumentationFramework.Health.dll">
      <Name>Microsoft.Cloud.InstrumentationFramework.Health</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_Cloud_InstrumentationFramework)\lib\net40\Microsoft.Cloud.InstrumentationFramework.Metrics.dll">
      <Name>Microsoft.Cloud.InstrumentationFramework.Metrics</Name>
    </Reference>
    <Reference Include="$(PkgDsmsCredentialsManagement)\lib\net40\Microsoft.WindowsAzure.Security.CredentialsManagement.Client.dll">
      <Name>Microsoft.WindowsAzure.Security.CredentialsManagement.Client</Name>
    </Reference>
    <Reference Include="$(PkgDsmsCredentialsManagement)\lib\net40\Microsoft.WindowsAzure.Security.CredentialsManagement.StorageHelper.dll">
      <Name>Microsoft.WindowsAzure.Security.CredentialsManagement.StorageHelper</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_Team_Common_amd64)\lib\net45\Microsoft.Team.Common.dll">
      <Name>Microsoft.Team.Common</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_Team_Common_Web_amd64)\lib\net45\Microsoft.Team.Common.Web.dll">
      <Name>Microsoft.Team.Common.Web</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_Team_Diagnostics_amd64)\lib\net45\Microsoft.Team.Diagnostics.dll">
      <Name>Microsoft.Team.Diagnostics</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_Team_Storage_SqlServer)\lib\net45\Microsoft.Team.Storage.Implementation.dll">
      <Name>Microsoft.Team.Storage.Implementation</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_Team_Storage_SqlServer)\lib\net45\Microsoft.Team.Storage.SqlServer.dll">
      <Name>Microsoft.Team.Storage.SqlServer</Name>
    </Reference>
    <Reference Include="$(PkgMS_Team_Storage_TestLibrary)\lib\net45\MS.Team.Storage.TestLibrary.dll">
      <Name>MS.Team.Storage.TestLibrary</Name>
    </Reference>
    <Reference Include="$(PkgNewtonsoft_Json)\lib\net45\Newtonsoft.Json.dll">
      <Name>Newtonsoft.Json</Name>
    </Reference>
    <Reference Include="$(PkgGherkin)\lib\net45\Gherkin.dll">
      <Name>Gherkin</Name>
    </Reference>
    <Reference Include="$(PkgMicrosoft_Team_Rules_Domain)\lib\net45\Microsoft.Team.Rules.Domain.dll">
      <Name>Microsoft.Team.Rules.Domain</Name>
    </Reference>
    <Reference Include="$(PkgMSTest_TestFramework)\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll">
      <Name>Microsoft.VisualStudio.TestPlatform.TestFramework</Name>
    </Reference>
    <Reference Include="$(PkgMSTest_TestFramework)\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll">
      <Name>Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions</Name>
    </Reference>
    <Reference Include="System" />
    <Reference Include="System.ComponentModel.DataAnnotations" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Runtime" />
    <Reference Include="System.Runtime.Serialization" />
    <Reference Include="$(PkgSystem_Threading_Tasks_Extensions)\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll">
      <Name>System.Threading.Tasks.Extensions</Name>
    </Reference>
    <Reference Include="$(PkgSystem_ValueTuple)\lib\net461\System.ValueTuple.dll">
      <Name>System.ValueTuple</Name>
    </Reference>
    <Reference Include="$(PkgSpecFlow)\lib\net45\TechTalk.SpecFlow.dll">
      <Name>TechTalk.SpecFlow</Name>
    </Reference>
    <Reference Include="$(PkgSpecFlow_MsTest)\lib\net45\TechTalk.SpecFlow.MSTest.SpecFlowPlugin.dll">
      <Name>TechTalk.SpecFlow.MSTest.SpecFlowPlugin</Name>
    </Reference>
    <Reference Include="$(PkgUtf8Json)\lib\net45\Utf8Json.dll">
      <HintPath>Utf8Json</HintPath>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Properties\" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config">
      <SubType>Designer</SubType>
    </None>
    <None Include="Features\OutageAlertRuleManagement\OutageAlertRuleManagement.feature" />
    <None Include="packages.config">
      <SubType>Designer</SubType>
    </None>
  </ItemGroup>
  <ItemGroup />
  <ItemGroup>
    <Compile Include="Features\OutageAlertRuleManagement\OutageAlertRuleManagementSteps.cs" />
    <Compile Include="Setup\BeforeTestRunHook.cs" />
    <Compile Include="Setup\TestConstants.cs" />
    <Compile Include="Setup\UnitySetup.cs" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\..\Product\Service.Business\Service.Business.csproj">
      <Project>{9caf6690-e918-4d2a-99dd-2864cfd216a2}</Project>
      <Name>Service.Business</Name>
    </ProjectReference>
    <ProjectReference Include="..\..\Product\Service.Core\Service.Core.csproj">
      <Project>{e1befc55-8b80-4c61-998b-c0d5cb6f4f9a}</Project>
      <Name>Service.Core</Name>
    </ProjectReference>
    <ProjectReference Include="..\..\Product\Service.External\Service.External.csproj">
      <Project>{8c0eafa6-9ce7-4993-a42f-102d287e270f}</Project>
      <Name>Service.External</Name>
    </ProjectReference>
    <ProjectReference Include="..\..\Product\Service.Service\Service.Service.csproj">
      <Project>{d6aca221-5b31-4363-85f2-b7f745c30ba6}</Project>
      <Name>Service.Service</Name>
    </ProjectReference>
    <ProjectReference Include="..\..\Product\Service.Storage\Service.Storage.csproj">
      <Project>{e048ebcf-2363-4dd5-ade3-daeb7b396e24}</Project>
      <Name>Service.Storage</Name>
    </ProjectReference>
  </ItemGroup>
  <ItemGroup>
    <QCustomInput Include="$(PkgMsBuildShim_OneBranch)">
      <Visible>false</Visible>
    </QCustomInput>
    <QCustomInput Include="$(PkgVisualStudio_StaticAnalysisTools_Corext)">
      <Visible>false</Visible>
    </QCustomInput>
  </ItemGroup>
  <ItemGroup>
    <Content Include="$(PkgDsmsCredentialsManagement)\lib\Native\ManagedCertStore.dll">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="$(PkgDsmsCredentialsManagement)\lib\Native\SecretsPackage.dll">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
    <Content Include="$(PkgDsmsCredentialsManagement)\lib\Native\CMClientLib.dll">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </Content>
  </ItemGroup>
  <Import Project="$(ExtendedTargetsPath)\Microsoft.CSharp.targets" />
  <Import Project="$(PkgBond_CSharp)\build\Bond.CSharp.props" Condition="Exists('$(PkgBond_CSharp)\build\Bond.CSharp.props')" />
  <Import Project="$(PkgMicrosoft_Cloud_InstrumentationFramework)\build\Microsoft.Cloud.InstrumentationFramework.targets" Condition="Exists('$(PkgMicrosoft_Cloud_InstrumentationFramework)\build\Microsoft.Cloud.InstrumentationFramework.targets')" />
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
    <PropertyGroup>
      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
    </PropertyGroup>
    <Error Condition="!Exists('$(PkgMicrosoft_Cloud_InstrumentationFramework)\build\Microsoft.Cloud.InstrumentationFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(PkgMicrosoft_Cloud_InstrumentationFramework)\build\Microsoft.Cloud.InstrumentationFramework.targets'))" />
    <Error Condition="!Exists('$(PkgBond_CSharp)\build\Bond.CSharp.props')" Text="$([System.String]::Format('$(ErrorText)', '$(PkgBond_CSharp)\build\Bond.CSharp.props'))" />
    <Error Condition="!Exists('$(PkgBond_CSharp)\build\Bond.CSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(PkgBond_CSharp)\build\Bond.CSharp.targets'))" />
    <Error Condition="!Exists('$(PkgDsmsCredentialsManagement)\build\DsmsCredentialsManagement.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(PkgDsmsCredentialsManagement)\build\DsmsCredentialsManagement.targets'))" />
    <Error Condition="!Exists('$(PkgSpecFlow_Tools_MsBuild_Generation)\build\SpecFlow.Tools.MsBuild.Generation.props')" Text="$([System.String]::Format('$(ErrorText)', '$(PkgSpecFlow_Tools_MsBuild_Generation)\build\SpecFlow.Tools.MsBuild.Generation.props'))" />
    <Error Condition="!Exists('$(PkgSpecFlow_Tools_MsBuild_Generation)\build\SpecFlow.Tools.MsBuild.Generation.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(PkgSpecFlow_Tools_MsBuild_Generation)\build\SpecFlow.Tools.MsBuild.Generation.targets'))" />
    <Error Condition="!Exists('$(PkgSpecFlow_MsTest)\build\SpecFlow.MsTest.props')" Text="$([System.String]::Format('$(ErrorText)', '$(PkgSpecFlow_MsTest)\build\SpecFlow.MsTest.props'))" />
    <Error Condition="!Exists('$(PkgSpecFlow_MsTest)\build\SpecFlow.MsTest.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(PkgSpecFlow_MsTest)\build\SpecFlow.MsTest.targets'))" />
  </Target>
  <Import Project="$(PkgBond_CSharp)\build\Bond.CSharp.targets" Condition="Exists('$(PkgBond_CSharp)\build\Bond.CSharp.targets')" />
  <Import Project="$(PkgDsmsCredentialsManagement)\build\DsmsCredentialsManagement.targets" Condition="Exists('$(PkgDsmsCredentialsManagement)\build\DsmsCredentialsManagement.targets')" />
  <Import Project="$(PkgSpecFlow_Tools_MsBuild_Generation)\build\SpecFlow.Tools.MsBuild.Generation.targets" Condition="Exists('$(PkgSpecFlow_Tools_MsBuild_Generation)\build\SpecFlow.Tools.MsBuild.Generation.targets')" />
  <Import Project="$(PkgSpecFlow_MsTest)\build\SpecFlow.MsTest.targets" Condition="Exists('$(PkgSpecFlow_MsTest)\build\SpecFlow.MsTest.targets')" />
  <Target Name="AfterUpdateFeatureFilesInProject">
    <!-- include any generated SpecFlow files in the compilation of the project if not included yet -->
    <ItemGroup>
      <Compile Include="**\*.feature.cs" Exclude="@(Compile)" />
    </ItemGroup>
  </Target>
</Project>

,并且我确保在功能文件上也清除了“自定义工具”字段。

完全不确定如何进行此处。根据他们的文档,您可以根据安装的测试提供程序包在Specflow 3中指定测试提供程序。

1 个答案:

答案 0 :(得分:0)

我的案例在App.config文件中添加以下内容有效:

  <specFlow>
    <unitTestProvider name="xUnit" />
    <generator allowDebugGeneratedFiles="true" />
  </specFlow>