Skip to content

Commit

Permalink
Adjust documentation for changes after 3.3.30 (#2054)
Browse files Browse the repository at this point in the history
  • Loading branch information
SabotageAndi committed Jul 17, 2020
1 parent 3d2317b commit 5b66481
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 26 deletions.
2 changes: 0 additions & 2 deletions docs/Guides/UpgradeSpecFlow2To3.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/Installation/NuGet-Packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 10 additions & 10 deletions docs/Installation/SpecFlow-and-.NET-Core.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# .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.

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
Expand All @@ -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
Expand All @@ -38,7 +40,6 @@ To add the required packages:
<li>Install/update the following packages as required:
<ul>
<li>SpecFlow</li>
<li>SpecFlow.Tools.MsBuild.Generation</li>
<li><strong>One</strong> of the unit test provider packages (see above).</li>
</ul>
</li>
Expand All @@ -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":
{
Expand All @@ -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/).
21 changes: 9 additions & 12 deletions docs/Tools/Generate-Tests-From-MsBuild.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -12,15 +13,16 @@ We **strongly recommend** using MSBuild to generate your code-behind files. To d
2. Remove all `SpecFlowSingleFileGenerator` custom tool entries from your feature files.<br><img src=http://www.specflow.org/screenshots/CustomTool.png>
3. Select <b>Tools | Options | SpecFlow</b> from the menu in Visual Studio, and set <b>Enable SpecFlowSingleFileGenerator CustomTool</b> to "false".


### SDK Style project system

<b>Please use the SpecFlow 2.4.1 NuGet package or higher, as this version fixes an issue with previous versions (see *Known Issues* below)</b>
<!--
1. Add the NuGet package `SpecFlow.Tools.MsBuild.Generation` with the same version as SpecFlow to your project.
2. Remove all `SpecFlowSingleFileGenerator` custom tool entries from your feature files.<br><img src=http://www.specflow.org/screenshots/CustomTool.png>
-->

## Additional Legacy Options (Prior to SpecFlow 3)

The `TechTalk.SpecFlow.targets` file defines a number of default options in the following section:

```xml
Expand All @@ -31,6 +33,7 @@ The `TechTalk.SpecFlow.targets` file defines a number of default options in the
<VerboseOutput Condition="'$(VerboseOutput)'==''">false</VerboseOutput>
</PropertyGroup>
```

* `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.
Expand All @@ -54,22 +57,16 @@ To change these options, add the corresponding element to your project file **be
</Project>
```

<!--
## Including Feature Files Dynamically
If you are also adding, renaming or deleting feature files outside of Visual Studio, you can include these files in your project dynamically. To do so, add the following lines to your project file in a text editor:
An example can be found [here|https://github.com/techtalk/SpecFlow-Examples/tree/master/BowlingKata/BowlingKata-GenateTestsFromMsBuild]() (project Bowling.SpecFlow.DynamicallyIncludedFeatureFiles)
-->


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

0 comments on commit 5b66481

Please sign in to comment.