Visual Studio 2017 中使用 Specflow 的 BDD -featurefile 错误 CS1029

BDD with Specflow in Visual Studio 2017 -featurefile Error CS1029

我在 Visual Studio 2017 年尝试使用 Specflow 进行 BDD。之前我创建了一个新项目并使用 NuGet 包管理器添加了 Specflow 和 Nunit。在解决方案资源管理器中,我右键单击并 select 添加新项。从添加新项目 window,我可以看到 SpecFlow 功能文件和 Feature.cs 文件

但我打开 Feature.cs 它显示为空,并显示消息

<#error 生成错误:该元素在本节中只能出现一次。>

然后我尝试构建解决方案,然后我在输出时遇到错误

错误 CS1029

错误:'Generation error: The element may only appear once in this section.'

我可以从解决方案资源管理器中看到的引用是:SpecRun.SpecFlowPlugin TechTalk.SpecFlow TechTalk.SpecRun NUnit.VisualStudio.TestAdapter

我是不是漏掉了什么?

谢谢,穆罕默德

?xml version="1.0" encoding="utf-8"?>
configuration>
  <configSections>
    <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" />
  </configSections>
  <specFlow>
    <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config -->
  <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config --><!-- use unit test provider SpecRun+NUnit or SpecRun+MsTest for being able to execute the tests with SpecRun and another provider --><unitTestProvider name="SpecRun" /><plugins>
      <add name="SpecRun" />
    </plugins></specFlow>
</configuration>

如果你有一个场景大纲,但是你要编写示例关键字,你会在构建过程中遇到以下错误:

CS1029 #error: 'Generation error: Sequence contains no elements' 在 MyFeature.feature

的第 1 行

我花了几个小时在我创建的大型特征文件中找到我的错误。我删除了临时文件,重新启动 visual studio 几次,但很难弄清楚为什么会这样。

你能以某种方式改进错误消息吗?有更好的位置,之前的简单语法检查或类似的东西?

据我所知,ScenarioOutline 后面跟着一个 will 始终至少需要一个 Examples 关键字和一个带有此 varname 的 table,然后再允许其他标签(如 Scenario 等)。我很高兴有这样的标记