August 24, 2018

Running SpecFlow Scenarios in Parallel

As of SpecFlow version 2.0, you can run scenarios in parallel. This means faster execution times and faster feedback in your continuous integration process. Memory Isolation To enable parallel execution, you must use a test runner that supports it. Available runners include NUnit 3.0, xUnit 2.0, and the SpecFlow+ Runner (specrun). Specrun is a commercial product, but it has advanced features like memory isolation via an app domain or process. NUnit and xUnit don’t support memory isolation, so they requre your tests to be thread safe. Read more

August 13, 2018

Reusable Bindings in SpecFlow

As your application grows, your SpecFlow test suite needs to grow with it. Reusable bindings are essentional to prevent your code from becoming a bloated mess. Fortunately, the SpecFlow runtime has reusability in mind with a built-in inversion of control (IoC) framework and step argument transformations. With these features you can create reusable bindings that make test creation more productive. Problems with Inheritance Before digging into IoC, I’ll take a moment to cover why you shouldn’t use inheritance in your bindings. Read more

August 10, 2018

Working Effectively with SpecFlow Tables

The Gherkin DSL defines data tables as a way of passing a list of values to a step definition. Gherkin tables use the pipe character | to delimit column names and values. They’re easy to read and understand by both business and technical people. While they work great in Gherkin, tables don’t translate well to strongly typed .NET languages. They are converted to an instance of the Table type in SpecFlow bindings. Read more

August 10, 2018

Gherkin Tips

[Gherkin] is a Business Readable, Domain Specific Language that lets you describe software’s behaviour without detailing how that behaviour is implemented. - Gherkin Wiki These Gherkin best practices were originally included in an early draft of a talk I gave on SpecFlow. Ultimately, I took them out because they didn’t fit well with the topic, so I put them into a blog post. Table values should be atomic Bindings that take a table argument will almost always convert the table to a C# object for easy manipulation. Read more

August 8, 2018

SpecFlow Basics

SpecFlow is hands down my favorite testing tool. I’ve been blogging about it since 2013 covering mostly advanced topics. In this post, I’ll go back to the beginning and briefly cover the basics to give you an idea of what it can do. What is SpecFlow? SpecFlow is a tool that allows you to: Define, manage, and automate human-readable acceptance tests in .NET. Enable BDD with easy to understand tests. Read more

December 14, 2017

The C# Language - Overflow Checking for Integral Operations

The C# language has been around for over 15 years. It started off as a Java ripoff and evolved into its own language. Some parts of the language I use daily: enumerators, generics, async/await. Other parts lurk in the shadows until the rare moment when I need to put them to use. One such part is overflow checking for integral operations. Compiler Option By default, integral operations are not checked for overflows either by the C# compiler or at runtime. Read more

© Joe Buschmann 2020