2

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?

theduck
  • 2,589
  • 13
  • 17
  • 23
mvillegas
  • 57
  • 2
  • 9
  • This tutorial was made for Specflow 2. There is a latest version of Specflow 3. Go through this tutorial https://specflow.org/2019/updating-to-specflow-3/ – Devdutta Goyal Sep 25 '19 at 10:59

6 Answers6

3

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

meza
  • 8,247
  • 1
  • 14
  • 23
0

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.

Andreas Willich
  • 5,665
  • 3
  • 15
  • 22
0

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

user1207289
  • 3,060
  • 6
  • 30
  • 66
0

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)

0

As an update these were the nuget packages I had in place to finally get an example working, using selenium running under NUnit. (It may be useful to someone)

enter image description here

Andrew
  • 2,571
  • 2
  • 31
  • 56
-2

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

Fahim Uz Zaman
  • 444
  • 3
  • 6
  • Why? Is there any reason for dont world find un visual studio 2017? – mvillegas Sep 13 '19 at 06:13
  • Many features like oracle development and other language support would be truncated from Visual Studio 2017 and onward. – Fahim Uz Zaman Sep 13 '19 at 06:16
  • This is incorrect, VS 2017 has more features and is more up to date - it's better than 2015 edition. Oracle has nothing to do with this question, this is about Unit Test's. Ive read a few of your other answers and it's completely opinionated, no code samples, references, and incorrect information. Stick to the Rust stuff you're good at. – Jeremy Thompson Sep 13 '19 at 09:58