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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.