SpecFlowOSS / SpecFlow

#1 .NET BDD Framework. SpecFlow automates your testing & works with your existing code. Find Bugs before they happen. Behavior Driven Development helps developers, testers, and business representatives to get a better understanding of their collaboration
https://www.specflow.org/
Other
2.23k stars 752 forks source link

error in feature.cs file generation : The name 'featureTags' does not exist in the current context #2569

Closed DomZZ closed 2 years ago

DomZZ commented 2 years ago

SpecFlow Version

3.9.58

Which test runner are you using?

NUnit

Test Runner Version Number

3.9.58

.NET Implementation

.NET 5.0

Project Format of the SpecFlow project

Sdk-style project format

.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

{ "$schema": "https://specflow.org/specflow-config.json", "generator": { "addNonParallelizableMarkerForTags": [ "nonparallelizable" ] }, "runtime": { "missingOrPendingStepsOutcome": "Error" }, "stepAssemblies": [ { "assembly": "ALOP" } ] }

Issue Description

Many errors in feature.cs files :

`private string[] featureTags = new string[] { "bdes"}; string[] tagsOfScenario = ((string[])(null)); System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary(); TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("BDES-011B Validation saisie des données par gestionnaire", null, tagsOfScenario, argumentsOfScenario, featureTags); this.ScenarioInitialize(scenarioInfo);

if ((TagHelper.ContainsIgnoreTag(tagsOfScenario) || TagHelper.ContainsIgnoreTag(featureTags)))`

In method you use featureTags but variable is named _featureTags ...

Steps to Reproduce

Use SpecFlow last SpecFLow nuget packages Compile solution You should see that all feature.cs files have errors

Link to Repro Project

No response

bollhals commented 2 years ago

Do you have any additional plugins?

The correct name is featureTags after #2410. So the methods are correct, but the field is wrong, I suspect there is an additional plugin that messes with it.

SabotageAndi commented 2 years ago

@DomZZ I created multiple new projects in the last days and they all worked. So it has to be something with your setup of the one project. Please create a new project and take over one configuration at a time from your original project until you find out what is causing this issue.

DomZZ commented 2 years ago

It is exactly like you said, I've removed LivingDoc nuget package and all feature files are ok now, and even when I add again this nuget package it still works ...

utherkrandt commented 2 years ago

I had the same problem. The plugin used is SpecFlow.Actions.Selenium. The bug appears when I use the multiple browser

Steps to Reproduce Use SpecFlow.MsTest 3.9.58 and SpecFlow.Actions.Selenium 0.1.283 Add specflow.actions.json Add specflow.actions.chrome.json

Compile solution You should see that all feature.cs files have errors

utherkrandt commented 2 years ago

No problem with SpecFlow.xUnit(3.9.58)

SabotageAndi commented 2 years ago

Yeah, I found the issue last week, but then got sick. There is a problem in the SpecFlow.Actions.Configuration package with the code generation. I will try to get an updated version up on NuGet.org in the next days.

LukemansfieldPAX commented 2 years ago

I appear to be getting the same issue "The name 'TagHelper' does not exist in the current context" since updating SpecFlow to version 3.9.58.

SabotageAndi commented 2 years ago

@LukemansfieldPAX the problem is in the SpecFlow.Actions.Configuration package. If you update all SpecFlow packages to the latest version, it should work again. If not, please post your combination of SpecFlow packages (+ version number).

github-actions[bot] commented 2 years ago

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.