June 27, 2020

What Does It Mean to Pass a Reference Type Variable by Reference?

Value and Reference Types Before we get to the answer, let’s review the two basic types in .NET: value types and reference types. Variables of value types directly contain their data according to the Microsoft docs. If you assign one value type variable to another, the .NET runtime will make a copy of its data. Operations on one variable will not affect another (with one exception as we’ll see). Value types are defined as structures or enumerations, and examples include the . Read more

February 11, 2020

8 Steps to a Better Console Application

Despite its apparent simplicity, writing a good console application is more difficult than you would expect. Many developers get the basics wrong and limit the effectiveness of their software as a result. In the 1970s, Doug McIlroy first expressed the Unix Philosophy for building apps with a good CLI. It was later summarized by Peter H. Salus in A Quarter-Century of Unix (1994). The Unix Philosophy Write programs that do one thing and do it well. Read more

August 31, 2018

Scaling SpecFlow

In July of 2018, I gave a talk at KCDC titled SpecFlow: Moving Beyond the Basics. Afterward, I changed the title to Scaling SpecFlow to more accurately reflect the topic. You can find the updated slide deck at https://joebuschmann.github.io/scaling-specflow. Over the next few weeks, I created a series of posts, one for each section of the talk, for those of you who perfer blog posts to slide decks. This page aggregates these pages in one place and takes you through each one in order. Read more

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

© Joe Buschmann 2020