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

Multiple .feature files per feature #2526

Closed rent-a-developer closed 2 years ago

rent-a-developer commented 2 years ago

SpecFlow Version

3.9.22

Which test runner are you using?

MSTest

Test Runner Version Number

16.11.0

.NET Implementation

.NET 5.0

Project Format of the SpecFlow project

Sdk-style project format

.feature.cs files are generated using

SpecFlowSingleFileGenerator custom tool

Test Execution Method

Visual Studio Test Explorer

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

{ "bindingCulture": { "name": "en-us" }, "language": { "feature": "en-us" }, "stepAssemblies": [ { "assembly": "SpecFlowSharedSteps" } ] }

Issue Description

I am not sure if this is a bug or if it is by design.

Is it possible to have multiple .feature files for the same feature? Example:

File "Features\FeatureA\ScenarioA.feature":

Feature: FeatureA

Scenario: FeatureA - ScenrarioA
    Given something

File "Features\FeatureA\ScenarioB.feature"

Feature: FeatureA

Scenario: FeatureA - ScenrarioB
    Given something

When I try this I get compilation errors, because for both .feature files the same class "FeatureAFeature" is generated.

Why do I even want to split one feature across multiple .feature files? Sometimes the scenarios of a feature are each pretty long / have a lot of steps. Therefore it would be nice if I could split the scenarios across multiple .feature files. Otherwise, when someone wants to navigate to a specific scenario they have to scroll a lot in one large .feature file.

Steps to Reproduce

Add the following files to a SpecFlow test project and build the project.

File "Features\FeatureA\ScenarioA.feature":

Feature: FeatureA

Scenario: FeatureA - ScenrarioA
    Given something

File "Features\FeatureA\ScenarioB.feature"

Feature: FeatureA

Scenario: FeatureA - ScenrarioB
    Given something

Link to Repro Project

No response

SabotageAndi commented 2 years ago

Yeah, you can't have multiple feature files with the same feature title in the same folder. You need to change the feature title in the files.

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.