SpecFlow aims at bridging the communication gap between domain experts and developers by binding business readable behavior specifications and examples to the underlying implementation.
Our mission is to provide a pragmatic and frictionless approach to Specification-By-Example for .NET projects.
SpecFlow also supports the concepts of Acceptance Test Driven Development (ATDD) and Behavior Driven Development (BDD), which are often used synonymously with Specification-By-Example.
Install IDE Integration
The installation of the IDE Intergation packages depends on the IDE you use. For Visual Studio 2015, 2013, 2012 and 2010, the easiest way is to search for “SpecFlow” in the extension manager (Extensions and Updates in VS2013/VS2012) online search. For other IDE integrations and for the direct download links, check the Install IDE Integration page.
Setup SpecFlow Project
The SpecFlow tests are usually placed into one or more separate project in the solution: the “SpecFlow Projects”. The easiest and most convenient way to setup these projects is to use our NuGet package:
SpecFlow or one of the specific helper packages, like
SpecRun.SpecFlow. For a detailed project setup guide, check the Setup SpecFlow Projects page.
This section guides you through the first steps of setting up your SpecFlow project and creating your first scenario. In the example, we will use SpecFlow with NUnit, but you can choose from many other test execution frameworks, including SpecFlow+Runner, which provides specialized execution features, Visual Studio Test Window and Team Foundation Server (TFS) Build integration for SpecFlow.
Get your first SpecFlow test running in just a few steps:
Create a class library project: MyProject.Specs
If you want to use SpecFlow with MsTest in VS2010, you should start with a “Unit Test Project”
Add SpecFlow for NUnit through NuGet
PM> Install-Package SpecFlow.NUnit
Add your first feature file
We are writing yet another StackOverflow clone: SpecOverflow
Describe the first scenario in your application
Generate step definition skeletons
Cool new feature in v1.9!
Run your test – it is not green yet
Use your favorite test runner, like the VS2012 test runner below; but it works well with ReSharper too…
Implement automation & application logic until the test is green
Celebrate the good work and continue with the next scenario!
Want to learn more?
- Read the Getting Started guide if you are new to SpecFlow
- In-depth information is available in the Documentation
- SpecFlow was inspired by Cucumber and uses Gherkin
- Recommended books:
Specification by Example by Gojko AdzicThe Cucumber Book by Matt Wynne and Aslak Hellesoy
- You can find more books, articles, tutorials and screencasts on the Read & Watch page
Check out the products that make SpecFlow even more powerful!