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.24k stars 754 forks source link

Background only applies to the first Scenario in a feature file #2655

Closed Cali007UK closed 1 year ago

Cali007UK commented 1 year ago

SpecFlow Version

3.9.40

Which test runner are you using?

SpecFlow+ Runner

Test Runner Version Number

3.9.31

.NET Implementation

.NET 5.0

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

No response

Issue Description

I have feature files with a Background and several Scenarios. When the feature files get generated by MSBuild it only applies the Background data to the very first Scenario in the feature file. I expect to see "Android_Tablet" in every Scenario. This used to work.

Background:
    @Android_Tablet

Example in the generated code (first Scenario)

 public virtual void TermsOfUseElementsAreVisible()
        {
            string[] tagsOfScenario = new string[] {
                    "Android_Tablet",
                    "SCAA-98"};
            System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary();
            TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Terms of Use elements are visible", null, tagsOfScenario, argumentsOfScenario, this._featureTags);

Second Scenario in the same feature file:

[TechTalk.SpecRun.ScenarioAttribute("Terms of Use Rejection elements are visible", new string[] {
                "SCAA-101"}, SourceLine=61)]
        public virtual void TermsOfUseRejectionElementsAreVisible()
        {
            string[] tagsOfScenario = new string[] {
                    "SCAA-101"};
            System.Collections.Specialized.OrderedDictionary argumentsOfScenario = new System.Collections.Specialized.OrderedDictionary();
            TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Terms of Use Rejection elements are visible", null, tagsOfScenario, argumentsOfScenario, this._featureTags);

Steps to Reproduce

Create a Feature file with a Background that contains a tag. Create 2 scenarios Build the project Observe test explorer

Link to Repro Project

No response

clrudolphi commented 1 year ago

I couldn't reproduce this. Do you have a reproduction of the problem you could point us to?

SabotageAndi commented 1 year ago

And the SpecFlow+ Runner isn't supported anymore. More details here: https://specflow.org/using-specflow/the-retirement-of-specflow-runner/

Cali007UK commented 1 year ago

I will close this, Background not accepting tags is not a limitation I'd come across.

And the SpecFlow+ Runner isn't supported anymore. More details here: https://specflow.org/using-specflow/the-retirement-of-specflow-runner/

There's no way most of the teams that use +Runner can migrate away when we end up losing so much functionality that the other frameworks don't give us as easily (Targets, Actions, Cucumber Json reports). You only need to look at a few forums and google results to see how devastating the decision to stop developing the runner has been.

github-actions[bot] commented 1 year 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.