| Recipe 24 | Test .NET Code with SpecFlow |
Problem
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.
Ingredients
-
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] xUnit.net,[155] or SpecRun[156]
-
The NuGet package manager[157] to install SpecFlow and the test runner
Solution
SpecFlow is an open source test framework that recognizes Cucumber’s Gherkin syntax (in fact, it uses the same Gherkin ...