2. What is SpecFlow?
A tool that lets you write automated tests that look like this:
Feature: Create a new company
Scenario: Anonymous user submits a valid company
Given user is not logged in
And they create a company with valid data
When they save the company
Then the company is saved to the database
And the saved company has status PendingReview
Scenario: Admin user submits a valid company
Given they create a company with valid data
When they save the company
Then the company is saved to the database
And the saved company has status Published
3. Where did SpecFlow come from?
Gherkin
A really simple DSL used by
both Cucumber and SpecFlow
to define specifications
Cucumber
A Ruby testing tool used for
creating and running specs.
SpecFlow is based on Cucumber.
4. The basic parts
• Features
• Scenarios
• Steps
Features are made up of Scenarios
Scenarios are made up of Steps
5. Feature: Company Save
Scenario: Anonymous user saves a valid company
Given user is not logged in
And they create a company with valid data
When they save the company
Then the company is saved to the database
And the saved company has a status PendingReview
Scenario: Employer saves a valid company
Given user is logged in AdminUser
And they create a company with valid data
When they save the company
Then the company is saved to the database
And the saved company has a status Published
Feature
Scenario
Steps
7. Installing Specflow
There are 2 parts:
1. Install the SpecFlow Nuget package
2. Go to Visual Studio Extension
Manager and install the SpecFlow
Extension