What’s new in v1.9

Posted on:

This is our latest release, supporting Visual Studio 2008, 2010, 2012, MonoDevelop 3, SharpDevelop 4, MsBuild and NuGet. SpecFlow 1.9 feature tests can be written for the platforms .NET 3.5, 4.0, 4.5, Mono, Silverlight 3, 4, 5, Windows Phone 7.

This page contains some useful information about the new features in SpecFlow 1.9.
(New to SpecFlow? Continue reading here.)

Installing SpecFlow IDE integration

SpecFlow v1.9 adds support for Visual Studio 2012 integration.

Installing IDE integration

If you have installed SpecFlow integration for VS2010 through an MSI package previously, please uninstall the MSI before installing directly from the IDE.

SpecFlow IDE integration vs. runtime

The SpecFlow IDE integration is independent of the SpecFlow runtime. We recommend to always upgrade to the latest IDE integration, regardless of what SpecFlow runtime you are using in each project. SpecFlow IDE integrations are backwards compatible with SpecFlow runtimes from v1.7 on.

Installing SpecFlow runtime

The SpecFlow runtime library is installed per project, and you need to explicitly upgrade each project to newer runtimes. Upgrading the SpecFlow IDE integration does not automatically upgrade the SpecFlow runtime used in your projects.

We strongly recommend using NuGet for managing the SpecFlow runtime dependencies in your project instead of manually adding the runtime references.

While we always recommend upgrading to the latest SpecFlow runtime with each release, it is possible to use older versions of the SpecFlow runtime with the latest SpecFlow IDE integration.

What’s new in SpecFlow 1.9

Key features

Navigation from step definitions to step usages (Alt+Ctrl+Shift+S)

With this new feature, you can track how your step definitions are used in the feature files. Just place your cursor into a step definition method and invoke “Go To SpecFlow Step Definition Usages” from the context menu or simply press Alt+Ctrl+Shift+S (configurable). You will be given a list of usages that you can use to jump to the feature files immediately.

Go To Steps in action


If you are already in the feature file, you can use the Alt+Ctrl+Shift+S keyboard shortcut (or invoke “Go To Step Definition” from the context menu) to jump back to the code.

Generate step definition skeletons from feature files (with custom templates)

Nothing is more boring then preparing the step definition skeletons of a freshly authored SpecFlow scenario. It the steps contain parameters, this takes even more time. This new feature makes much more fun!

Select “Generate Step Definitions” from the context menu of the feature file and the appearing dialog will guide you how to create a new binding class with the step definitions for the selected unbound steps. You don’t have to care about parameters: the most common parameter usage patterns (quotes, apostrophes, numbers) are detected. You can also choose from different step definition styles, including the new regex-less formats (see below).

Generate step definition dialog


The same skeleton generator engine is used by the SpecFlow runtime (when you execute a scenario with unbound steps) and also in the “Go To Definition” command. You can specify the default generation style in the app.config.

If you want to include a custom using statement or a base class declaration to the generated step definition skeletons, you can also customize the templates! Just place a text file called SkeletonTemplates.sftemplate into the SpecFlow folder inside your local app data and override the necessary templates. (Read more about the format here.)

Sample skeleton template for generating the classes in C#


Highlight unbound steps and step parameters in the editor (beta)

Do you want to check the binding status of the steps in a scenario? Do you want to have better readable scenarios by highlighting the parameters? This is now possible with this new editor feature: the parameters of the bound steps will be highlighted and unbound steps will be displayed in purple. (You can configure the colors of course.)

Highlight unbound steps and step parameters in the editor


Note: This is a beta feature. In case of big trouble, you can switch it off from Visual Studio: Tools/Options/SpecFlow. Currently, we cannot detect unbound step templates in scenario outlines.

Step Definitions without Regular Expressions (beta)

If you are one of those who think that regular expressions are too complex and technical for defining step definitions or just simply want to write (and maintain) less code, you should check this out.

For steps that need only simple text and parameter matching, you can now define the step definitions without regular expressions. Simply name your method with underscores between words or using Pascal-case syntax and annotate them with an empty [Given], [When] or [Then] attribute: SpecFlow will recognize them as step definitions! You can also refer to parameters by index or by the parameter name! (See all details here.)

Calculator step definition without Regex


You can define your step definitions without regex, but you can still use regex! The regex-style definition will always be supported for special cases or for regex-loving geeks.

Note: We are still collecting experience about how this feature can work the best, especially about the parameter substitution. We might need to fine-tune the rules in the upcoming versions.

F# step definitions

F# is a popular functional language on the .NET platform. Now you can take the advantages of the F# language for writing step definitions: you can define regex-named F# functions for your steps. Simply put the regex between double backticks:

Step definitions in F# with regex method names


Note: You need to create a C# or VB project for hosting the feature files and configure your F# project(s) as external binding assemblies. Read more here about F# SpecFlow support

Visual Studio 2012 generic test runner support

The SpecFlow IDE integration is now supporting to trigger SpecFlow feature file execution for the newly introduced VS2012 test runner infrastructure. This means, the following test runner infrastructures are now supported by SpecFlow: VS2012, ReSharper, SpecRun, MS-Test Runner (in VS2010).

SpecFlow can automatically detect and use the new test runner in VS2012.
With the new VS2012 test runner, you can execute SpecFlow scenarios based on all supported unit testing platforms (e.g. NUnit, xUnit, MS-Test), and jump from the test explorer directly to the related feature files.

SpecFlow scenarios executed with the VS2012 test runner


Further new features

New and updated NuGet packages
all based on the SpecFlow package, allowing easy configuration possibilities

  • SpecFlow.xUnit – to setup SpecFlow with xUnit in one step
  • SpecFlow.NUnit – following the new packaging model of NUnit, this package is prepared for using SpecFlow with the NUnit runtime (but not with the NUnit runners)
  • SpecFlow.NUnit.Runners – in addition to the SpecFlow.NUnit package, this package contains the necessary add-on for the NUnit runners
  • SpecFlow.CustomPlugin – for developing custom plugins (e.g. custom generators) for SpecFlow
Plugin Infrastructure
SpecFlow is providing an improved plugin infrastructure for customization.
Better Guid support in bindings
You can have Guid parameters in the step definition methods and you can provide partially specified Guids (will be filled with trailing zeroes) as step arguments or table conversions.
Other Visual Studio editor enhancements
  • Comment/uncomment feature file lines using the standard Visual Studio or ReSharper commands
  • Cached step analysis for faster solution startup – the result of the step analysis will be stored in the local temp folder, so that only an incremental analysis has to be performed on solution open
  • Resolved conflicts with SharePoint feature files
  • Support for ReSharper command shortcuts (when ReSharper is installed): commenting, navigation, test execution
  • Support for tracking files changed outside of Visual Studio (e.g. after a git pull)
  • Analyzing bindings in assembly references

For the complete list of features and bugfixes, check out our detailed changelog.

Redesign: SpecFlow logo and website

With this release we have also refreshed the SpecFlow logo.

We are currently working on the relaunch of the SpecFlow website:

Explore the SpecFlow eco-system

Check out the products that make SpecFlow even more powerful

  • SpecFlow+ Runner (formerly known as SpecRun) – smarter integration test runner for SpecFlow
  • SpecFlow+ Excel – collaborate with business using Given/When/Then directly in Excel
  • SpecLog – living documentation system based on SpecFlow
  • Contact us if you want to be listed here!

Want to learn more?