The SpecFlow Cook Book

Paul Marshall


Waiting for something to happen December 16, 2013

Whats the problem? you want to test the outcome of a long running process and it makes sense to have some way of expressing how long to waitwhiting your feature files. The ingredients A simple regular expression A timer Some cool wording in your scenarios Instructions Ok, so you have a bit of a monster…

read more →


Use drivers December 16, 2013

The Problem Your step definitions are becoming complex and common test functionality is being replicated across step definition files. Additionally information about how to interact with the subject under test is starting to bleed into your scenarios. The Ingredients A component to provide centralised application logic Use of ScenarioContext to share components and data between…

read more →


Organise project December 16, 2013

Organise the SpecFlow assets within your project. Assets include: Features Step Implementation Step Hooks From the project root, a good idea is to have separate folders for both feature files and steps. It is not always the case that there is a one to one relationship between feature file and step implementation file. Feature files…

read more →


Events in one class December 16, 2013

Place all you SpecFlow event hooks in one file, called Events.cs. Keep this file in your test project’s Steps folder. Keeps all your global and feature specific hooks in a common and well known place.