SpecFlow Visual Studio Extension Updated

We have released a new version of the Visual Studio Extension that adds two new features.

IntelliSense for Table Column Headings

The auto-complete suggestions now also display column names from tables in your feature files:

A bit thanks to slig3 for adding this feature that will surely be appreciate by many users!

Reformatting Feature Files

This feature adds documenting formatting support to the Gherkin editor:

  • Normalise indents with different indentation levels for different sections, and the ability to choose between tabs and spaces
  • Normalise line breaks
  • Format all tables

There are a number of options that configure the behaviour under Tools | Options | SpecFlow.

Thanks to claudiobernasconi, littlegenius666 and dreamescaper for adding this feature!

Updating to SpecFlow 3

IMPORTANT INFORMATION

Changelogs

You can find an overview of the new features in SpecFlow and SpecFlow+ Runner here. The full changelog for SpecFlow is here.

More information on using SpecFlow with .NET Core can be found here.

Make a Backup!

Before upgrading to the latest version, ensure you have a backup of your project (either locally or in a source control system).

Visual Studio Integration

The Visual Studio integration for SpecFlow has been updated for SpecFlow 3. You will need to update the extension in order to upgrade. If you previously set the extensin to not update automatically, please enable automatic upgrades once your projects have been migrated to SpecFlow 2.3.2 or higher.

WARNING!
The new extension is only compatible with SpecFlow 2.3.2 or higher! Do not upgrade upgrade the SpecFlow Visual Studio integration until you have migrated all your projects to at least SpecFlow 2.3.2, otherwise you will need to switch between Visual Studio extensions whenever you switch between projects.

If you have projects that are using an earlier version of SpecFlow (prior to 2.3.2), you can download previous versions of the extension from this page on GitHub. If you download an earlier version, please make sure you disable the option to update the extension automatically, otherwise it will be automatically updated with the new version again!

To prevent the Visual Studio integration from automatically updating:

  1. Select Tools | Extensions and Updates from the menu in Visual Studio
  2. Locate the SpecFlow extension in the list using the search field on the right, if necessary.
  3. Disable the Automatically update this extension option on the right.
  4. Don’t forget to enable this option again once you have upgraded to SpecFlow 2.3.2 or higher!

App.config Deprecated

Changes to How Unit Test Providers are Configured

In previous versions of SpecFlow, the unit test provider used to execute tests was configured in your app.config file. As of SpecFlow 3, we strongly recommend configuring your unit test provider by installing one of the available packages (see below).

specflow.json

Moving forward, we recommend using specflow.json to configure SpecFlow, rather than app.config. .NET Core projects require specflow.json (app.config is not supported). While using specflow.json is optional for Full Framework projects, we recommend migrating to the new format. For more details, see Configuration in the documentation.

Updating SpecFlow

To upgrade a solution from SpecFlow 2.x to SpecFlow 3:

  1. Open your solution, and check that it compiles, all tests are discovered and that all source files have been committed.
  2. Right-click on your solution and select Manage NuGet Packages for Solution.
  3. Switch to Updates in the list on the left and locate SpecFlow in the list of packages. Use the search box to restrict the listed packages if necessary.
  4. Select the SpecFlow package in the list and click on Update.
  5. Add one of the following packages to your specifications project (the one containing your tests) to select your unit test provider:
    • SpecRun.Runner
    • SpecFlow.xUnit
    • SpecFlow.MsTest
    • SpecFlow.NUnit

    Note: You will receive an error if you add more than one of these packages to your project.

  6. Add the SpecFlow.Tools.MsBuild.Generation NuGet package to your project. This package is used to generate SpecFlow’s code-behind files.
  7. Remove “SpecFlowSingleFileGenerator” from the Custom Tool field in the Properties of your feature files.

Updating SpecFlow and SpecFlow+ Runner

If you want to update both SpecFlow and SpecFlow+ to version 3, the easiest way to do this is to simply upgrade the SpecRun for SpecFlow package. This automatically updates SpecFlow as well.

