SpecFlowOSS / SpecFlow.VS

The next version of the Visual Studio extension for SpecFlow
MIT License
36 stars 10 forks source link

Specflow nUnit tests do not run in Visual studio 2022 #122

Open VijayaSree2019 opened 1 year ago

VijayaSree2019 commented 1 year ago

SpecFlow Version

3.9.8

Which test runner are you using?

NUnit

Test Runner Version Number

NUnit.3.13.1

.NET Implementation

equal or greater .NET Framework 4.6.1

Project Format of the SpecFlow project

Classic project format using packages.config

.feature.cs files are generated using

SpecFlow.Tools.MsBuild.Generation NuGet package

Test Execution Method

Visual Studio Test Explorer

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

Gherkin Project where Specflow Feature files reside. <?xml version="1.0" encoding="utf-8"?>

Steps project <?xml version="1.0" encoding="utf-8"?>

Issue Description

MY Test solution works perfectly in Visual Studio 2019 . But now I need to move to Visual Studio 2022 in order to proceed to .net core.

However the basic problem is when I open the same solution in VS 2022 , the steps turn purple. I have got the latest Specflow extension installed for 2022. Cleared all the stepmaps, cache etc. Deleted all the bin/obj, rebuilt the solution etc. All the steps are bound.

This is so frustrating and I tried upgrading to Specflow 3.9 suite but that got me into further problems.

Why is this not so straightforward.

Could you please suggest what additional things need to be done.

Steps to Reproduce

Visual Studio 2022.

Link to Repro Project

No response

VijayaSree2019 commented 1 year ago

I also got specflow.json existing in the steps project

VijayaSree2019 commented 1 year ago

However I struggled to make the step bindings work somehow , now I am able to navigate to the steps in Visual studio 2022, but when I run the tests in VS (nUnit), they don't run. I tried to find the stepmap in my Temp, but I can't find it. However I can see that the Specflow output says 790 step definitions discovered.

Info: OnActivityStarted: Starting Visual Studio Extension... Info: CreateProjectScope: Initializing project: Anz.Com.Ipm.Drumstick.Tests.BVT Info: OnSettingsInitialized: Project settings initialized: .NETFramework,Version=v4.8,SpecFlow:3.9.8,x64 Info: ThenImportStepDefinitions: 789 step definitions discovered for project *.BVT Info: PerformJump: Jumping to Defined: [When(update facility with the following data)]: FacilitySteps.WhenUpdateFacilityWithNewDataUsing(Table) at *****SpecflowSteps\Steps\FacilitySteps.cs(1166,9)

When I run the test No matching step definition found for one or more steps. using System; using TechTalk.SpecFlow; image

I have made my specflow.json as Copy Always

VijayaSree2019 commented 1 year ago

image

VijayaSree2019 commented 1 year ago

image I am using Specflow 4 suite and VS 2022 and .net 6 for the specflow feature project. Still the steps are purple and it is not generating the step map . The feature.cs files are generated using Specflow 4.

Here is the Specflow log:

Info: OnActivityStarted: Starting Visual Studio Extension... Info: CreateProjectScope: Initializing project: Anz.Com.Ipm.Drumstick.Tests.Automation Info: OnSettingsInitialized: Project settings initialized: .NETCoreApp,Version=v6.0,SpecFlow:4.0.31-beta Info: ThenImportStepDefinitions: 0 step definitions discovered for project Anz.Com.Ipm.Drumstick.Tests.Automation