SpecFlow.xUnitAdapter 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package SpecFlow.xUnitAdapter --version 1.1.0
NuGet\Install-Package SpecFlow.xUnitAdapter -Version 1.1.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SpecFlow.xUnitAdapter" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SpecFlow.xUnitAdapter --version 1.1.0
#r "nuget: SpecFlow.xUnitAdapter, 1.1.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SpecFlow.xUnitAdapter as a Cake Addin
#addin nuget:?package=SpecFlow.xUnitAdapter&version=1.1.0

// Install SpecFlow.xUnitAdapter as a Cake Tool
#tool nuget:?package=SpecFlow.xUnitAdapter&version=1.1.0

SpecFlow.xUnitAdapter

SpecFlow.xUnitAdapter is an xUnit adapter for SpecFlow that allows running scenarios without code generation.

Currently supports

  • SpecFlow v2.2
  • xUnit v2.2 or above

License: Apache (https://github.com/gasparnagy/SpecFlow.xUnitAdapter/blob/master/LICENSE)

NuGet: https://www.nuget.org/packages/SpecFlow.xUnitAdapter

See my blog post (http://gasparnagy.com/2017/04/specflow-without-code-behind-files/) for more information and background, you can also look at the complete example at https://github.com/gasparnagy/SpecFlow.xUnitAdapter/tree/master/sample/MyCalculator or watch the video demo on YouTube.

Build status

If you like this plugin and would like to support developing this or similar plugins, please consider donating the project. (For receiving an invoice for your donation, please contact me upfront.)

Donate

Usage

Install plugin from NuGet into your SpecFlow project.

PM> Install-Package SpecFlow.xUnitAdapter

Disable code-behind code generation

To disable the code-behind code generation, you have to REMOVE (set it to empty) the "SpecFlowSingleFileGenerator" "Custom Tool" setting on the file properties of all feature files in Visual Studio.

If you do this, Visual Studio will automatically delete the code behind files and removes them from the project.

Make sure the feature files have a SpecFlowFeature or SpecFlowEmbeddedFeature build action.

The SpecFlow.xUnitAdapter currently processes feature files in the folder (or subfolders) of the SpecFlow project assembly (typically in bin\Debug) and when they are embedded into the assembly.

To achieve that, you should change the Build Action setting of the feature files to SpecFlowFeature if you want them to not be embedded, or SpecFlowEmbeddedFeature if you want them to be embedded in the assembly.

Install xUnit Visual Studio adapter

In order to run the tests from the Visual Studio Test Explorer Window, you can install the xUnit Visual Studio adapter.

PM> Install-Package xunit.runner.visualstudio

Limitations

The adapter is currently in BETA and there are some limitations.

  1. If you use SpecFlowFeature: As Visual Studio Test Explorer window only triggers the re-discovery of tests when the output assembly changes, if you only change the feature files, but nothing else in the code, you need to Rebuild the project in order to see the changes. (This is important only if the change is related to the discovered tests, so for example if you change the scenario name or the examples section of a scenario outline.)
  2. The adapter currently does not load the project-level feature file language setting (but assumes en-US).
  3. For feature files with #language setting, the setting will only be used for data conversions if it is a specific culture (e.g. de-AT). For neutral languages (e.g. de), currently en-US is used for conversions.

For diagnosing test discovery errors, you can add the following setting to the App.config file of the SpecFlow project. With this setting, the test discovery errors are displayed in the Tests pane of the output window.

<appSettings>
  <add key="xunit.diagnosticMessages" value="true"/>
</appSettings>

Release History

Product Compatible and additional computed target framework versions.
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.1 13,214 5/25/2018
1.2.0 3,118 4/11/2018
1.1.0 10,368 10/10/2017
1.0.0 14,576 4/21/2017
1.0.0-pre20170413 839 4/13/2017