To update SpecFlow and SpecFlow+:

    1. Open your solution, and check that it compiles, all tests are discovered and that all source files have been committed.
    2. Right-click on your solution and select Manage NuGet Packages for Solution.
    3. Uninstall any SpecRun.SpecFlow packages you have installed.
    4. Install/update the following packages:
      • SpecFlow
      • SpecRun.SpecFlow
      • SpecFlow.Tools.MsBuild.Generation
    5. Remove “SpecFlowSingleFileGenerator” from the Custom Tool field in the Properties of your feature files.

Migrating your License

Prior to SpecFlow 3, licenses were stored in the Windows registry. In order to support .NET Core, the license information is now stored in a file in your local file system. There is also a new licensing tool for .NET Core.

If you have already registered a SpecFlow license, you can migrate your license from the registry to the local file using specrun.exe. Migrate your existing license using the following command:
specrun migrate-license

Information on installing the new licensing tool can be found in the documentation.

Running Tests from the Command Line

The command line tool SpecRun.exe does not work with .NET Core projects. To run your tests, use the following command lines instead (depending on your target framework):

  • dotnet test
    Specify the path to your solution or project, or run the command from that folder. See the documentation here.
  • vstest.console.exe
    Specify the path to your test assembly. See the documentation here.

SpecFlow+ Runner Report Templates

If you have customised the SpecFlow+ runner templares, a small change needs to be made to the template for SpecFlow 3:

  1. Open the CSHTML file in the editor of your choice.
  2. Replace the first line with the following:
    @inherits SpecFlow.Plus.Runner.Reporting.CustomTemplateBase<TestRunResult>

Free merchandising package

Over the past months, many users asked us about SpecFlow merchandising. In particular, we have had requests for stickers for conferences/meet-ups. We have therefore decided to make 2 packages available to the SpecFlow community, one for conferences/meet-ups, and one for contributors to the open source project.

For Conferences, Training, and Meet-ups

SpecFlow has many enthusiastic users from all over the world who regularly get together to share experiences. If you are organizing an event related to SpecFlow or BDD/ATDD/SbE, we can send you a conference package consisting of SpecFlow swag in the shape of various stickers and SpecFlow flyers.

For Contributors

Have you contributed to the SpecFlow open source project and want to show your commitment to the project? As a thank you for contributing, we can send you some SpecFlow stickers so you can help spread the word – and maybe even encourage others to contribute.

SpecFlow Support over the Holiday Period 2018-2019

We hope that you have had a productive year! Given the way the holidays fall this year, we will only be able to provide limited support from 20 December 2018 until the the second week of January. The whole SpecFlow team at TechTalk will be away from 24 December 2018 until 7 January 2019.  Support will return to full capacity on 10 January 2019.

If you are unlucky to have to be work during this period, we thank you for your understanding. Remember that you can always turn to the Google group for help from other members of the community.

Happy Holidays!

SpecFlow 3 VSIX Considerations

As announced here, we need to update the SpecFlow Visual Studio extension (VSIX) for SpecFlow 3. The updates mean the new extension will not be compatible with older versions of SpecFlow ( <2.3.2). We plan to update the SpecFlow Visual Studio extension with the SpecFlow 3-compatible version when SpecFlow 3 is officially released. Note that a preview version of SpecFlow 3 is currently available, more details can be found here.

By default, the extension updates automatically, which will break older projects using versions of SpecFlow prior to 2.3.2. An alternative approach would be to release a dedicated SpecFlow 3 extension. There would then be two separate extensions for SpecFlow, which would avoid the automatic update from breaking old projects. However, we ended up discounting this approach for a number of reasons that are summarised below. Each approach has disadvantages and could potentially cause projects to stop working.

Approach 1: Release a New SpecFlow 3 Extension

In this case, we would release a new VSIX for SpecFlow 3, and leave the current extension online for users of earlier versions.

