【问题标题】:How can I make a SpecFlow plugin that uses custom TestFixture and Test attributes?如何制作使用自定义 TestFixture 和 Test 属性的 SpecFlow 插件?
【发布时间】:2017-09-13 11:25:11
【问题描述】:

我正在与一个开发了自己的自定义测试框架的团队合作,该框架类似于 NUnit,但具有各种附加功能。我正在尝试将SpecFlow 合并到我们的测试中。要使用我们的自定义 TestFixture 和 Test 属性生成代码隐藏功能文件,我需要创建一个插件。

我已经创建了插件,但我正在努力让 SpecFlow 真正看到它。我已经在我的 App.config 中为使用该插件的项目尝试了 path 设置的各种排列,甚至是完全指定的路径:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
 <configSections>
  <section name="specFlow"
    type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow"/>
 </configSections>
 <runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
   <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json"
      publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
   </dependentAssembly>
  </assemblyBinding>
 </runtime>
 <specFlow>
  <plugins>
   <add name="SpecFlowAdapters"
     path="C:\Development\[OurProductName]\Plugins\SpecFlowAdapters.SpecFlowPlugin.dll"
     type="Generator" />
  </plugins>
 </specFlow>
</configuration>

但每次我重新生成功能代码时,我都会得到

#error Generation error: Unable to find plugin in the plugin search path:
  SpecFlowAdapters. Please check http://go.specflow.org/doc-plugins for details.

有没有人能够成功地创建自定义 SpecFlow 生成器,可以指出示例工作代码?

【问题讨论】:

    标签: specflow


    【解决方案1】:

    插件配置中的路径应该是插件dll所在文件夹的路径,而不是程序集的完整路径。

    配置详细信息下查看末尾的http://specflow.org/documentation/Plugins/

    【讨论】:

      猜你喜欢
      • 2019-12-06
      • 2018-09-12
      • 2012-02-15
      • 1970-01-01
      • 2019-04-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-03-20
      相关资源
      最近更新 更多