You can add SpecFlow to your project using Nuget or you can download from: http://specflow.org
After using StoryQ in my previous post I thought I’d show the steps to produce the equivalent tests with SpecFlow.
Once you’ve installed SpecFlow to your machine and added the NUnit.Framework and SpecFlow dlls to your project you can create a SpecFlow Feature file:
The tests won’t pass yet because you need to bind the Step definitions to C# code:
Create a new C# class file and copy and paste the binding code above into it:
We now get running tests that have yet to be implemented:
So we can now fill in the implementation for each of the steps, adding in our BeforeScenario (setup) and AfterScenario (teardown) methods:
To download the source: