Automated Acceptance Testing with SpecFlow and Gherkin

Learn how to create business-facing acceptance tests in natural languages in Visual Studio and .Net.
Course info
Rating
(508)
Level
Intermediate
Updated
Oct 28, 2013
Duration
2h 51m
Table of contents
Overview and Installation
The Gherkin Language
Coding The Automation Steps
Testing and Automating a Website with SpecFlow and WatiN
Description
Course info
Rating
(508)
Level
Intermediate
Updated
Oct 28, 2013
Duration
2h 51m
Description

SpecFlow is a tool for writing tests in Gherkin that the business can understand. Once the tests are written, the steps of these natural language tests can be hooked-up to actual coded automation and tests.

About the author
About the author

With over 15 years experience, Jason Roberts is a Microsoft .NET MVP, freelance developer, and author.

More from the author
Working with Files and Streams in C#
Intermediate
3h 13m
Oct 12, 2018
Error Handling in C# with Exceptions
Intermediate
1h 37m
Aug 6, 2018
More courses by Jason Roberts
Section Introduction Transcripts
Section Introduction Transcripts

Overview and Installation
Hi I'm Jason Roberts from Pluralsight, welcome to this course on Automated Acceptance Testing with SpecFlow and Gherkin. In this module we'll get an overview of what SpecFlow and Gherkin are and how we can use them to define acceptance tests that we can automate. In this module we'll get an overview of the SpecFlow tool itself. We'll discuss acceptance tests in general and some of their characteristics. We'll learn how we can broadly categorize testing into business facing and technology facing tests. We'll see how SpecFlow can be used in test-first approaches. And we'll look at the structure of SpecFlow tests and we'll breakdown the different components. We'll look at how we can install the Visual Studio IDE integration for the SpecFlow tooling. And finally we'll create a new project in Visual Studio and add our first feature file to it.

The Gherkin Language
Hi welcome back to module 2. In this module we'll be looking more closely at the Gherkin language that we use to write our acceptance tests. In this module we'll be learning how we define features and scenarios within those features. How we use the given, when, then steps to flush out our individual scenarios. We'll look at how we can classify scenarios and features by using tags. And how we can comment out individual lines within our features. We'll look how we can define tabular data to be passed to the automation for our steps. And how we can use scenario outlines to create data driven scenarios. Finally we'll look at backgrounds and how we can use them to provide common setup for all of the scenarios in a given feature file. So let's get started by diving into features.

Coding The Automation Steps
Hi welcome back to module 3. In this module we'll be learning how the steps in a scenario bind to the C# methods where we can actually perform our automation. In this module we'll learn about the relevant NuGet packages that we need to install to utilize NUnits in SpecFlow. We'll look at two different styles of binding step definitions to scenario steps and we'll see how we can set a default step definition style when we generate our step definition files. We'll see what happens when we add a new step and when we delete an existing step. We'll see how we can execute scenarios and debug individual step definitions. We'll see how we can share step definitions between scenarios and how we can use parameterized step definitions to promote reusability and reduce maintenance overhead. We'll learn how when using a data table in a step how the data is passed through to the step definition and our code. And we'll look at how scenario outline steps map to step definitions. Finally we'll look at how we share scenario context and data between the individual steps that make up a scenario.

Testing and Automating a Website with SpecFlow and WatiN
Welcome back to Module 4 Testing and Automating a Website with SpecFlow and WatiN. Even though we're using WatiN in this module to perform the browser automation. If you're using another framework for your automation such as Selenium or Microsoft Coded UI the processes we'll go through in this module such as refactoring our scenarios and step definitions apply regardless of which automation framework you're using. So in this module first off we're going to get an overview of the website that we're going to be writing our tests for. We'll get a brief introduction to the WatiN automation framework and we'll go ahead and write a scenario for the password strength feature of the website. We'll then go and create our automation code for the password strength scenario and also look at how we can refactor this to improve the code base. We'll look at how we can use WatiN hooks to dispose of the browser instance. We'll then look how we can refactor our password strength scenario into a scenario outline to reduce duplication in our feature file. We'll see how we can further simplify our feature files by introducing a background and finally we'll see how we can refactor our step definitions into other classes so we can organize them in a more logical fashion.