Description
Course info
Rating
(178)
Level
Intermediate
Updated
Feb 10, 2014
Duration
1h 28m
Description

Whether you have recently discovered SpecFlow or have been using it for a while, the tips and tricks in this course will help you create more maintainable SpecFlow test automation solutions.

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

Steps and Bindings
Hi, welcome to SpecFlow Tips and Tricks. I'm Jason Roberts from Pluralsight. Whether you've recently discovered the awesomeness of SpecFlow or if you've been using it for awhile now the tips and tricks in this course will help you create more maintainable SpecFlow test automation solutions. In this first module we'll be looking at items related to steps and bindings. So in this module, first off, we'll get a brief refresher on SpecFlow and the Gherkin domain specific language. We'll learn how we can map multiple steps in our scenarios to a single step definition so we can reuse the code within it. We'll see that we can actually execute steps from within our step definition code that calls into other steps that we've defined so that we can reduce the number of steps in our scenarios. We'll learn how we can actually create step bindings that exist in external assemblies and how to tell SpecFlow to look for them. Finally, we'll see how we can share strongly-typed data between our steps using something call context injection and how we can use context injection even if our steps are in different binding classes.

Hooks and Scoped Bindings
Hi. Welcome back to Module 2 of SpecFlow Tips and Traps. In this module we're going to look at hooks and scoped bindings. In this module, first off we're going to take a look at how we can use hooks to run additional automation code during the SpecFlow test execution life cycle. So this is additional code that we run outside of the usual step definition binding code. Next we'll see how we can restrict the execution of our step definitions by using something called scoped bindings. These scoped bindings allow us to restrict which steps in our scenarios get matched to which step definitions. Finally, we'll also see how we can restrict the execution of any hooks we write by restricting them using tag filtering, and also how we can make use of the ScenarioContext to create logical ends for our tag filtering.

Step Parameters and Data Tables
Hi. Welcome to this final module of SpecFlow Tips and Tricks. In this module we're going to cover Step Parameters and Data Tables. So first off in this module we're going to see the three different ways in which SpecFlow converts the arguments in our scenario steps to parameters in our step definition code. We'll look at the kinds of standard conversions that SpecFlow performs automatically for us. We'll then learn how to write our own custom conversion code that gets invoked when SpecFlow converts an argument in our scenario step into a parameter in our step definition code. We'll learn how we can convert weakly-typed SpecFlow data tables to strongly-typed collections of objects. We'll then learn how we can reduce the need for these extra classes by instead using C# Dynamic types. And finally, we'll look at how we can automatically use this Dynamic Table conversion.