Specflow setup to Share Hooks and Step Definitions Across VS Projects

大兔子大兔子 提交于 2019-12-04 02:11:42

问题


Currently working on a series of projects that are contained within one solution in VS2017. Each project is a specflow project, within one solution. I would like to setup the Hooks.cs file such that it's valid for any test within the entire solution, not just the project. I'd also like to make step definitions from one project available to the other projects as a base or utility step definition.

How would I go about structuring specflow to make this possible?


回答1:


You can use steps and hooks from different assemblies.
You can add in the configuration a list of additional step assemblies like this:

<specFlow> <stepAssemblies> <stepAssembly assembly="MySharedBindings" /> </stepAssemblies> </specFlow>

The documentation is here: https://specflow.org/documentation/Use-Bindings-from-External-Assemblies/

But there are some known problems with it:

  • IntelliSense and Syntax Highlighting has some problems (https://github.com/techtalk/SpecFlow/issues/838)
  • Hooks could be registered double (https://github.com/techtalk/SpecFlow/issues/1004)


来源:https://stackoverflow.com/questions/53820422/specflow-setup-to-share-hooks-and-step-definitions-across-vs-projects

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!