Recipe 24Test .NET Code with SpecFlow


You want to execute .NET code from a Cucumber test. For example, you might be writing integration tests for an ASP.NET web application or GUI tests for a desktop app. Because your GUI test framework or your web components are written in C#, you need to be able to call them from the .NET universe.


  • Microsoft Visual Studio Professional[152] 2010 or 2012 for building the examples

  • SpecFlow for parsing Cucumber syntax[153]

  • A test runner such as NUnit,[154],[155] or SpecRun[156]

  • The NuGet package manager[157] to install SpecFlow and the test runner


SpecFlow is an open source test framework that recognizes Cucumber’s Gherkin syntax (in fact, it uses the same Gherkin ...

Get Cucumber Recipes now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.