Pros

  • Users of earlier versions do not have to do anything (i.e. disable automatic updates) to prevent their projects from breaking.

Cons

  • Having two separate versions of a SpecFlow 3 extension in the gallery will cause confusion. Some users will invariably install the wrong version, increasing the number of support issues. This will persist for as long as both extensions are available, i.e. way past the transition period where most users will have migrated from 2 to 3.
  • There will be conflicts if both extensions are installed. There is no way to guarantee that only one of the extensions is installed.
  • Users suddenly need another extension for what appears to be “no good reason”.
  • Punishes users who consistently update to new versions, as these are the ones who need to jump through hoops to use the new release.

Approach 2: Upgrade the Existing Extension

In this case, we would update the existing VSIX for compatibility with SpecFlow 3.

Pros

  • While there may be some short-term confusion and support requests relating to projects suddenly not working (automatic update), these will die down quickly. After ~6 months, the dust will probably have settled.
  • All users will have their extension automatically upgraded to be compatible with the latest version. This is how it has always been.

Cons

  • Requires users not interested in Specflow 3 to make changes to their setup to avoid breaking changes. However, this is a one-off and involves clicking a check box.
  • There will invariably be some users who need to continue using SpecFlow <2.3.2 for now, and who will forget that automatic updates need to be enabled when they make the switch to version 3. Again, the number should decrease as time goes on.

With that in mind, we feel that upgrading the existing extension is better approach. It will cause some teething problems for a few months while the switch is made. After a while, the dust will settle. Conversely, we feel that providing two separate extensions runs the risk of causing confusion due to multiple versions of the extension, and the confusion will persist indefinitely. It will not simply die down after a few months if there are two mutually exclusive extensions available for download.

Your thoughts?

If you think we have overlooked some important aspects or have have alternative suggestions on how to improve the upgrade experience, please share them in the discussion here.

If you have reasons for using older versions of SpecFlow and do not want to regularly upgrade, let us know your motivation too. Both approaches will make it difficult to work with older SpecFlow versions and SpecFlow 3 on the same machine; we are not sure to what extent this could be an issue.

SpecFlow 3 with .NET Core Support: Public Preview now Available

The stable SpecFlow V3 has been released! Check out our latest blog post!

The first public preview of SpecFlow with support for .NET Core is now available. If you want to try out the new version, please read the following information carefully. There are a number of steps that are necessary before you can use the public preview.

Please report any issues you experience here.

IMPORTANT! If you do not plan on updating to SpecFlow 3 soon, please read this announcement for all current users.

Requirements

.NET 4.7.1 is required. Please ensure you have installed the 4.7.1 framework.

Installing the Preview Visual Studio Extension

SpecFlow 3 requires an update to the Visual Studio extension for SpecFlow. During the preview period, you will need to connect to the following feed to download the preview version of the extension:

https://www.myget.org/F/specflow-vsix/vsix/

