Specflow and Cucumber for .NET Developers - The Master Guide

Video description

In this course, you will embark on a journey to master Specflow, Cucumber, and Gherkin, the indispensable trio for unleashing the full potential of BDD.

You will start with a detailed course introduction, then dive deep into the principles of BDD and understand the foundation upon which Specflow thrives.

Get hands-on with the Gherkin language through Gherkin basics, gaining fluency in this universal language for expressing behavior and setting the stage for your Specflow adventures. Then learn how to create Specflow step definitions and bind them to your scenarios. After that, you will master the art of working with datatables in Gherkin using Specflow Table Assist. Understand the power of hooks in Specflow and how they can streamline your testing process.

Explore various methods of sharing data in Specflow, including Specflow’s context system and dependency injection. Dive into advanced topics such as custom value retrievers and comparers, gain a competitive edge in your testing endeavors, and understand step argument conversions and their significance in Specflow.

Explore advanced hook concepts, scopes, and asynchronous step definitions. Learn different methods to run your Specflow tests.

Finally, tidy up your project by organizing features, steps, and business models effectively, ensuring a clean and maintainable structure.

By the end of this course, you will be proficient in using Specflow and well-prepared to tackle real-world testing challenges with confidence, gaining the expertise needed to excel in your role.

What You Will Learn

  • Gain fundamental understanding of the Gherkin language
  • Discover how to efficiently run automated tests in parallel using Specflow
  • Explore the versatility of Specflow hooks and their role in controlling functionality
  • Create custom value retrievers and comparers
  • Gain proficiency in step arguments and transformations
  • Delve deep into the world of hook scopes for more effective testing

Audience

This course is designed to cater to a diverse audience; whether you are an experienced automation testing professional looking to enhance your skills or someone passionate about the world of testing, this course is for you. The .NET C# developers seeking to integrate Specflow into their testing practices will find this course invaluable. For business analysts, this course offers a unique opportunity to bridge the gap between business requirements and technical implementation.

All you need is basic C# coding knowledge and a foundational understanding of Gherkin to embark on this transformative learning journey.

About The Author

Tim MacLachlan: Tim MacLachlan is a highly experienced senior/lead developer boasting over two decades of extensive commercial development expertise, which includes an impressive 16+ years of dedicated work with .NET technologies.

As a versatile developer, Tim possesses a diverse skill set that spans the entire software development lifecycle. His proficiencies encompass low-level programming, intricate algorithmic design, architectural planning, business intelligence solutions, analytical systems, and mobile application development.

With a rich portfolio that comprises hundreds of applications, he has made significant contributions to various industries, ranging from commercial aviation and military sectors to banking/finance, retail, and health.

