F# Support

Bindings for SpecFlow can be written also in F#. Doing so you can take the advantages of the F# language for writing step definitions: you can define regex-named F# functions for your steps. Simply put the regex between double backticks.

let [<Given>] ``I have entered (.*) into the calculator``(number:int) = 

Although the regex method names are only important for step definitions you can also define hooks and step argument conversions in the F# binding projects.

Note: You need to create a C# or VB project for hosting the feature files and configure your F# project(s) as external binding assemblies:

    <stepAssembly assembly="MyFSharpBindings" />

IDE Support

SpecFlow provides item templates for creating new F# step definitions or hooks in Visual Studio.

Note: The navigation and the binding analysis features of the SpecFlow editor provide only limited support for F# projects.


An example can be found here.