To do so:

  1. Select Tools | Options in Visual Studio.
  2. Locate Environment in the list, and select the Extensions and Updates sub-item.
  3. Click on Add to add a new feed.
  4. Give the new source a Name (e.g. “SpecFlow 3 preview”) and enter the source (“https://www.myget.org/F/specflow-vsix/vsix/”).
  5. Select Tools | Extensions and Updates. You should see an update listed on the left.
  6. Click on Updates to update the new extension.

Once a stable version of SpecFlow 3 has been released, the new version of the extension will go live for all users, and you can revert to the standard feed.

Supported Frameworks and Runners

The preview version supports the following test frameworks and runners:

  • SpecFlow+ Runner 3.0 or higher
  • NUnit 3.10 or higher
  • MSTest V2 1.3.2 or higher
  • xUnit 2.4.0 or higher

Installing NuGet Packages and Configuring a Unit Test Provider

The unit test provider is no longer configured in your app.config file. Instead, the unit test provider is now configured using plugins for the desired test frameworks. You will therefore need to add one of the following NuGet packages to your project to configure the unit test provider:

  • SpecRun.Runner
  • SpecFlow.xUnit
  • SpecFlow.MsTest
  • SpecFlow.NUnit

Note: Make sure you do not add more than one of the unit test plugins to your project. If you do, an error message will be displayed.

  1. Right-click on your project, and select Manage NuGet Packages.
  2. Enable the Include prerelease option and search for “SpecFlow”.
  3. Install/update the following packages:
    • SpecFlow
    • SpecFlow.Tools.MsBuild.Generation
    • One of the unit test provider packages (see above).
  4. Install the test runner for your unit test provider (e.g. xunit.runner.visualstudio).

Configuration

Much of the configuration has been moved from the app.config file to other locations. When using .NET Core, you can no longer use the app.config file. You need to set general configuration options in the new specflow.json configuration file. This file is optional when using the Full Framework.

The structure of the .json configuration file reflects the structure of the old app.config. Some examples can be found here.

{
    "language":
    {
        "feature": "de-AT"
    }
}

In the above example, the feature file language is set to “de-AT”. This corresponds to the following entry in the app.config file:

<language feature="de-AT" />

If you are using the Full Framework, some settings are still available in the app.config file. However, much has changed, so please read the details below for information on how to configure SpecFlow 3.

Generating Code-behind Files

specflow.exe has been removed. Please use the SpecFlow.Tools.MsBuild.Generation NuGet package to generate the code-behind files, see https://specflow.org/documentation/Generate-Tests-from-MsBuild/

When using .NET Core or the new project format, it should be enough to simply add the package to your project.

Important Step when Adding Feature Files

When adding a new feature file, several lines are added to your project file including references to the feature file. This is currently necessary for backwards compatibility with older versions. You will need to remove these lines from the project file manually whenever you add a new feature:

To remove these lines:

  1. Right-click on your project in the Solution Explorer and select Edit XYZ.csproj (where “XYZ” is the name of your project).
  2. Delete all elements with references to feature files (see screenshot above).
  3. Build the project again.

Sample Projects

Update .NET Core versions of the example projects are located here:

https://github.com/techtalk/SpecFlow-Examples/tree/feature/netcore-examples/NETCore%20Examples

No Reports Available

Reports have been removed from the main code base and reports are not available in SpecFlow 3.0. For more details, please refer to this GitHub issue.

SpecFlow+ Runner Restrictions

  • When using SpecFlow+ Runner, AppDomain separation is unavailable for .NET Core.
  • There is currently no support for the SpecFlow+ Runner server, meaning that adaptive test scheduling is unavailable.
  • Reports are currently unavailable for .NET Core. Let us know if this is a showstopper for you.

VS Integration Breaking Changes – Affects ALL users!

The stable SpecFlow V3 has been released! Check out our latest blog post!

The upcoming SpecFlow 3 release will require an update to the Visual Studio extension for SpecFlow. Because the extension is normally updated automatically whenever a new version is released, this change has the potential to affect all users, not just those that upgrade to version 3! Please read the following information in detail.

What will break?

The new extension will not be compatible with versions of SpecFlow earlier than 2.3.2. If you are using an earlier version of SpecFlow, you should make sure that you have disabled automatic updates for the SpecFlow extension in Visual Studio. To do so:

  1. Select Tools | Extensions and Updates from the menu in Visual Studio.
  2. Enter “SpecFlow’ in the search field to restrict the entries in the list.
  3. Click on the “SpecFlow for Visual Studio” entry and disable the Automatically update this extension check box.
  4. This will prevent newer versions of the extension from being installed automatically. Once you are ready to upgrade to SpecFlow 3, you can enable this option again.

What limitations are there?

Because the Visual Studio extension can only be installed once per Visual Studio installation, you will not be able to mix SpecFlow 3 projects with projects that use a version of SpecFlow prior to 2.3.2.

How will the update be handled?

Our intention is to release a preview version of the Visual Studio extension that will not trigger automatic updates in Visual Studio for the duration of the preview period. If you want to try out the preview version of SpecFlow 3, you will need to add the feed to Visual Studio manually to install the new version of the extension. We will provide additional details on how to do this once the preview is available.

Once SpecFlow 3 has been officially released, we will update the live Visual Studio extension with the new version. This will cause your extension to automatically update if you have not disabled automatic updates (see above). From this point on, users of older versions of SpecFlow will need to download and install the compatible version of the Visual Studio extension manually and ensure that automatic updates are disabled.

I see a potential pitfall. What should I do?

If you see any potential pitfalls in this approach, please, let us know now! If you have suggestions for how to make this process easier, we would like to hear them! You can contact us at support@specflow.org.

Hacktoberfest – Contribute to Open Source Projects (including SpecFlow)!

Hacktoberfest is an annual event lasting from 1-31 October, aimed at encouraging contributions to open source projects. Hacktoberfest is open to everyone, from seasoned contributors to first-time contributors. During Hacktoberfest, pull requests you contribute to open source projects are counted. The first 50,000 contributors to reach 5 PRs will receive a T-shirt as a thank you. More details and a sign-up link can be found here.

Hacktoberfest’s key values are:

  • Everyone is welcome! Hacktoberfest participants are from around the world and of all skill levels. You are welcome to join in too!
  • Quantity is fun, quality is key! Meaningful contributions to open source both help the project, and help you develop your skills and engage with the community.
  • Short term action, long term impact! Open source projects are built upon the foundations of those who came before. Contributions have a lasting effect on both people and technology far beyond the month of October. Your contributions will be valued for many years to come.

If you would like to take part, we would be happy to see contributions to SpecFlow. The open SpecFlow issues can be found on GitHub here. If you are new to open source development, we would suggest that you take a look at the issues with labels such as “first-timers-only” and “up-for-grabs“. You can see a list of labels and navigate to a list of the issues with that label here.

Xray Support for SpecFlow in JIRA

We are pleased to announce that Xray, a test management solution for JIRA, now supports SpecFlow+ Runner. Many software development teams work with JIRA, but integrating SpecFlow with JIRA can be challenging. Xray helps out by allowing you to manage tests in JIRA, generate the corresponding feature files, and import your test results so they are visible in JIRA itself.

When using Xray, you can choose to edit and manage your scenarios in Jira, or continue working with feature files within your source repository. Both these methods are described here.

If you choose to manage features in JIRA, you can generate the necessary .feature files using the Export to Cucumber option in the user interface:

 

If you choose to manage your features files as part of your repository, there are a few steps you should take, including tagging tests with an ID to ensure they are always mapped to the same test in Xray. These steps are covered towards the end of the page.

In order to generate test results that can be viewed in JIRA, you will need to output your test results as a JSON report using SpecFlow+ Runnner. A suitable template is included with SpecFlow+ Runner (located under Templates in your project’s SpecRun.Runner packages folder). This report can then be imported into JIRA to view the tests’ status there.

If you are interested in finding out more about Xray, there is a short video overview available here. You can find more detailed information, including pricing, on the Atlassian marketplace. There are also regular webinars that walk you through the Xray’s features.

End of Visual Studio 2013 Support Imminent

We will remove support for Visual Studio 2013 with the upcoming release of SpecFlow 3 (due to be released soon). Downloads for the Visual Studio extension account for only a fraction of 1% of all downloads (a ratio of roughly 400:1), so we want to invest our time and resources elsewhere. For this reason, we will no longer support Visual Studio 2013 with SpecFlow 3, meaning there will be no more updates of the VS 2013 integration.

If you are still using Visual Studio 2013 and will want to upgrade to SpecFlow 3, we suggest that you start mapping out your upgrade path so you are prepared for the new release in time.