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 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.SpecFlow-3.0.0
  • 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.

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).

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 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.

SpecFlow+ LivingDoc New Version and Action Required to Use it

SpecFlow+ LivingDoc has been updated and is now available on the Visual Studio marketplace.

The new version of LivingDoc contains the following new features and bug fixes:

  • Show builds for other branches than master (dropdown menu to select branch)
  • Store the selected build definition/branch per user (instead of per project as before)
  • If there is no successful build on the selected definition/branch yet, we show a message
  • “Queue build” button uses the selected branch, latest commit and current build definition version

Furthermore in the next hours every collection administrator will receive an e-mail with a notification. Because of the changes in this update, LivingDoc needs additional permissions to access your project/repository.

Your notification will look similar to this one.

You will be unable to use the new features until you grant the required permission to LivingDoc!

SpecFlow+ LivingDoc 0.2.2 Released

SpecFlow+ LivingDoc 0.2.2 has been released and is available on the Visual Studio marketplace. This version includes a number of QOL improvements for managing builds:

New features

  • You can now select a project language in the build task itself. The previous fallback was to use English as the language of the feature files. This would cause problems in projects using other languages, if only the folder containing the repository was selected as the source, meaning the language settings in the app.config file were ignored.
  • The build selector is now more streamlined, making it easier to locate the desired build:
    • Builds are sorted alphabetically
    • Only those builds that contain the LivingDoc step are displayed (TFS 2018 and VSTS only!)

Bug Fixes

  • Fixed “The attribute “Update” in element None/Compile is unrecognized” errors
  • Fixed “Not all required parameter are set” when the project path parameter ends with “\”
  • Fixed “System.NullReferenceException” when the project contains empty feature files
  • Fixed issue where Scenario Outline parameters in Table headers are not replaced

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.

SpecFlow+ Runner 1.8 Released

SpecFlow+ Runner 1.8 has been released and is available for download from NuGet. The main changes in this version are:

  • Support for SpecFlow 2.4
  • Change to the behaviour of the test adapter for compatibility with Visual Studio 15.8

This version also includes a number of smaller bug fixes.

SpecFlow 2.4 Released

SpecFlow 2.4 has been released and is now available for download from NuGet. This is likely to be the last release of SpecFlow before we release SpecFlow 3.

SpecFlow 2.4 includes a number of new features:

  • Added ability to convert type to same type or one of the base types #1110
  • Added support for customization of dependency injection at feature level via a runtime plugin event to raise feature dependencies #1141
  • Allow marking steps as Obsolete and have a configurable behavior for it #1140
  • IGherkinParser and IGherkinParserFactory interfaces added to support Gherkin Parser pluggability #1143
  • Assist: remove accents from column headers and property names when comparing objects to a table #1096
  • Added NUnit current TestContext scenario container registration. See #936
  • Array & List support for strings and enums when instantiating class from Specflow table #1018
  • MSBuild: Experimental support for deleting code-behind files on clean and rebuild when MSBuild #1167, #1208
  • MSBuild: Experimental support for Net.SDK project system, only for targeting desktop framework, .net core is supported and won’t work #1223
  • Changed Parameter handling of specflow.exe #1112

There are also a number of bug fixes. The full list of changes can be found here.

 

Don’t forget to regenerate your features and restart Visual Studio after upgrading!

 

SpecFlow and PackageReference

By default, the packages used in SpecFlow projects are stored in packages.config. However the new Visual Studio projects instead use the PackageReference element to reference packages. When using the PackageReference element, generator plugins will not be found, and you will see errors similar to the following:

Unable to find plugin in the plugin search path: SpecRun. Please check http://go.specflow.org/doc-plugins for details.
#error TechTalk.SpecFlow.Generator

This is due to SpecFlow not searching for the package in the correct location. To ensure that the plugin is found, you need to specify the path explicitly in your app.config file.

To do so, enter the path to the appropriate path in the plugins element of your app.config file in this case, e.g.:

<plugins>
      <add name="SpecRun" path="%USERPROFILE%\.nuget\packages\specrun.specflow.2-3-0\1.7.0\lib\net45" />
</plugins>

IMPORTANT! You will need to manually update this path when upgrading to a newer version of the package, as the path contains the version number (e.g. “1.7.0” in the above example).

You can find a sample project using the new project format here. The relevant line in the app.config file is here.

Note: This requires SpecFlow 2.3.2 of higher. This step should not be necessary once SpecFlow 3 is released.