Quickly get started with SpecFlow and Rider

2021-03-13



Create the project

I used a class library project

Add the required libraries

Using Nuget:

  • Specflow.xunit
  • FluentAssertions
  • Microsoft.net.test.sdk

Add some features

  • Create a folder called features (for the gherkin files)
  • Create a folder called steps (for the step implementation files)

Create a feature file in features, such as test.feature, containing:

Feature:
  As a product owner
  I want to use Gherkin
  So that I convey system intent to my dear developers

Add some acceptance criteria:

Scenario: A use case
  Given I have some gherkin
  When I execute it
  Then the product owner is happy

Now build the project. Some magickery will cause some files to be created, to support SpecFlow.

Implement a stub step

To let SpecFlow know where to create the implementation for the steps:

  • Create a class such as TestSteps inside the steps folder:
namespace xxx
{
   [TechTalk.Specflow.Binding]
   public class TestSteps
   {
   }
}

Link the Gherkin to C#

Now go back to the feature file and option-enter the squiggly line on all the steps. Rider will create the step stubs in the TestSteps file.

Voila!



Other Tags

API GW
AWS
ActiveRecord
Agile
Alexa
Analysis
Ansible
BDD
BLE
C
CAB
CloudFormation
CloudFront
CloudWatch
Cross-compile
Cucumber
DevOps
Devops
DotNet
Embedded
Fitbit
GNU
GitHub Actions
Governance
How-to
Inception
IoT
Javascript
Jest
Lambda
Mac OS X
MacRuby
Metrics
MySQL
NetBeans
Objective-C
PMO
Product Management
Programme management
Project Management
Quality Assurance
Rails
Raspberry Pi
Remote compilation
Remote debugging
Remote execution
Risk Assessment
Route 53
Ruby
S3
SPA
Self Organising Teams
SpecFlow
TDD
Unit testing
VSM
Value
arm
contract testing
inception
nrf51
pact
planning
rSpec
ruby
ssh