SpecFlow BDD & Selenium WebDriver C#, 5 Day

Behaviour-Driven Development (BDD) has become a well established approach to testing, providing ‘living documentation’ of the system under test, and being able to use the documentation to drive the test automation. Our BDD courses teach you what BDD is all about, how to write your Gherkin Feature files, and then how to bind the test automation code to the features. To learn more about BDD visit this page.

The perfect introductory course on Behaviour-Driven Development. This course covers writing Feature Files in Gherkin, then generating Step Definitions and then writing the code bindings using Selenium WebDriver C#.

This course differs from our other SpecFlow course in that it also starts with a 2 day primer on web automation with Selenium WebDriver. This makes it a very comprehensive course taking the newcomer to WebDriver and SpecFlow and getting them up and running with the whole framework.

Technologies Used

This course uses SpecFlow, NUnit, and WebDriver C# all in Microsoft Visual Development Studio. The course is modular, so can be done using SpecRun (SpecFlow+) as your test runner or NUnit, you can also choose between .NET Core or .NET Framework. If you are unsure, we would recommend NUnit.

Course Delivery

The course is delivered online. It is live, instructor-led training over 5 days. Each day is an online session of approx. 3.5 hours. All delegates receive a comprehensive workbook, and the sessions are recorded. It can be accessed from anywhere in the world. We also offer on-site training at your offices if required.

Course Topics

Course Overview

Installation of the SpecFlow Framework

SpecFlow Visual Studio plugin, installing the SpecFlow Libraries, WebDriver and other dependent libraries. Creating a project structure, creating a Feature File, formatting and execution of Feature Files

Writing your First WebDriver Test Case

Creating our initial NUnit Test, the import statements, invoking a browser, writing to the console, writing a simple script against the Web Site

Recording Tools

Recording & Exporting Scripts using Selenium IDE

Object Identification

Element locator strategies, Chrome Developer Tools and other extensions, Regular Expressions, Index, Xpath functions

Synchronisation

What is Synchronisation, Adding Delay, Implicit versus Explicit Waits, common examples

Capturing Values and Validation

How to capture values from the Web Site, Using Asserts, Execution Flow, Debugging Tools

Introduction to BDD

A background to BDD and its benefits. The process of BDD. An overview of the tools available, terminology.

Introduction to Gherkin

Feature Files, introduction to the Gherkin language, basic syntax

More Gherkin

Using the Background fixture, Parameters, Doc Strings, Examples and Data Tables, using Tags to organise execution, commenting

Step Definitions & Code Binding

Creating our Test Classes, Using prototype step definitions, fixing errors for executing feature files, creating step definition Methods, expanding Methods with Parameters

Deconstructing Step Definitions and Regular Expressions

Step Definition syntax, using Regular Expressions, using multiple annotations for one Method, re-using Methods for more than one Scenario

Handling Tables

Scenario Outline, In-line Step Table Iterating

Hooks

Using a base class with before & after hooks to accelerate test writing.

Executing the SpecFlow Features

Using SpecFlow, Using Tags, Results & Reporting, Command line execution, SpecFlow Fixtures for Execution Flow. Parallel Execution

Sharing Data

Simple Instance Fields, Context Injection

Cross Browser testing

Setup for different web browsers

Integrating SpecFlow into the POM

Using SpecFlow & WebDriver under the Page Object Model.

Continuous Integration

Building SpecFlow pipelines in Azure DevOps

Related Courses: