From 5b66481000e7cd2c67506b3495930bd154c6a9f1 Mon Sep 17 00:00:00 2001 From: Andreas Willich Date: Fri, 17 Jul 2020 14:59:40 +0200 Subject: [PATCH] Adjust documentation for changes after 3.3.30 (#2054) --- docs/Guides/UpgradeSpecFlow2To3.md | 2 -- docs/Installation/NuGet-Packages.md | 4 ++-- docs/Installation/SpecFlow-and-.NET-Core.md | 20 ++++++++++---------- docs/Tools/Generate-Tests-From-MsBuild.md | 21 +++++++++------------ 4 files changed, 21 insertions(+), 26 deletions(-) diff --git a/docs/Guides/UpgradeSpecFlow2To3.md b/docs/Guides/UpgradeSpecFlow2To3.md index f198c66d7..9820fb1bb 100644 --- a/docs/Guides/UpgradeSpecFlow2To3.md +++ b/docs/Guides/UpgradeSpecFlow2To3.md @@ -36,7 +36,6 @@ To upgrade a solution from SpecFlow 2.x to SpecFlow 3: - SpecFlow.MsTest - SpecFlow.NUnit -1. Add the SpecFlow.Tools.MsBuild.Generation NuGet package to your project. This package is used to generate SpecFlow’s code-behind files. 1. Remove “SpecFlowSingleFileGenerator” from the Custom Tool field in the Properties of your feature files. ## Updating SpecFlow+ Runner @@ -51,7 +50,6 @@ To update SpecFlow and SpecFlow+ Runner: 1. Install/update the following packages: - SpecFlow - SpecRun.SpecFlow - - SpecFlow.Tools.MsBuild.Generation 1. Remove “SpecFlowSingleFileGenerator” from the Custom Tool field in the Properties of your feature files. ### SpecFlow+ Runner Report Templates diff --git a/docs/Installation/NuGet-Packages.md b/docs/Installation/NuGet-Packages.md index 06fcacfe5..8acbcf3f2 100644 --- a/docs/Installation/NuGet-Packages.md +++ b/docs/Installation/NuGet-Packages.md @@ -38,11 +38,11 @@ This package enables the code-behind file generation at build time. #### >= 3.0 -It is **mandatory** for projects in the SDK- Style format. +It is **mandatory** for projects to use. After SpecFlow 3.3.30 this is a dependency of the `SpecFlow.xUnit`, `SpecFlow.NUnit`, `SpecFlow.MSTest` and `SpecRun.SpecFlow.3-3-0` packages. #### < 3.0 -This package is optional, because the code- behind file generation is done in the most cases by Visual Studio. But it is highly recommendated to use it. +This package is optional, because the code- behind file generation is done in the most cases by Visual Studio. But it is highly recommended to use it. ### SpecFlow.xUnit diff --git a/docs/Installation/SpecFlow-and-.NET-Core.md b/docs/Installation/SpecFlow-and-.NET-Core.md index 598f0f805..605f4cf74 100644 --- a/docs/Installation/SpecFlow-and-.NET-Core.md +++ b/docs/Installation/SpecFlow-and-.NET-Core.md @@ -1,3 +1,5 @@ +# .NET Core + **Note:** Support for .NET Core is only available from SpecFlow 3 onwards. Setting up SpecFlow to work with .NET Core projects in SpecFlow 3 is different from configuring projects using .NET Framework in previous versions of SpecFlow. @@ -5,6 +7,7 @@ Setting up SpecFlow to work with .NET Core projects in SpecFlow 3 is different f For details on the general configuration of SpecFlow, see [[Configuration]]. ## Prerequisites + Microsoft.NET.Test.Sdk 15 or higher is required. If you have not installed the SDK, please do so. ## Ensure Your Visual Studio Extension is Up-to-date @@ -19,12 +22,11 @@ To do so: ![Automatically update this extension](https://specflow.org/wp-content/uploads/2018/10/Disable-Extension-Updates-e1540466494951.png?_t=1540466495) 1. 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. - ## Configuring the Unit Test Provider The configuration is no longer 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.1.0 +* SpecRun.SpecFlow-3.3.0 * SpecFlow.xUnit * SpecFlow.MsTest * SpecFlow.NUnit @@ -38,7 +40,6 @@ To add the required packages:
  • Install/update the following packages as required:
  • @@ -47,13 +48,13 @@ To add the required packages: ## Configuration Options -When using .NET Core, [[configuration]] options must be configured in the new `specflow.json` configuration file. This file is optional when using the Full Framework. +When using .NET Core, [configuration](Configuration.md) options must be configured 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|https://github.com/techtalk/SpecFlow-Examples/tree/feature/netcore-examples/SpecFlow.json]]. +The structure of the .json configuration file reflects the structure of the old app.config. Some examples can be found [here](https://github.com/techtalk/SpecFlow-Examples/tree/feature/netcore-examples/SpecFlow.json). **Example:** The following sets the feature file language is set to “de-AT”. -``` +``` json { "language": { @@ -62,13 +63,12 @@ The structure of the .json configuration file reflects the structure of the old } ``` -For more details, refer to the [[configuration]] section. +For more details, refer to the [configuration](Configuration.md) section. ## Generating Code-behind Files with MSBuild -You need to use the SpecFlow.Tools.MsBuild.Generation NuGet package to generate the code-behind files, see [[here|https://specflow.org/documentation/Generate-Tests-from-MsBuild/]]. - +You need to use the SpecFlow.Tools.MsBuild.Generation NuGet package to generate the code-behind files, see [here](../Tools/Generate-Tests-From-MsBuild.md). ## Sample Projects -.NET Core versions of the example projects are located [[here|https://github.com/SpecFlowOSS/SpecFlow-Examples/tree/feature/netcore-examples/]]. +.NET Core versions of the example projects are located [here](https://github.com/SpecFlowOSS/SpecFlow-Examples/tree/feature/netcore-examples/). diff --git a/docs/Tools/Generate-Tests-From-MsBuild.md b/docs/Tools/Generate-Tests-From-MsBuild.md index b23b39536..59f9de1a3 100644 --- a/docs/Tools/Generate-Tests-From-MsBuild.md +++ b/docs/Tools/Generate-Tests-From-MsBuild.md @@ -2,7 +2,8 @@ ## General -We **strongly recommend** using MSBuild to generate your code-behind files. To do so, you simply need to add the [SpecFlow.Tools.MsBuild.Generation nuget package](https://www.nuget.org/packages/SpecFlow.Tools.MsBuild.Generation/) to your project. +You need to use the MSBuild code behind file generation for SpecFlow 3.0. +Version after SpecFlow 3.3.30 don't need to add the `SpecFlow.Tools.MSBuild.Generation` package anymore to your project, if you are using the `SpecFlow.NUnit`, `SpecFlow.MSTest`, `SpecFlow.xUnit` or `SpecRun.SpecFlow.3-3-0` package. **Note:** You will need at least VS2017/MSBuild 15 to use this package. @@ -12,8 +13,8 @@ We **strongly recommend** using MSBuild to generate your code-behind files. To d 2. Remove all `SpecFlowSingleFileGenerator` custom tool entries from your feature files.
    3. Select Tools | Options | SpecFlow from the menu in Visual Studio, and set Enable SpecFlowSingleFileGenerator CustomTool to "false". - ### SDK Style project system + Please use the SpecFlow 2.4.1 NuGet package or higher, as this version fixes an issue with previous versions (see *Known Issues* below) ## Additional Legacy Options (Prior to SpecFlow 3) + The `TechTalk.SpecFlow.targets` file defines a number of default options in the following section: ```xml @@ -31,6 +33,7 @@ The `TechTalk.SpecFlow.targets` file defines a number of default options in the false ``` + * `ShowTrace`: Set this to true to output trace information. * `OverwriteReadOnlyFiles`: Set this to true to overwrite any read-only files in the target directory. This can be useful if your feature files are read-only and part of your repository. * `ForceGeneration`: Set this to true to forces the code-behind files to be regenerated, even if the content of the feature has not changed. @@ -54,22 +57,16 @@ To change these options, add the corresponding element to your project file **be ``` - - - ## Known Issues + ### SpecFlow prior to 2.4.1 + When using SpecFlow NuGet packages prior to SpecFlow 2.4.1, Visual Studio sometimes does not recognize that a feature file has changed. To generate the code-behind file, you therefore need to rebuild your project. We recommend upgrading your SpecFlow NuGet package to 2.4.1 or higher, where this is no longer an issue. ### Code-behind files not generating at compile time + When using the classic project system, the previous MSBuild target may no longer be located at the end of your project. NuGet ignores entries added manually. NuGet places the MSBuild imports at the end. However, the `AfterUpdateFeatureFilesInProject` target needs to be defined after the imports. Otherwise it will be overwritten with an empty definition. If this happens, your code-behind files are not compiled as part of the assembly. ### Linked files are not included -If you link feature files into a project, no code-behind file is generated for them (see GitHub Issue [1295](https://github.com/techtalk/SpecFlow/issues/1295)). - +If you link feature files into a project, no code-behind file is generated for them (see GitHub Issue [1295](https://github.com/techtalk/SpecFlow/issues/1295)).