Table of contents

  1. Chapter 1 : Course Introduction
    1. Introduction
    2. Who Is This Course For?
  2. Chapter 2 : Introduction to Behavior-Driven Development
    1. Module Introduction
    2. Behavioral Driven Development - What Is BDD?
    3. What Is Cucumber and What Is Gherkin?
    4. Why Learn Gherkin?
    5. Gherkin - A Universal Language
    6. Gathering Business Requirements
    7. User Stories with Gherkin
    8. Testing with Gherkin
    9. Single Source of Truth
    10. Gherkin Workflow
    11. Module Summary
  3. Chapter 3 : Gherkin Crash Course
    1. Module Introduction
    2. Keywords Introduction
    3. Feature Keyword
    4. Scenario Keyword
    5. Given Keyword
    6. When Keyword
    7. Then Keyword
    8. And Keyword
    9. But Keyword
    10. * (Asterisk) Keyword
    11. Main Keyword Recap
    12. Rule Keyword
    13. Background Keyword
    14. Scenario Outline/Examples Keyword
    15. @ Tag Keyword
    16. Comments
    17. Long Description
    18. Datatable
    19. Multiple Languages
    20. Gherkin Keyword Rules
    21. Module Summary
  4. Chapter 4 : Introduction to Specflow
    1. Module Introduction
    2. What Is Specflow?
    3. Why Learn Specflow as a .NET Developer?
    4. What Is the Purpose of an Acceptance Test?
    5. Types of Specflow Tests
    6. High-Level Specflow
    7. Installing Specflow Extensions for Visual Studio
    8. Installing Specflow Extensions - Visual Studio Code
    9. Test the Specflow Extension - New Specflow Project
    10. Module Summary
  5. Chapter 5 : Getting Started with Specflow - Binding Steps
    1. Module Introduction
    2. Clean Slate Specflow
    3. Creating Specflow Class from Scratch
    4. Binding Steps Introduction
    5. Fixing Unbound Steps
    6. Alternative Binding Styles
    7. Changing Default in Config
    8. Running Tests for the First Time
    9. Module Summary
  6. Chapter 6 : Specflow - How Parameters Are Handled
    1. Module Introduction
    2. Debug Parameters
    3. Strings and Ints Parameters
    4. How Datatables Are Handled in Parameters
    5. Module Summary
  7. Chapter 7 : Gherkin Datatables - Specflow Table Assist
    1. Module Introduction
    2. Table Assist Helper
    3. Create Instance Helper Method
    4. Assert Using Helper Method CompareToInstance
    5. Assert Using Helper Method CompareToSet
    6. Fixing Implementation
    7. Module Summary
  8. Chapter 8 : Introduction to Specflow Hooks
    1. Module Introduction
    2. Hooks introduction
    3. Hooks Logging
    4. Output API Overview
    5. Why Use Hooks?
    6. Hook Order
    7. Test Run Assembly Location
    8. Passing in Context Dependencies into Hooks
    9. Getting Error Test Property in Hooks
    10. Module Summary
  9. Chapter 9 : Splitting Features and Steps
    1. Module Introduction
    2. Ignore and Context Pending
    3. Organizing Features and Steps Ideas
    4. Refactor with Split Step Files
    5. Refactor Without Static in Split Files
    6. Module Summary
  10. Chapter 10 : Sharing Data in Specflow - Context and Dependency Injection
    1. Module Introduction
    2. Specflow Context System - Using System Property Bag
    3. Merging Scenario Context Properties into One
    4. Context Base Class Approach
    5. Base Class Scenario Context with Dependency Injection
    6. Built-In Dependency Injection
    7. Sharing Data Method - Comparison Roundup
    8. Module Summary
  11. Chapter 11 : Advanced Specflow - Value Retrievers
    1. Module Introduction
    2. Value Retrievers Datetime
    3. Value Retrievers Enum
    4. Custom Value Retriever
    5. Custom Comparer
    6. TD Custom Value Retriever Boolean
    7. Custom Value Retriever - UserType Challenge
    8. Custom Value Retriever - UserType Challenge Solution
    9. DateTime Null Values
    10. Interpret Nulls with Null Value Retriever
    11. Custom String Retriever Handle Nulls
    12. Custom Retriever Comma-Separated List
    13. Dynamic Data Custom Value Retriever
    14. Module Summary
  12. Chapter 12 : Step Argument Conversions
    1. Module Introduction
    2. About Step Argument Conversions
    3. Step Argument Conversion Challenge
    4. Step Argument Conversion Challenge Solution
    5. IEnumerable Table Step Argument Transformation
    6. Step Argument Order Precedence
    7. Module Summary
  13. Chapter 13 : Advanced Specflow - Hooks and Scopes, Async
    1. Module Introduction
    2. Async Step Definitions
    3. Hook Scope Restriction
    4. Hook Scope Restriction - Multiple As OR
    5. Hook Scope Restriction - Feature Level
    6. Hook Scope As AND
    7. Scoped Bindings Step Definitions
    8. Module Summary
  14. Chapter 14 : Running Tests with Specflow
    1. Module Introduction
    2. Trait View Test Explorer
    3. Commandline dotnettest
    4. Commandline vstestconsole
    5. Azure Integration
    6. Parallelize Tests MsTest
    7. Parallelize Tests NUnit
    8. Parallelize Tests XUnit
    9. Parallelize Tests Specflow Runner
    10. Module Summary
  15. Chapter 15 : Organizing Features and Steps
    1. Module Introduction
    2. Tidy Up Project Separate Feature Files – Part 1
    3. Tidy Up Project Separate Feature Files - Part 2
    4. Tidying Up Project - Separate Business Models
    5. Module Summary
  16. Chapter 16 : Conclusion
    1. Thanks for Learning!

Product information

  • Title: Specflow and Cucumber for .NET Developers - The Master Guide
  • Author(s): Tim MacLachlan
  • Release date: October 2023
  • Publisher(s): Packt Publishing
  • ISBN: 9781835462782