December 29, 2014

Code This, Not That - SpecFlow Edition

In 2007 a different kind of diet book was published that took a concise approach to making the right food choices. Readers of the book were presented with good and bad selections at popular restaurants and told why the good options were better than the others. Eat This, Not That! made changing your diet simple and realistic. No gimmicks like the Atkins diet or the current trend of cleansing. Just real options available in many restaurants. Read more

October 18, 2014

Useful Regex for SpecFlow Bindings

Below is a list of useful regular expressions (regex) for annotating SpecFlow bindings. I’m treating this post as a reference and will be updating it with new items from time to time. Singular or Plural Support singular or plural wording. Filter for Enum Values If your binding takes an enumeration for an argument, you can limit the inputs from the Gherkin to just the valid values. In the snippets below, the possible values for the SortOrder argument are limited by the regex (ascending|descending) thus avoiding any runtime exeptions due to a bad value. Read more

September 30, 2014

Strategies for Managing State in SpecFlow

SpecFlow is an extension for Visual Studio that binds software specifications written in the Gherkin language to executable code written in C#, VB, or some other .NET language. One of the challenges of implementing a SpecFlow scenario is how to manage test state in between steps. At first glance, state management seems like an easy problem to solve, but as your test suite grows, maintaining the implementation is as difficult as any large software project. Read more

October 22, 2013

SpecFlow Nested Tables: A Bad Idea

I've been using SpecFlow to write behavior specifications for just under a year, and one question that comes up is whether or not nested tables are supported for creating complex or hierarchal types. Other folks have discussed this at Stack Overflow and Google Groups. Nested tables aren't currently supported, and that's probably a good thing. The intent of the Cucumber syntax is to express business requirements in the language of the business. Read more

July 20, 2013

More SpecFlow Tips

UPDATE (11/18/2016): I’ve written a number of posts since this one was published that cover advanced SpecFlow topics like composable steps, tags done right, managing state, useful regex, etc. For a list of all my SpecFlow writing, you can click on the SpecFlow tag. SpecFlow is a fantastic tool that’s changed the way I develop software, and I hope it does the same for you. Happy testing! My last post covered three tips or best practices for SpecFlow that covered manipulating the current ScenarioContext with extension methods, binding multiple Given/When/Then attributes, and using hooks. Read more

February 17, 2013

Some SpecFlow Tips

UPDATE (11/18/2016): I’ve written a number of posts since this one was published that cover advanced SpecFlow topics like composable steps, tags done right, managing state, useful regex, etc. For a list of all my SpecFlow writing, you can click on the SpecFlow tag. SpecFlow is a fantastic tool that’s changed the way I develop software, and I hope it does the same for you. Happy testing! Late last year a co-worker Jay Brummels introduced our development group to SpecFlow a . Read more

© Joe Buschmann 2020