Specflow: Specflow.Tools.MSBuild.Generation dll reference not generating tests in test explorer

Created on 12 Jun 2019  Â·  5Comments  Â·  Source: SpecFlowOSS/SpecFlow

SpecFlow Version:

  • [x] 3.0
  • [ ] 2.4
  • [ ] 2.3
  • [ ] 2.2
  • [ ] 2.1
  • [ ] 2.0
  • [ ] 1.9

Used Test Runner

  • [ ] SpecFlow+Runner
  • [ ] MSTest
  • [x] NUnit
  • [ ] Xunit


Version number:

Project Format of the SpecFlow project

  • [x] Classic project format using packages.config
  • [ ] Classic project format using <PackageReference> tags
  • [ ] Sdk-style project format

.feature.cs files are generated using

  • [x] SpecFlow.Tools.MsBuild.Generation NuGet package
  • [ ] SpecFlowSingleFileGenerator custom tool

Visual Studio Version

  • [ ] VS 2019
  • [x] VS 2017
  • [ ] VS 2015

Enable SpecFlowSingleFileGenerator Custom Tool option in Visual Studio extension settings

  • [ ] Enabled
  • [x] Disabled

Are the latest Visual Studio updates installed?

  • [x] Yes
  • [ ] No

.NET Framework:

  • [x] >= .NET 4.5
  • [ ] before .NET 4.5
  • [ ] .NET Core 2.0
  • [ ] .NET Core 2.1
  • [ ] .NET Core 2.2
  • [ ] .NET Core 3.0

Test Execution Method:

  • [ ] Visual Studio Test Explorer
  • [x] TFS/VSTS/Azure DevOps – Task – PLEASE SPECIFY THE NAME OF THE TASK
  • [ ] Command line – PLEASE SPECIFY THE FULL COMMAND LINE

<SpecFlow> Section in app.config or content of specflow.json


Repro Project

Issue Description


I created a SpecFlow project and was wondering if there is a way to use Specflow.Tools.MSBuild.Generation.dll file to generate tests in test explorer. I was able to create feature file and step definitions using TechTalk.SpecFlow.dll file and I thought using the Specflow.Tools.MSBuild.Generation.dll file I would be able to generate tests in test explorer. Is there a way to generate specflow test in test explorer using only dlls?

Steps to Reproduce

Question

Most helpful comment

@adiljs Yes, for SpecFlow 3 you will need the SpecFlow.Tools.MsBuild.Generation package.
It is also necessary, that you always use the NuGet packages and don't use the dlls as direct reference. We rely on NuGet features like automatic MSBuild imports.

All 5 comments

Hi @adiljs,

because the SpecFlow.Tools.MsBuild.Generation package is utilizing MSBuild to generate code-behind files of the feature files, you need to build the test project to generate tests and see them in the Test Explorer window.

Furthermore, simply referencing SpecFlow.Tools.MsBuild.Generation.dll will not help you, because the MSBuild targets for code-behind generation are not in there, but in the .targets file in the NuGet package. Please use the aforementioned NuGet package instead.

Hope this helps, please report back on whether it fixed your issue.

Hi @david1995,

Just for clarity, I will need to have SpecFlow.Tools.MsBuild.Generation package installed on my project in order to build the test project to generate tests in Test Explorer. Is that correct? Because doing so resolved the issue.

@adiljs Yes, for SpecFlow 3 you will need the SpecFlow.Tools.MsBuild.Generation package.
It is also necessary, that you always use the NuGet packages and don't use the dlls as direct reference. We rely on NuGet features like automatic MSBuild imports.

@david1995 @SabotageAndi Thanks for the quick response. I will move forward with your recommendation.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings