SpecFlow code examples

Quick start your test automation by using SpecFlow code snippets & plugins

Use our pre-built code examples and quick-start libraries to easily start your automated testing journey, or extend your existing test framework.

View GitHub repo Learn more

Code examples

Short code examples that you can copy straight into your project.

CSV

Code snippets with examples of how to read data from a CSV file

Excel

Code snippets with examples of how to read data from an Excel file

Custom Test Output

Code snippets with examples of how to write custom messages to the output console

Example automation projects

These projects contain working examples of how to test different .NET applications using SpecFlow. These examples use .NET 6

ASP.NET Core web API

A project to test an API based calculator

Class Library

A project to test a C# calculator object

ASP.NET Core Web Application

A project to test an web based calculator

WinForms Application

A project to test a windows form based calculator

WPF Application

A project to test a WPF based calculator

Android Mobile Application

A project to test an Android based calculator


Code libraries

Selenium

A library to handle quick selenium integration that can be extended to suit your needs. It handles the lifetime of your browser and provides easy configuration and helper methods to interact with Selenium.

Playwright

Playwright enables reliable end-to-end testing for modern web apps. Our plugin It handles the initialisation and lifetime of your browser, provides methods to work with your page selectors and a configuration that makes it easy to set up the browser instance.

Docker

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers. This plugin handles starting and stopping docker containers for you at the start and end of your test execution.

Boa Constrictor

Boa Constrictor is a C# implementation of the Screenplay Pattern that helps you make better interactions for better automation. This plugin will help you use Boa-Constrictor together with SpecFlow to use the Screenplay Pattern more easily.

Windows App Driver

Windows Application Driver (WinAppDriver) is a service to support Selenium-like UI Test Automation on Windows Applications. This service supports testing Universal Windows Platform (UWP), Windows Forms (WinForms), Windows Presentation Foundation (WPF), and Classic Windows (Win32) apps on Windows 10 PCs. Use our plugin to easily integrate Windows App Driver with SpecFlow

Android

Our Android plugin uses Appium, an open source test automation framework for use with native, hybrid and mobile web apps. Use our Android plugin to quick start your Android test automation project.

BrowserStack

BrowserStack is a cloud web and mobile testing platform that provides the ability to test websites and mobile applications across on-demand browsers, operating systems and real mobile devices. Use our BrowserStack plugin to quickly integrate with BrowserStack.

Contribute to our open source code!

As all these code examples are open-source, we invite you all to contribute to them. Together we can make test automation even easier!

Contribute now!