1
votes

I'm starting with BDD and spec-flow in C# and Visual Studio. I was following a tutorial at https://www.toolsqa.com/specflow/set-up-specflow/ to set up a project but I cannot be shown the tests in visual studio 2017 to run.

The steps I take are the following:

  1. I create a project as a class library in the .NET Framework
  2. I add spec-flow to the project
  3. I add the NuGet Nunit test adapter and Nunit Framework (version3)
  4. I generate the .feature file
  5. I generate the file steps associated with the feature.
  6. I compile the solution but in the test window I don't see any tests that run

I searched for several tutorials but I can't find what my mistake is or what I'm missing.

Can anyone help me?

5
This tutorial was made for Specflow 2. There is a latest version of Specflow 3. Go through this tutorial specflow.org/2019/updating-to-specflow-3 - Devdutta Goyal

5 Answers

2
votes

Install the "SpecFlow.Tools.MsBuild.Generation" nuget package and rebuild the solution. That should get you going.

0
votes

We have a "Getting started" guide on the website: https://specflow.org/getting-started/

Also we have some examples here: https://github.com/techtalk/SpecFlow-Examples

You could compare your project with the example if you missed something.

0
votes

I had the same issue . And when I upgraded my specflow to 3.0.213 , feature.cs and tests were not generated in test explorer. Then I used this MSBUild example with latest specflow to generate feature.cs and tests in test explorer. It uses MSTest as test runner and not Nunit. If test runner doesn't matter to you, use this example. I am running it on visual studio 2019

0
votes

Had the same issue,

Besides adding the nuget package

SpecFlow.Tools.MsBuild.Generation

as Meza mentioned.

The testes did not appear in the Test Explorer before i added

SpecFlow.NUnit.Runners

besides already having

SpecFlow

SpecFlow.NUnit

NUnit

NUnit3TestAdapter

and the Visual Specflow extension

(VS2019, Specflow 3.1.67)

-2
votes

It is better for you to use visual studio 2015 to do the same things that you want.